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 MODEL_LOCALDAMPING_H 00014 #define MODEL_LOCALDAMPING_H 00015 00016 // -- project includes -- 00017 #include "Model/LocalDampingIGP.h" 00018 #include "Foundation/vec3.h" 00019 #include "Foundation/quintuple.h" 00020 00021 class CVarMPIBuffer; 00022 class AMPIBuffer; 00023 00028 template <class T> 00029 class CLocalDamping 00030 { 00031 protected: 00032 T *m_p; 00033 double m_visc; 00034 double m_dt; 00035 double m_E_diss; 00036 Vec3 m_force; 00037 00038 public: 00039 typedef CLocalDampingIGP ParameterType; 00040 00041 typedef double (CLocalDamping::* ScalarFieldFunction)() const; 00042 typedef pair<bool,double> (CLocalDamping::* CheckedScalarFieldFunction)() const; 00043 typedef Vec3 (CLocalDamping::* VectorFieldFunction)() const; 00044 00045 static ScalarFieldFunction getScalarFieldFunction(const string&); 00046 static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&); 00047 static VectorFieldFunction getVectorFieldFunction(const string&); 00048 00049 CLocalDamping(T*,double,double); // to be obsoleted 00050 CLocalDamping(T*,const CLocalDampingIGP&); 00051 CLocalDamping(T*,CLocalDampingIGP*); 00052 virtual ~CLocalDamping(); 00053 00054 void setTimeStepSize(double dt); 00055 virtual void calcForces(); 00056 00057 virtual bool hasTag(int,int) const; 00058 virtual Vec3 getPosFirst() const {return m_p->getPos();}; 00059 virtual Vec3 getPosSecond() const {return Vec3(0.0,0.0,0.0);}; 00060 virtual Vec3 getPos() const {return m_p->getPos();}; 00061 vector<int> getAllID() const; 00062 00063 esys::lsm::quintuple<Vec3,double,Vec3,double,Vec3> getRaw2Data() const 00064 { 00065 return 00066 esys::lsm::quintuple<Vec3,double,Vec3,double,Vec3>( 00067 m_p->getPos(), 00068 m_p->getRad(), 00069 Vec3::ZERO, 00070 0, 00071 getPos() 00072 ); 00073 } 00074 00075 double getDissipatedEnergy() const; 00076 Vec3 getForce() const; 00077 }; 00078 00079 #include "Model/LocalDamping.hpp" 00080 00081 #endif //__DAMPING_H