MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
totalequation.h
Go to the documentation of this file.
1 /*
2  * MBDyn (C) is a multibody analysis code.
3  * http://www.mbdyn.org
4  *
5  * Copyright (C) 1996-2017
6  *
7  * Pierangelo Masarati <masarati@aero.polimi.it>
8  * Paolo Mantegazza <mantegazza@aero.polimi.it>
9  *
10  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11  * via La Masa, 34 - 20156 Milano, Italy
12  * http://www.aero.polimi.it
13  *
14  * Changing this copyright notice is forbidden.
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation (version 2 of the License).
19  *
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29  */
30 
31 #ifndef TOTALEQUATION_H
32 #define TOTALEQUATION_H
33 
34 #include "joint.h"
35 
36 #if 0
37 // friction will be dealt with later
38 #include "friction.h"
39 #endif
40 
41 // forward decls
42 class TotalReaction;
43 
44 
45 /* TotalEquation - begin */
47 virtual public Elem, public Joint {
48 private:
57  bool bPosActive[3];
58  bool bRotActive[3];
59 
60  bool bVelActive[3];
61  bool bAgvActive[3]; /* Agv stands for AnGular Velocity */
62 
66 
70 
71  unsigned int nConstraints;
72  unsigned int nPosConstraints;
73  unsigned int nRotConstraints;
74  unsigned int nVelConstraints;
75  unsigned int nAgvConstraints;
76 
77  unsigned int iPosIncid[3];
78  unsigned int iRotIncid[3];
79  unsigned int iVelIncid[3];
80  unsigned int iAgvIncid[3];
81 
82  unsigned int iPosEqIndex[3];
83  unsigned int iRotEqIndex[3];
84  unsigned int iVelEqIndex[3];
85  unsigned int iAgvEqIndex[3];
86 
88 
89  mutable Vec3 M;
90  mutable Vec3 F;
91  mutable Vec3 ThetaDelta;
93 
94  friend class TotalReaction;
95 
96 public:
97  /* Constructor */
98  TotalEquation(unsigned int uL, const DofOwner *pDO,
99  bool bPos[3], bool bVel[3],
100  TplDriveCaller<Vec3> *const pDCPos[3],
101  bool bRot[3], bool bAgv[3],
102  TplDriveCaller<Vec3> *const pDCRot[3],
103  const StructNode* pN1,
104  const Vec3& f1Tmp, const Mat3x3& R1hTmp, const Mat3x3& R1hrTmp,
105  const StructNode* pN2,
106  const Vec3& f2Tmp, const Mat3x3& R2hTmp, const Mat3x3& R2hrTmp,
107  flag fOut);
108 
109  /* Destructor */
110  ~TotalEquation(void);
111 
112  /* Contributo al file di restart */
113  virtual std::ostream& Restart(std::ostream& out) const;
114 
115  /* Tipo di Joint */
116  virtual Joint::Type
117  GetJointType(void) const {
118  return Joint::TOTALEQUATION;
119  };
120 
121  virtual unsigned int
122  iGetNumDof(void) const {
123  return nConstraints;
124  };
125 
126  virtual std::ostream&
127  DescribeDof(std::ostream& out,
128  const char *prefix = "",
129  bool bInitial = false) const;
130 
131  virtual void
132  DescribeDof(std::vector<std::string>& desc,
133  bool bInitial = false,
134  int i = -1) const;
135 
136  virtual std::ostream&
137  DescribeEq(std::ostream& out,
138  const char *prefix = "",
139  bool bInitial = false) const;
140 
141  virtual void
142  DescribeEq(std::vector<std::string>& desc,
143  bool bInitial = false,
144  int i = -1) const;
145 
147  GetDofType(unsigned int i) const {
148  ASSERT(i >= 0 && i < nConstraints);
149  return DofOrder::ALGEBRAIC;
150  };
151 
152  virtual void
153  SetValue(DataManager *pDM,
155  SimulationEntity::Hints *ph = 0);
156 
157  virtual Hint *
158  ParseHint(DataManager *pDM, const char *s) const;
159 
160  virtual void
162  const VectorHandler& XP);
163 
164  /* Inverse Dynamics: */
165  virtual void
167  const VectorHandler& XP, const VectorHandler& XPP);
168 
169  void
170  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
171  *piNumRows = nConstraints ;
172  *piNumCols = 12;
173  };
174 
177  doublereal dCoef,
178  const VectorHandler& XCurr,
179  const VectorHandler& XPrimeCurr);
180 
182  AssRes(SubVectorHandler& WorkVec,
183  doublereal dCoef,
184  const VectorHandler& XCurr,
185  const VectorHandler& XPrimeCurr);
186 
187  /* Inverse Dynamics Jacobian matrix assembly
188  VariableSubMatrixHandler&
189  AssJac(VariableSubMatrixHandler& WorkMat,
190  const VectorHandler& XCurr);
191 
192  Inverse Dynamics residual assembly
193  SubVectorHandler&
194  AssRes(SubVectorHandler& WorkVec,
195  const VectorHandler& XCurr,
196  const VectorHandler& XPrimeCurr,
197  const VectorHandler& XPrimePrimeCurr,
198  InverseDynamics::Order iOrder = InverseDynamics::INVERSE_DYNAMICS);
199 
200  Inverse Dynamics update
201  void Update(const VectorHandler& XCurr, InverseDynamics::Order iOrder = InverseDynamics::INVERSE_DYNAMICS);
202  DofOrder::Order GetEqType(unsigned int i) const;
203 */
204  void Output(OutputHandler& OH) const;
205 
206  /* funzioni usate nell'assemblaggio iniziale */
207 
208  virtual unsigned int
209  iGetInitialNumDof(void) const {
210  return 2*nConstraints;
211  };
212  virtual void
213  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
214  *piNumCols = *piNumRows = 24 + 2*nConstraints;
215  };
216 
217  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
220  const VectorHandler& XCurr);
221 
222  /* Contributo al residuo durante l'assemblaggio iniziale */
225  const VectorHandler& XCurr);
226 
227  /* Dati privati */
228  virtual unsigned int iGetNumPrivData(void) const;
229  virtual unsigned int iGetPrivDataIdx(const char *s) const;
230  virtual doublereal dGetPrivData(unsigned int i) const;
231 
232  /* *******PER IL SOLUTORE PARALLELO******** */
233  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
234  * utile per l'assemblaggio della matrice di connessione fra i dofs */
235  virtual void
236  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
237  connectedNodes.resize(2);
238  connectedNodes[0] = pNode1;
239  connectedNodes[1] = pNode2;
240  };
241  /* ************************************************ */
242 };
243 
244 
245 /* TotalEquation - end */
246 
247 /* TotalReaction - begin */
248 
250 virtual public Elem, public Joint {
251 private:
260  bool bPosActive[3];
261  bool bRotActive[3];
262 
263  unsigned int nConstraints;
264  unsigned int nPosConstraints;
265  unsigned int nRotConstraints;
266 
267  unsigned int iPosIncid[3];
268  unsigned int iRotIncid[3];
269 
271 
272  mutable Vec3 M;
273  mutable Vec3 F;
274  mutable Vec3 ThetaDelta;
276 
278 
279 public:
280  /* Constructor */
281  TotalReaction(unsigned int uL, const DofOwner *pDO,
282  bool bPos[3],
283  bool bRot[3],
284  const StructNode* pN1,
285  const Vec3& f1Tmp, const Mat3x3& R1hTmp, const Mat3x3& R1hrTmp,
286  const StructNode* pN2,
287  const Vec3& f2Tmp, const Mat3x3& R2hTmp, const Mat3x3& R2hrTmp,
288  TotalEquation* t_elm,
289  flag fOut);
290 
291  /* Destructor */
292  ~TotalReaction(void);
293 
294  /* Contributo al file di restart */
295  virtual std::ostream& Restart(std::ostream& out) const;
296 
297  /* Tipo di Joint */
298  virtual Joint::Type
299  GetJointType(void) const {
300  return Joint::TOTALREACTION;
301  };
302 
303  virtual unsigned int
304  iGetNumDof(void) const {
305  return 0;
306  };
307 
308  virtual std::ostream&
309  DescribeDof(std::ostream& out,
310  const char *prefix = "",
311  bool bInitial = false) const;
312 
313  virtual void
314  DescribeDof(std::vector<std::string>& desc,
315  bool bInitial = false,
316  int i = -1) const;
317 
318 #if 0
319  virtual std::ostream&
320  DescribeEq(std::ostream& out,
321  char *prefix = "",
322  bool bInitial = false) const;
323 
324  virtual void
325  DescribeEq(std::vector<std::string>& desc,
326  bool bInitial = false,
327  int i = -1) const;
328 #endif
329 
331  GetDofType(unsigned int i) const {
332  ASSERT(i >= 0 && i < nConstraints);
333  return DofOrder::ALGEBRAIC;
334  };
335 
336  virtual void
337  SetValue(DataManager *pDM,
339  SimulationEntity::Hints *ph = 0);
340 
341  virtual Hint *
342  ParseHint(DataManager *pDM, const char *s) const;
343 
344  virtual void
346  const VectorHandler& XP);
347 
348  virtual void
350  const VectorHandler& XP, const VectorHandler& XPP);
351 
352  void
353  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
354  *piNumRows = 12;
355  *piNumCols = 12 + nConstraints ;
356  };
357 
360  doublereal dCoef,
361  const VectorHandler& XCurr,
362  const VectorHandler& XPrimeCurr);
363 
365  AssRes(SubVectorHandler& WorkVec,
366  doublereal dCoef,
367  const VectorHandler& XCurr,
368  const VectorHandler& XPrimeCurr);
369 
370  DofOrder::Order GetEqType(unsigned int i) const;
371 
372  void Output(OutputHandler& OH) const;
373 
374  /* funzioni usate nell'assemblaggio iniziale */
375 
376  virtual unsigned int
377  iGetInitialNumDof(void) const {
378  return 2*nConstraints;
379  };
380  virtual void
381  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
382  *piNumRows = 24;
383  *piNumCols = *piNumRows = 24 + 2*nConstraints;
384  };
385 
386  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
389  const VectorHandler& XCurr);
390 
391  /* Contributo al residuo durante l'assemblaggio iniziale */
394  const VectorHandler& XCurr);
395 
396  /* Dati privati */
397  virtual unsigned int iGetNumPrivData(void) const;
398  virtual unsigned int iGetPrivDataIdx(const char *s) const;
399  virtual doublereal dGetPrivData(unsigned int i) const;
400 
401  /* *******PER IL SOLUTORE PARALLELO******** */
402  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
403  * utile per l'assemblaggio della matrice di connessione fra i dofs */
404  virtual void
405  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
406  connectedNodes.resize(2);
407  connectedNodes[0] = pNode1;
408  connectedNodes[1] = pNode2;
409  };
410  /* ************************************************ */
411 };
412 
413 
414 /* TotalReaction - end */
415 
416 
417 #endif // TOTALEQUATION_H
Definition: hint.h:38
bool bRotActive[3]
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
unsigned int nRotConstraints
Definition: totalequation.h:73
const StructNode * pNode1
VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
virtual unsigned int iGetNumPrivData(void) const
Type
Definition: joint.h:66
bool bAgvActive[3]
Definition: totalequation.h:61
unsigned int iPosIncid[3]
unsigned int nRotConstraints
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
void Output(OutputHandler &OH) const
long int flag
Definition: mbdyn.h:43
bool bRotActive[3]
Definition: totalequation.h:58
TplDriveOwner< Vec3 > XDrv
Definition: totalequation.h:63
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: matvec3.h:98
virtual unsigned int iGetNumDof(void) const
void Output(OutputHandler &OH) const
unsigned int nPosConstraints
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
unsigned int nConstraints
Definition: totalequation.h:71
VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
bool bVelActive[3]
Definition: totalequation.h:60
unsigned int iRotIncid[3]
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
virtual unsigned int iGetNumPrivData(void) const
const StructNode * pNode1
Definition: totalequation.h:49
bool bPosActive[3]
unsigned int iRotEqIndex[3]
Definition: totalequation.h:83
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
virtual doublereal dGetPrivData(unsigned int i) const
virtual Joint::Type GetJointType(void) const
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
DofOrder::Order GetDofType(unsigned int i) const
bool bPosActive[3]
Definition: totalequation.h:57
virtual Joint::Type GetJointType(void) const
unsigned int iAgvIncid[3]
Definition: totalequation.h:80
std::vector< Hint * > Hints
Definition: simentity.h:89
unsigned int iAgvEqIndex[3]
Definition: totalequation.h:85
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
unsigned int nVelConstraints
Definition: totalequation.h:74
TotalEquation * total_equation_element
TplDriveOwner< Vec3 > OmegaDrv
Definition: totalequation.h:68
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
virtual unsigned int iGetInitialNumDof(void) const
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
TplDriveOwner< Vec3 > OmegaPDrv
Definition: totalequation.h:69
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
DofOrder::Order GetEqType(unsigned int i) const
TplDriveOwner< Vec3 > XPDrv
Definition: totalequation.h:64
virtual unsigned int iGetNumDof(void) const
TplDriveOwner< Vec3 > ThetaDrv
Definition: totalequation.h:67
virtual std::ostream & Restart(std::ostream &out) const
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
virtual doublereal dGetPrivData(unsigned int i) const
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:137
virtual unsigned int iGetInitialNumDof(void) const
virtual unsigned int iGetPrivDataIdx(const char *s) const
const StructNode * pNode2
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
unsigned int iVelIncid[3]
Definition: totalequation.h:79
#define ASSERT(expression)
Definition: colamd.c:977
TotalReaction(unsigned int uL, const DofOwner *pDO, bool bPos[3], bool bRot[3], const StructNode *pN1, const Vec3 &f1Tmp, const Mat3x3 &R1hTmp, const Mat3x3 &R1hrTmp, const StructNode *pN2, const Vec3 &f2Tmp, const Mat3x3 &R2hTmp, const Mat3x3 &R2hrTmp, TotalEquation *t_elm, flag fOut)
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
unsigned int nAgvConstraints
Definition: totalequation.h:75
TplDriveOwner< Vec3 > XPPDrv
Definition: totalequation.h:65
const StructNode * pNode2
Definition: totalequation.h:50
unsigned int iVelEqIndex[3]
Definition: totalequation.h:84
Definition: elem.h:75
unsigned int nConstraints
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
unsigned int iPosEqIndex[3]
Definition: totalequation.h:82
unsigned int iPosIncid[3]
Definition: totalequation.h:77
virtual std::ostream & Restart(std::ostream &out) const
TotalEquation(unsigned int uL, const DofOwner *pDO, bool bPos[3], bool bVel[3], TplDriveCaller< Vec3 > *const pDCPos[3], bool bRot[3], bool bAgv[3], TplDriveCaller< Vec3 > *const pDCRot[3], const StructNode *pN1, const Vec3 &f1Tmp, const Mat3x3 &R1hTmp, const Mat3x3 &R1hrTmp, const StructNode *pN2, const Vec3 &f2Tmp, const Mat3x3 &R2hTmp, const Mat3x3 &R2hrTmp, flag fOut)
DofOrder::Order GetDofType(unsigned int i) const
Definition: joint.h:50
unsigned int nPosConstraints
Definition: totalequation.h:72
unsigned int iRotIncid[3]
Definition: totalequation.h:78
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual unsigned int iGetPrivDataIdx(const char *s) const