ESyS-Particle  4.0.1
Wall.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __WALL_H
14 #define __WALL_H
15 
16 //--- project includes ---
17 #include "Fields/VectorWallFieldSlave.h"
18 #include "Foundation/vec3.h"
19 #include "Foundation/console.h"
20 
21 
22 //--- IO includes ---
23 #include <iostream>
24 
25 using std::ostream;
26 using std::endl;
27 using std::flush;
28 
29 class TML_comm;
30 
39 class CWall
40 {
41 protected:
42  Vec3 m_origin,m_normal;
43  Vec3 m_force;
44  Vec3 m_oldpos;
45  Vec3 m_vel;
46 
47 public:
48  typedef Vec3 (CWall::* VectorFieldFunction)() const;
49 
50  CWall();
51  CWall(const Vec3&,const Vec3&);
52  virtual ~CWall(){};
53 
54  void moveBy(const Vec3& v)
55  {
56  console.XDebug() << "CWall::moveBy: v = " << v << "\n";
57  console.XDebug() << "CWall::moveBy: oldpos = " << m_oldpos << "\n";
58  console.XDebug() << "CWall::moveBy: pre move origin = " << m_origin << "\n";
59  m_origin += v;
60  console.XDebug() << "CWall::moveBy: post move origin = " << m_origin << "\n";
61  };
62  void moveTo(const Vec3& v){m_origin=v;};
63  void setNormal(const Vec3& v){m_normal=v;};
64  void setVel(const Vec3& v){m_vel=v;};
65  Vec3 getVel(){return m_vel;};
66  inline const Vec3& getOrigin()const {return m_origin;};
67  inline const Vec3& getNormal()const {return m_normal;};
68  inline void addForce(const Vec3& force){m_force-=force;};
69  inline void zeroForce(){m_force=Vec3(0.0,0.0,0.0);};
70  inline const Vec3& getForce(){return m_force;};
71  inline const Vec3& getPos(){return m_origin;};
72  Vec3 getPos() const {return m_origin;};
73  Vec3 getForce() const {return m_force;};
74  inline double getDisplacement(){return (m_origin-m_oldpos).norm();};
75  inline Vec3 getTotalDisplacement(){return (m_origin-m_oldpos);};
76  inline void resetDisplacement(){m_oldpos=m_origin;};
77 
78  static VectorFieldFunction getVectorFieldFunction(const string&);
80  int getFieldSummationFlag(const string&);
81 
82  virtual void writeCheckPoint(ostream&,const string&) const;
83  virtual void loadCheckPoint(istream&);
84 
85  friend ostream& operator<<(ostream&,const CWall&);
86 };
87 
88 #endif //__WALL_H