ESyS-Particle  4.0.1
RotBondedInteraction.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 __ROTBONDEDINTERACTION_H
14 #define __ROTBONDEDINTERACTION_H
15 
16 // -- project includes --
17 #include "Model/RotPairInteraction.h"
18 #include "Model/RotParticle.h"
19 #include "Model/BondedInteractionCpData.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  );
54 
56  const std::string &name,
57  double youngsModulus,
58  double poissonsRatio,
59  double cohesion,
60  double tanAngle,
61  int tag
62  );
63 
64  virtual std::string getTypeString() const
65  {
66  return "RotBonded";
67  }
68 
69  double kr,ks,kt,kb ;
70  double max_nForce, max_shForce,max_tMoment, max_bMoment;
71  int tag;
72  bool scaling;
73 };
74 
83 {
84  public: // types
86 
91 
92  typedef double (CRotBondedInteraction::* ScalarFieldFunction)() const;
93  typedef pair<bool,double> (CRotBondedInteraction::* CheckedScalarFieldFunction)() const;
94  typedef Vec3 (CRotBondedInteraction::* VectorFieldFunction)() const;
95 
96  private:
97 
98  // protected:
99  double m_dist;
100 
101  double m_kr ;
102  double m_ks ;
103  double m_kb ;
104  double m_kt ;
105 
106  double m_max_nForce; // always >0
107  double m_max_shForce ;
108  double m_max_tMoment ;
109  double m_max_bMoment ;
110 
111  double m_nForce; // >0, pulling; <0 , compressing
112  double m_shForce ; // always >0
113  double m_tMoment ;
114  double m_bMoment ;
115 
116  Vec3 m_force;
117  Vec3 m_moment ;
118 
119  Vec3 m_cpos; // ?
120  Vec3 m_D;
121  int m_tag;
122  bool m_scaling;
123 
124  public:
125 
128  virtual ~CRotBondedInteraction();
129 
130  static ScalarFieldFunction getScalarFieldFunction(const string&);
131  static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
132  static VectorFieldFunction getVectorFieldFunction(const string&);
133 
134  static string getType(){return "RotBonded";};
135 
136  int getTag() const;
137  void setTag(int tag);
138 
139  void calcForces();
140  //void setBreak(double);
141  bool broken();
142 
143  double getPotentialEnergy() const;
144  double getNormalPotentialEnergy() const;
145  double getShearPotentialEnergy() const;
146  double getTwistPotentialEnergy() const;
147  double getBendPotentialEnergy() const;
148  double getCriterion() const;
149  Vec3 getForce() const;
150  virtual Vec3 getPos() const {return m_cpos;};
151 
152  Vec3 getCentrePtDiff() const;
153  Vec3 getInitialCentrePtDiff() const;
154  Vec3 getInitialMidPoint() const;
155 
156  Vec3 getP2ShearForcePt() const;
157  Vec3 getP1ShearForcePt() const;
158  Vec3 getContactPoint() const;
159 
160  Vec3 getShearDiff() const;
161 
162  friend ostream& operator<<(ostream&,const CRotBondedInteraction&);
163  friend class TML_PackedMessageInterface;
164 
165  virtual void saveCheckPointData(std::ostream &oStream);
166 
167  virtual void loadCheckPointData(std::istream &iStream);
168 
169  // save/load of restart parameters
170  virtual void saveRestartData(std::ostream &oStream);
171  virtual void loadRestartData(std::istream &iStream);
172 };
173 
174 #endif //__BONDEDINTERACTION_H