ESyS-Particle  2.2
RotBondedInteraction.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2013 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 __ROTBONDEDINTERACTION_H
14 #define __ROTBONDEDINTERACTION_H
15 
16 // -- project includes --
18 #include "Model/RotParticle.h"
20 #include "Model/IGParam.h"
21 #include "Foundation/vec3.h"
22 
23 // -- I/O includes --
24 #include <iostream>
25 using std::ostream;
26 
35  double calc_angle( double , double ) ;
36 
37 class CRotBondedIGP : public AIGParam
38 {
39 public:
40  CRotBondedIGP();
42  const std::string &name,
43  double kr,
44  double ks,
45  double kt,
46  double kb,
47  double max_nForce,
48  double max_shForce,
49  double max_tMoment,
50  double max_bMoment,
51  int tag,
52  bool scaling,
53  bool AmeanR_scaling,
54  double truncated
55  );
56 
58  const std::string &name,
59  double youngsModulus,
60  double poissonsRatio,
61  double cohesion,
62  double tanAngle,
63  int tag,
64  bool AmeanR_scaling,
65  double truncated
66  );
67 
68  virtual std::string getTypeString() const
69  {
70  return "RotBonded";
71  }
72 
73  double kr,ks,kt,kb ;
75  int tag;
76  bool scaling;
78  double truncated;
79 };
80 
89 {
90  public: // types
92 
97 
98  typedef double (CRotBondedInteraction::* ScalarFieldFunction)() const;
99  typedef pair<bool,double> (CRotBondedInteraction::* CheckedScalarFieldFunction)() const;
101 
102  private:
103 
104  // protected:
105  double m_dist;
106 
107  double m_kr ;
108  double m_ks ;
109  double m_kb ;
110  double m_kt ;
111 
112  double m_max_nForce; // always >0
113  double m_max_shForce ;
114  double m_max_tMoment ;
115  double m_max_bMoment ;
116 
117  double m_nForce; // >0, pulling; <0 , compressing
118  double m_shForce ; // always >0
119  double m_tMoment ;
120  double m_bMoment ;
121 
124 
125  Vec3 m_cpos; // ?
127  int m_tag;
128  bool m_scaling;
130  double m_truncated;
131 
132  public:
133 
136  virtual ~CRotBondedInteraction();
137 
138  static ScalarFieldFunction getScalarFieldFunction(const string&);
140  static VectorFieldFunction getVectorFieldFunction(const string&);
141 
142  static string getType(){return "RotBonded";};
143 
144  int getTag() const;
145  void setTag(int tag);
146 
147  void calcForces();
148  //void setBreak(double);
149  bool broken();
150 
151  double getPotentialEnergy() const;
152  double getNormalPotentialEnergy() const;
153  double getShearPotentialEnergy() const;
154  double getTwistPotentialEnergy() const;
155  double getBendPotentialEnergy() const;
156  double getCriterion() const;
157  Vec3 getForce() const;
158  virtual Vec3 getPos() const {return m_cpos;};
159 
160  Vec3 getCentrePtDiff() const;
162  Vec3 getInitialMidPoint() const;
163 
164  Vec3 getP2ShearForcePt() const;
165  Vec3 getP1ShearForcePt() const;
166  Vec3 getContactPoint() const;
167 
168  Vec3 getShearDiff() const;
169 
170  friend ostream& operator<<(ostream&,const CRotBondedInteraction&);
172 
173  virtual void saveCheckPointData(std::ostream &oStream);
174 
175  virtual void loadCheckPointData(std::istream &iStream);
176 
177  // save/load of restart parameters
178  virtual void saveRestartData(std::ostream &oStream);
179  virtual void loadRestartData(std::istream &iStream);
180 };
181 
182 #endif //__BONDEDINTERACTION_H