ESyS-Particle
4.0.1
|
00001 00002 // // 00003 // Copyright (c) 2003-2011 by The University of Queensland // 00004 // Earth Systems Science Computational Centre (ESSCC) // 00005 // http://www.uq.edu.au/esscc // 00006 // // 00007 // Primary Business: Brisbane, Queensland, Australia // 00008 // Licensed under the Open Software License version 3.0 // 00009 // http://www.opensource.org/licenses/osl-3.0.php // 00010 // // 00012 00013 #ifndef __WALL_H 00014 #define __WALL_H 00015 00016 //--- project includes --- 00017 #include "Fields/VectorWallFieldSlave.h" 00018 #include "Foundation/vec3.h" 00019 #include "Foundation/console.h" 00020 00021 00022 //--- IO includes --- 00023 #include <iostream> 00024 00025 using std::ostream; 00026 using std::endl; 00027 using std::flush; 00028 00029 class TML_comm; 00030 00039 class CWall 00040 { 00041 protected: 00042 Vec3 m_origin,m_normal; 00043 Vec3 m_force; 00044 Vec3 m_oldpos; 00045 Vec3 m_vel; 00046 00047 public: 00048 typedef Vec3 (CWall::* VectorFieldFunction)() const; 00049 00050 CWall(); 00051 CWall(const Vec3&,const Vec3&); 00052 virtual ~CWall(){}; 00053 00054 void moveBy(const Vec3& v) 00055 { 00056 console.XDebug() << "CWall::moveBy: v = " << v << "\n"; 00057 console.XDebug() << "CWall::moveBy: oldpos = " << m_oldpos << "\n"; 00058 console.XDebug() << "CWall::moveBy: pre move origin = " << m_origin << "\n"; 00059 m_origin += v; 00060 console.XDebug() << "CWall::moveBy: post move origin = " << m_origin << "\n"; 00061 }; 00062 void moveTo(const Vec3& v){m_origin=v;}; 00063 void setNormal(const Vec3& v){m_normal=v;}; 00064 void setVel(const Vec3& v){m_vel=v;}; 00065 Vec3 getVel(){return m_vel;}; 00066 inline const Vec3& getOrigin()const {return m_origin;}; 00067 inline const Vec3& getNormal()const {return m_normal;}; 00068 inline void addForce(const Vec3& force){m_force-=force;}; 00069 inline void zeroForce(){m_force=Vec3(0.0,0.0,0.0);}; 00070 inline const Vec3& getForce(){return m_force;}; 00071 inline const Vec3& getPos(){return m_origin;}; 00072 Vec3 getPos() const {return m_origin;}; 00073 Vec3 getForce() const {return m_force;}; 00074 inline double getDisplacement(){return (m_origin-m_oldpos).norm();}; 00075 inline Vec3 getTotalDisplacement(){return (m_origin-m_oldpos);}; 00076 inline void resetDisplacement(){m_oldpos=m_origin;}; 00077 00078 static VectorFieldFunction getVectorFieldFunction(const string&); 00079 VectorWallFieldSlave<CWall>* generateVectorFieldSlave(TML_Comm*,const string&); 00080 int getFieldSummationFlag(const string&); 00081 00082 virtual void writeCheckPoint(ostream&,const string&) const; 00083 virtual void loadCheckPoint(istream&); 00084 00085 friend ostream& operator<<(ostream&,const CWall&); 00086 }; 00087 00088 #endif //__WALL_H