ESyS-Particle  2.3.2
SphereBody.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
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 __SPHEREBODY_H
14 #define __SPHEREBODY_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 
40 {
41  protected:
43  double m_radius;
47 
48  public:
49  CSphereBody();
50  CSphereBody(const Vec3&,const double&);
51  virtual ~CSphereBody(){};
52 
53  void moveBy (const Vec3& v) {m_centre += v;};
54  void moveTo (const Vec3& v) {m_centre = v;};
55  void setVel (const Vec3& v) {m_vel = v;};
56  Vec3 getVel () {return m_vel;};
57 
58  inline const Vec3& getCentre() const {return m_centre;};
59  inline const double& getRadius() const {return m_radius;};
60  inline void addForce(const Vec3& force) {m_force -= force;};
61  inline void zeroForce(){m_force = Vec3(0.0,0.0,0.0);};
62  inline const Vec3& getForce(){return m_force;};
63  inline const Vec3& getPos(){return m_centre;};
64  //Vec3 getPos(){return m_centre;};
65  //ec3 getForce(){return m_force;};
66  inline double getDisplacement(){return (m_centre - m_oldpos).norm();};
67  inline Vec3 getTotalDisplacement(){return (m_centre - m_oldpos);};
68  inline void resetDisplacement(){m_oldpos = m_centre;};
69 
70  virtual void writeCheckPoint(ostream&,const string&) const;
71  virtual void loadCheckPoint(istream&);
72 
73  friend ostream& operator<<(ostream&,const CSphereBody&);
74 };
75 
76 #endif //__SPHEREBODY_H
CSphereBody()
Definition: SphereBody.cpp:20
base class for spherical non-inertial bodies (similar to simple walls)
Definition: SphereBody.h:39
const Vec3 & getPos()
Definition: SphereBody.h:63
Vec3 getVel()
Definition: SphereBody.h:56
Definition: vec3.h:46
void setVel(const Vec3 &v)
Definition: SphereBody.h:55
const Vec3 & getForce()
Definition: SphereBody.h:62
const Vec3 & getCentre() const
Definition: SphereBody.h:58
Vec3 getTotalDisplacement()
Definition: SphereBody.h:67
void addForce(const Vec3 &force)
Definition: SphereBody.h:60
Vec3 m_centre
Definition: SphereBody.h:42
Vec3 m_vel
Definition: SphereBody.h:46
const double & getRadius() const
Definition: SphereBody.h:59
Vec3 m_force
Definition: SphereBody.h:44
virtual void writeCheckPoint(ostream &, const string &) const
Definition: SphereBody.cpp:50
double getDisplacement()
Definition: SphereBody.h:66
virtual ~CSphereBody()
Definition: SphereBody.h:51
double m_radius
Definition: SphereBody.h:43
virtual void loadCheckPoint(istream &)
Definition: SphereBody.cpp:60
void moveTo(const Vec3 &v)
Definition: SphereBody.h:54
friend ostream & operator<<(ostream &, const CSphereBody &)
Definition: SphereBody.cpp:67
void resetDisplacement()
Definition: SphereBody.h:68
void zeroForce()
Definition: SphereBody.h:61
Vec3 m_oldpos
Definition: SphereBody.h:45
void moveBy(const Vec3 &v)
Definition: SphereBody.h:53