ESyS-Particle  2.3.4
SphereBody.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 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.apache.org/licenses/LICENSE-2.0 //
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::zeroForce
void zeroForce()
Definition: SphereBody.h:61
CSphereBody::moveTo
void moveTo(const Vec3 &v)
Definition: SphereBody.h:54
CSphereBody::getVel
Vec3 getVel()
Definition: SphereBody.h:56
CSphereBody::moveBy
void moveBy(const Vec3 &v)
Definition: SphereBody.h:53
CSphereBody::resetDisplacement
void resetDisplacement()
Definition: SphereBody.h:68
CSphereBody::getPos
const Vec3 & getPos()
Definition: SphereBody.h:63
CSphereBody::setVel
void setVel(const Vec3 &v)
Definition: SphereBody.h:55
CSphereBody::getTotalDisplacement
Vec3 getTotalDisplacement()
Definition: SphereBody.h:67
console.h
operator<<
ostream & operator<<(ostream &ost, const CSphereBody &w)
Definition: SphereBody.cpp:67
CSphereBody::getRadius
const double & getRadius() const
Definition: SphereBody.h:59
CSphereBody::addForce
void addForce(const Vec3 &force)
Definition: SphereBody.h:60
CSphereBody
base class for spherical non-inertial bodies (similar to simple walls)
Definition: SphereBody.h:40
CSphereBody::getCentre
const Vec3 & getCentre() const
Definition: SphereBody.h:58
CSphereBody::m_centre
Vec3 m_centre
Definition: SphereBody.h:42
Vec3
Definition: vec3.h:47
CSphereBody::getDisplacement
double getDisplacement()
Definition: SphereBody.h:66
CSphereBody::m_vel
Vec3 m_vel
Definition: SphereBody.h:46
CSphereBody::~CSphereBody
virtual ~CSphereBody()
Definition: SphereBody.h:51
vec3.h
CSphereBody::writeCheckPoint
virtual void writeCheckPoint(ostream &, const string &) const
Definition: SphereBody.cpp:50
CSphereBody::m_radius
double m_radius
Definition: SphereBody.h:43
Vec3::ZERO
static const Vec3 ZERO
Definition: vec3.h:52
CSphereBody::operator<<
friend ostream & operator<<(ostream &, const CSphereBody &)
Definition: SphereBody.cpp:67
CSphereBody::m_force
Vec3 m_force
Definition: SphereBody.h:44
CSphereBody::CSphereBody
CSphereBody()
Definition: SphereBody.cpp:20
CSphereBody::loadCheckPoint
virtual void loadCheckPoint(istream &)
Definition: SphereBody.cpp:60
CSphereBody::m_oldpos
Vec3 m_oldpos
Definition: SphereBody.h:45
SphereBody.h
CSphereBody::getForce
const Vec3 & getForce()
Definition: SphereBody.h:62