ESyS-Particle  4.0.1
RotDamping.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
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 __ROT_DAMPING_H
14 #define __ROT_DAMPING_H
15 
16 // -- project includes --
17 #include "Model/DampingIGP.h"
18 #include "Foundation/vec3.h"
19 #include "Foundation/quintuple.h"
21 
26 template <class T>
28 {
29 protected:
30  T *m_p;
32  double m_visc;
33  double m_dt;
34  int m_maxiter;
35  double m_E_diss;
37 
38  static double s_limit2;
39  static int s_flops;
40 
41 public:
42  typedef CDampingIGP ParameterType;
43 
44  typedef double (CRotDamping::* ScalarFieldFunction)() const;
45  typedef pair<bool,double> (CRotDamping::* CheckedScalarFieldFunction)() const;
46  typedef Vec3 (CRotDamping::* VectorFieldFunction)() const;
47 
48  static ScalarFieldFunction getScalarFieldFunction(const string&);
49  static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
50  static VectorFieldFunction getVectorFieldFunction(const string&);
51 
53  virtual ~CRotDamping();
54 
55  inline void setLimit(double limit){s_limit2=limit*limit;};
56  virtual void calcForces();
57  void setTimeStepSize(double dt);
58  virtual bool hasTag(int,int) const;
59  virtual Vec3 getPosFirst() const {return m_p->getPos();};
60  virtual Vec3 getPosSecond() const {return Vec3(0.0,0.0,0.0);};
61  virtual Vec3 getPos() const {return m_p->getPos();};
62  vector<int> getAllID() const;
63  quintuple<Vec3,double,Vec3,double,Vec3> getRaw2Data() const
64  {
65  return
67  m_p->getPos(),
68  m_p->getRad(),
69  Vec3::ZERO,
70  0,
71  getPos()
72  );
73  }
74 
75  static void zeroFlops(){s_flops=0;};
76  static int Flops(){return s_flops;};
77 
78  double getDissipatedEnergy() const;
79  Vec3 getForce() const;
80 };
81 
82 #include "Model/RotDamping.hpp"
83 
84 #endif //__ROT_DAMPING_H