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 __ROT_DAMPING_H 00014 #define __ROT_DAMPING_H 00015 00016 // -- project includes -- 00017 #include "Model/DampingIGP.h" 00018 #include "Foundation/vec3.h" 00019 #include "Foundation/quintuple.h" 00020 using esys::lsm::quintuple; 00021 00026 template <class T> 00027 class CRotDamping 00028 { 00029 protected: 00030 T *m_p; 00031 Vec3 m_vref; 00032 double m_visc; 00033 double m_dt; 00034 int m_maxiter; 00035 double m_E_diss; 00036 Vec3 m_force; 00037 00038 static double s_limit2; 00039 static int s_flops; 00040 00041 public: 00042 typedef CDampingIGP ParameterType; 00043 00044 typedef double (CRotDamping::* ScalarFieldFunction)() const; 00045 typedef pair<bool,double> (CRotDamping::* CheckedScalarFieldFunction)() const; 00046 typedef Vec3 (CRotDamping::* VectorFieldFunction)() const; 00047 00048 static ScalarFieldFunction getScalarFieldFunction(const string&); 00049 static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&); 00050 static VectorFieldFunction getVectorFieldFunction(const string&); 00051 00052 CRotDamping(T*,CDampingIGP*); 00053 virtual ~CRotDamping(); 00054 00055 inline void setLimit(double limit){s_limit2=limit*limit;}; 00056 virtual void calcForces(); 00057 void setTimeStepSize(double dt); 00058 virtual bool hasTag(int,int) const; 00059 virtual Vec3 getPosFirst() const {return m_p->getPos();}; 00060 virtual Vec3 getPosSecond() const {return Vec3(0.0,0.0,0.0);}; 00061 virtual Vec3 getPos() const {return m_p->getPos();}; 00062 vector<int> getAllID() const; 00063 quintuple<Vec3,double,Vec3,double,Vec3> getRaw2Data() const 00064 { 00065 return 00066 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 static void zeroFlops(){s_flops=0;}; 00076 static int Flops(){return s_flops;}; 00077 00078 double getDissipatedEnergy() const; 00079 Vec3 getForce() const; 00080 }; 00081 00082 #include "Model/RotDamping.hpp" 00083 00084 #endif //__ROT_DAMPING_H