MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
driven.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/driven.h,v 1.44 2017/01/12 14:46:09 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* Driven elements:
33  * elements that are used depending on the (boolean) value
34  * of a driver. Example: a driven joint is assembled only
35  * if the driver is true, otherwise there is no joint and
36  * the reaction unknowns are set to zero
37  */
38 
39 #ifndef DRIVEN_H
40 #define DRIVEN_H
41 
42 #include "nestedelem.h"
43 #include "drive.h"
44 
45 #include "except.h"
46 
47 class DrivenElem : virtual public Elem,
48  public NestedElem, protected DriveOwner {
49 protected:
52  bool bActive;
53 
54 public:
56  const Elem* pE, SimulationEntity::Hints *ph = 0);
57  ~DrivenElem(void);
58 
59  virtual bool bIsActive(void) const;
60 
61  virtual void Output(OutputHandler& OH) const;
62 
63  virtual void SetValue(DataManager *pdm,
65  SimulationEntity::Hints *ph = 0);
66 
67  /* Scrive il contributo dell'elemento al file di restart */
68  virtual std::ostream& Restart(std::ostream& out) const;
69 
70  /* funzioni proprie */
71 
72  /*
73  * Elaborazione vettori e dati prima e dopo la predizione
74  * per MultiStepIntegrator */
75  virtual void BeforePredict(VectorHandler& X,
76  VectorHandler& XP,
77  VectorHandler& XPrev,
78  VectorHandler& XPPrev) const;
79 
80  virtual void AfterPredict(VectorHandler& X, VectorHandler& XP);
81 
82  /* Aggiorna dati in base alla soluzione */
83  virtual void Update(const VectorHandler& XCurr,
84  const VectorHandler& XPrimeCurr);
85 
86  virtual void AfterConvergence(const VectorHandler& X,
87  const VectorHandler& XP);
88 
89  /* assemblaggio jacobiano */
92  doublereal dCoef,
93  const VectorHandler& XCurr,
94  const VectorHandler& XPrimeCurr);
95 
96  virtual void AssMats(VariableSubMatrixHandler& WorkMatA,
97  VariableSubMatrixHandler& WorkMatB,
98  const VectorHandler& XCurr,
99  const VectorHandler& XPrimeCurr);
100 
101  /* assemblaggio residuo */
102  virtual SubVectorHandler& AssRes(SubVectorHandler& WorkVec,
103  doublereal dCoef,
104  const VectorHandler& XCurr,
105  const VectorHandler& XPrimeCurr);
106 
107  /*
108  * Returns the current value of a private data
109  * with 0 < i <= iGetNumPrivData()
110  */
111  virtual doublereal dGetPrivData(unsigned int i) const;
112 
113  /* Inverse Dynamics: */
114  virtual void Update(const VectorHandler& XCurr,
115  InverseDynamics::Order iOrder);
116 
117  /* inverse dynamics Jacobian matrix assembly */
118  virtual VariableSubMatrixHandler&
120  const VectorHandler& XCurr);
121 
122  /* inverse dynamics residual assembly */
123  virtual SubVectorHandler&
124  AssRes(SubVectorHandler& WorkVec,
125  const VectorHandler& XCurr,
126  const VectorHandler& XPrimeCurr,
127  const VectorHandler& XPrimePrimeCurr,
129 
130  /* Inverse Dynamics: */
131  virtual void AfterConvergence(const VectorHandler& X,
132  const VectorHandler& XP, const VectorHandler& XPP);
133 
134  /* InitialAssemblyElem */
135 public:
136  virtual unsigned int iGetInitialNumDof(void) const;
137 
138  /* Dimensione del workspace durante l'assemblaggio iniziale. Occorre tener
139  * conto del numero di dof che l'elemento definisce in questa fase e dei
140  * dof dei nodi che vengono utilizzati. Sono considerati dof indipendenti
141  * la posizione e la velocita' dei nodi */
142  virtual void InitialWorkSpaceDim(integer* piNumRows,
143  integer* piNumCols) const;
144 
145  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
146  virtual VariableSubMatrixHandler&
148  const VectorHandler& XCurr);
149 
150  /* Contributo al residuo durante l'assemblaggio iniziale */
151  virtual SubVectorHandler&
153  const VectorHandler& XCurr);
154 
155  /* ElemGravityOwner */
156 protected:
157  virtual Vec3 GetS_int(void) const;
158  virtual Mat3x3 GetJ_int(void) const;
159 
160  virtual Vec3 GetB_int(void) const;
161 
162  // NOTE: gravity owners must provide the momenta moment
163  // with respect to the origin of the global reference frame!
164  virtual Vec3 GetG_int(void) const;
165 
166 public:
167  virtual doublereal dGetM(void) const;
168  Vec3 GetS(void) const;
169  Mat3x3 GetJ(void) const;
170 
171  /* ElemDofOwner */
172 public:
173  virtual void SetInitialValue(VectorHandler& X);
174 };
175 
176 #endif /* DRIVEN_H */
177 
Definition: matvec3.h:98
virtual doublereal dGetPrivData(unsigned int i) const
Definition: driven.cc:364
virtual Vec3 GetB_int(void) const
Definition: driven.cc:439
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: driven.cc:252
DrivenElem(DataManager *pDM, const DriveCaller *pDC, const Elem *pE, SimulationEntity::Hints *ph=0)
Definition: driven.cc:44
bool bActive
Definition: driven.h:52
virtual Mat3x3 GetJ_int(void) const
Definition: driven.cc:429
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: driven.cc:242
virtual doublereal dGetM(void) const
Definition: driven.cc:461
virtual unsigned int iGetInitialNumDof(void) const
Definition: driven.cc:376
SimulationEntity::Hints * pHints
Definition: driven.h:51
Mat3x3 GetJ(void) const
Definition: driven.cc:481
virtual void SetInitialValue(VectorHandler &X)
Definition: driven.cc:492
~DrivenElem(void)
Definition: driven.cc:60
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: driven.cc:386
virtual void SetValue(DataManager *pdm, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: driven.cc:147
virtual Vec3 GetS_int(void) const
Definition: driven.cc:419
virtual void BeforePredict(VectorHandler &X, VectorHandler &XP, VectorHandler &XPrev, VectorHandler &XPPrev) const
Definition: driven.cc:117
virtual void Update(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: driven.cc:174
virtual std::ostream & Restart(std::ostream &out) const
Definition: driven.cc:90
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: driven.cc:298
virtual void AfterPredict(VectorHandler &X, VectorHandler &XP)
Definition: driven.cc:129
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: driven.cc:331
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: driven.cc:394
Definition: elem.h:75
virtual void Output(OutputHandler &OH) const
Definition: driven.cc:80
virtual Vec3 GetG_int(void) const
Definition: driven.cc:451
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: driven.cc:406
DataManager * pDM
Definition: driven.h:50
Vec3 GetS(void) const
Definition: driven.cc:471
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual bool bIsActive(void) const
Definition: driven.cc:74