ESyS-Particle  2.3.2
Damping.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 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.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef MODEL_DAMPING_H
14 #define MODEL_DAMPING_H
15 
16 // -- project includes --
17 #include "Model/DampingIGP.h"
18 #include "Foundation/vec3.h"
19 #include "Foundation/quintuple.h"
20 
21 class CVarMPIBuffer;
22 class AMPIBuffer;
23 
28 template <class T>
29 class CDamping
30 {
31 protected:
32  T *m_p;
34  double m_visc;
35  double m_dt;
36  int m_maxiter;
37  double m_E_diss;
39 
40  static double s_limit2;
41  static int s_flops;
42 
43 public:
45 
46  typedef double (CDamping::* ScalarFieldFunction)() const;
47  typedef pair<bool,double> (CDamping::* CheckedScalarFieldFunction)() const;
48  typedef Vec3 (CDamping::* VectorFieldFunction)() const;
49 
50  static ScalarFieldFunction getScalarFieldFunction(const string&);
52  static VectorFieldFunction getVectorFieldFunction(const string&);
53 
54  CDamping(T*,const Vec3&,double,double,int); // to be obsoleted
55  CDamping(T*,const CDampingIGP&);
56  CDamping(T*,CDampingIGP*);
57  virtual ~CDamping();
58 
59  inline void setLimit(double limit){s_limit2=limit*limit;};
60  void setTimeStepSize(double dt);
61  virtual void calcForces();
62  virtual bool hasTag(int,int) const;
63  virtual Vec3 getPosFirst() const {return m_p->getPos();};
64  virtual Vec3 getPosSecond() const {return Vec3(0.0,0.0,0.0);};
65  virtual Vec3 getPos() const {return m_p->getPos();};
66  vector<int> getAllID() const;
68  {
69  return
71  m_p->getPos(),
72  m_p->getRad(),
73  Vec3::ZERO,
74  0,
75  getPos()
76  );
77  }
78 
79  static void zeroFlops(){s_flops=0;};
80  static int Flops(){return s_flops;};
81 
82  double getDissipatedEnergy() const;
83  Vec3 getForce() const;
84 };
85 
86 #include "Model/Damping.hpp"
87 
88 #endif //__DAMPING_H