MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
nestedelem.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/nestedelem.h,v 1.21 2017/01/12 14:46:10 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 /* Nested elements
33  */
34 
35 #ifndef NESTEDELEM_H
36 #define NESTEDELEM_H
37 
38 #include "elem.h"
39 #include "aerodyn.h"
40 #include "gravity.h"
41 
42 #include "except.h"
43 
44 class NestedElem : virtual public Elem,
45 public InitialAssemblyElem,
46 public AerodynamicElem,
47 public ElemGravityOwner
48 {
49 protected:
51 
52 public:
53  NestedElem(const Elem* pE);
54  ~NestedElem(void);
55 
56  virtual Elem *pGetElem(void) const;
57 
58  virtual void OutputPrepare(OutputHandler& OH);
59  virtual void Output(OutputHandler& OH) const;
60 
61  virtual void SetOutputFlag(flag f);
62 
63  virtual void SetValue(DataManager *pdm,
65  SimulationEntity::Hints *ph = 0);
66 
67  /* Tipo dell'elemento (usato solo per debug ecc.) */
68  virtual Elem::Type GetElemType(void) const;
69 
70  /* funzioni di servizio */
71 
72  /*
73  * Il metodo iGetNumDof() serve a ritornare il numero di gradi
74  * di liberta' propri che l'elemento definisce. Non e' virtuale
75  * in quanto serve a ritornare 0 per gli elementi che non possiedono
76  * gradi di liberta'.
77  * Viene usato nella costruzione dei DofOwner e quindi deve essere
78  * indipendente da essi. In genere non comporta overhead in quanto
79  * il numero di dof aggiunti da un tipo e' una costante e non
80  * richede dati propri.
81  * Il metodo pGetDofOwner() ritorna il puntatore al DofOwner
82  * dell'oggetto.
83  * E' usato da tutti quelli che agiscono direttamente sui DofOwner.
84  * Non e' virtuale in quanto ritorna NULL per tutti i tipi che non hanno
85  * dof propri.
86  * Il metodo GetDofType() ritorna, per ogni dof dell'elemento, l'ordine.
87  * E' usato per completare i singoli Dof relativi all'elemento.
88  */
89 
90  /*
91  * ritorna il numero di Dofs per gli elementi che sono
92  * anche DofOwners
93  */
94  virtual unsigned int iGetNumDof(void) const;
95 
96  /* inherited from SimulationEntity */
97  virtual std::ostream& DescribeDof(std::ostream& out,
98  const char *prefix = "", bool bInitial = false) const;
99  virtual void DescribeDof(std::vector<std::string>& desc,
100  bool bInitial = false, int i = -1) const;
101  virtual std::ostream& DescribeEq(std::ostream& out,
102  const char *prefix = "", bool bInitial = false) const;
103  virtual void DescribeEq(std::vector<std::string>& desc,
104  bool bInitial = false, int i = -1) const;
105 
106  /* esegue operazioni sui dof di proprieta' dell'elemento */
107  virtual DofOrder::Order GetDofType(unsigned int i) const;
108 
109  virtual DofOrder::Order GetEqType(unsigned int i) const;
110 
111  /* funzioni proprie */
112 
113  /* Dimensioni del workspace */
114  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
115 
116  /*
117  * Elaborazione vettori e dati prima e dopo la predizione
118  * per MultiStepIntegrator */
119  virtual void BeforePredict(VectorHandler& X,
120  VectorHandler& XP,
121  VectorHandler& XPrev,
122  VectorHandler& XPPrev) const;
123 
124  virtual void AfterPredict(VectorHandler& X, VectorHandler& XP);
125 
126  /* Aggiorna dati in base alla soluzione */
127  virtual void Update(const VectorHandler& XCurr,
128  const VectorHandler& XPrimeCurr);
129 
130  virtual void AfterConvergence(const VectorHandler& X,
131  const VectorHandler& XP);
132 
133  /* assemblaggio jacobiano */
134  virtual VariableSubMatrixHandler&
136  doublereal dCoef,
137  const VectorHandler& XCurr,
138  const VectorHandler& XPrimeCurr);
139 
140  virtual void AssMats(VariableSubMatrixHandler& WorkMatA,
141  VariableSubMatrixHandler& WorkMatB,
142  const VectorHandler& XCurr,
143  const VectorHandler& XPrimeCurr);
144 
145  /* assemblaggio residuo */
146  virtual SubVectorHandler& AssRes(SubVectorHandler& WorkVec,
147  doublereal dCoef,
148  const VectorHandler& XCurr,
149  const VectorHandler& XPrimeCurr);
150 
151  /*
152  * Metodi per l'estrazione di dati "privati".
153  * Si suppone che l'estrattore li sappia interpretare.
154  * Come default non ci sono dati privati estraibili
155  */
156  virtual unsigned int iGetNumPrivData(void) const;
157 
158  /*
159  * Maps a string (possibly with substrings) to a private data;
160  * returns a valid index ( > 0 && <= iGetNumPrivData()) or 0
161  * in case of unrecognized data; error must be handled by caller
162  */
163  virtual unsigned int iGetPrivDataIdx(const char *s) const;
164 
165  /*
166  * Returns the current value of a private data
167  * with 0 < i <= iGetNumPrivData()
168  */
169  virtual doublereal dGetPrivData(unsigned int i) const;
170 
171  /* *******PER IL SOLUTORE PARALLELO********
172  * Fornisce il tipo e la label dei nodi che sono connessi all'elemento
173  * utile per l'assemblaggio della matrice di connessione fra i dofs
174  */
175  virtual int GetNumConnectedNodes(void) const;
176  virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const;
177 
178  // inverse dynamics
179  /* inverse dynamics capable element */
180  virtual bool bInverseDynamics(void) const;
181 
182  /* Inverse Dynamics: */
183  virtual void Update(const VectorHandler& XCurr,
184  InverseDynamics::Order iOrder);
185 
186  /* inverse dynamics Jacobian matrix assembly */
187  virtual VariableSubMatrixHandler&
189  const VectorHandler& XCurr);
190 
191  /* inverse dynamics residual assembly */
192  virtual SubVectorHandler&
193  AssRes(SubVectorHandler& WorkVec,
194  const VectorHandler& XCurr,
195  const VectorHandler& XPrimeCurr,
196  const VectorHandler& XPrimePrimeCurr,
198 
199  /* Inverse Dynamics: */
200  virtual void AfterConvergence(const VectorHandler& X,
201  const VectorHandler& XP, const VectorHandler& XPP);
202 
203  // end of inverse dynamics
204 
205  /* InitialAssemblyElem */
206 public:
207  virtual unsigned int iGetInitialNumDof(void) const;
208 
209  /* Dimensione del workspace durante l'assemblaggio iniziale. Occorre tener
210  * conto del numero di dof che l'elemento definisce in questa fase e dei
211  * dof dei nodi che vengono utilizzati. Sono considerati dof indipendenti
212  * la posizione e la velocita' dei nodi */
213  virtual void InitialWorkSpaceDim(integer* piNumRows,
214  integer* piNumCols) const;
215 
216  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
217  virtual VariableSubMatrixHandler&
219  const VectorHandler& XCurr);
220 
221  /* Contributo al residuo durante l'assemblaggio iniziale */
222  virtual SubVectorHandler&
224  const VectorHandler& XCurr);
225 
226  /* AerodynamicElem */
227 public:
228  virtual AerodynamicElem::Type GetAerodynamicElemType(void) const;
229  virtual bool NeedsAirProperties(void) const;
230  virtual const InducedVelocity *pGetInducedVelocity(void) const;
231  virtual void PutAirProperties(const AirProperties* pAP);
232 
233  /* ElemGravityOwner */
234 protected:
235  virtual Vec3 GetS_int(void) const;
236  virtual Mat3x3 GetJ_int(void) const;
237 
238  virtual Vec3 GetB_int(void) const;
239 
240  // NOTE: gravity owners must provide the momenta moment
241  // with respect to the origin of the global reference frame!
242  virtual Vec3 GetG_int(void) const;
243 
244 public:
245  virtual doublereal dGetM(void) const;
246  Vec3 GetS(void) const;
247  Mat3x3 GetJ(void) const;
248 
249  /* ElemDofOwner */
250 public:
251  virtual const DofOwner* pGetDofOwner(void) const;
252  virtual integer iGetFirstIndex(void) const;
253  virtual void SetInitialValue(VectorHandler& X);
254 };
255 
256 #endif // NESTEDELEM_H
257 
virtual Vec3 GetG_int(void) const
Definition: nestedelem.cc:474
virtual void SetInitialValue(VectorHandler &X)
Definition: nestedelem.cc:548
long int flag
Definition: mbdyn.h:43
virtual Vec3 GetS_int(void) const
Definition: nestedelem.cc:436
virtual doublereal dGetM(void) const
Definition: nestedelem.cc:486
Definition: matvec3.h:98
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: nestedelem.cc:348
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: nestedelem.cc:258
virtual void OutputPrepare(OutputHandler &OH)
Definition: nestedelem.cc:71
virtual void PutAirProperties(const AirProperties *pAP)
Definition: nestedelem.cc:412
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: nestedelem.cc:156
virtual integer iGetFirstIndex(void) const
Definition: nestedelem.cc:536
virtual Mat3x3 GetJ_int(void) const
Definition: nestedelem.cc:448
virtual const InducedVelocity * pGetInducedVelocity(void) const
Definition: nestedelem.cc:423
virtual unsigned int iGetInitialNumDof(void) const
Definition: nestedelem.cc:337
virtual DofOrder::Order GetEqType(unsigned int i) const
Definition: nestedelem.cc:115
virtual Vec3 GetB_int(void) const
Definition: nestedelem.cc:460
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: nestedelem.cc:373
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: nestedelem.cc:122
Mat3x3 GetJ(void) const
Definition: nestedelem.cc:510
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual Elem::Type GetElemType(void) const
Definition: nestedelem.cc:92
virtual int GetNumConnectedNodes(void) const
Definition: nestedelem.cc:278
virtual unsigned int iGetNumDof(void) const
Definition: nestedelem.cc:100
virtual void Update(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: nestedelem.cc:194
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: nestedelem.cc:220
virtual void Output(OutputHandler &OH) const
Definition: nestedelem.cc:78
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: nestedelem.cc:232
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: nestedelem.cc:138
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: nestedelem.cc:202
virtual bool NeedsAirProperties(void) const
Definition: nestedelem.cc:400
virtual AerodynamicElem::Type GetAerodynamicElemType(void) const
Definition: nestedelem.cc:388
virtual void SetValue(DataManager *pdm, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: nestedelem.cc:184
virtual void BeforePredict(VectorHandler &X, VectorHandler &XP, VectorHandler &XPrev, VectorHandler &XPPrev) const
Definition: nestedelem.cc:167
virtual unsigned int iGetNumPrivData(void) const
Definition: nestedelem.cc:247
~NestedElem(void)
Definition: nestedelem.cc:50
NestedElem(const Elem *pE)
Definition: nestedelem.cc:39
Definition: elem.h:75
Type
Definition: elem.h:91
virtual bool bInverseDynamics(void) const
Definition: nestedelem.cc:292
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: nestedelem.cc:210
Elem * pElem
Definition: nestedelem.h:50
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: nestedelem.cc:358
virtual void SetOutputFlag(flag f)
Definition: nestedelem.cc:85
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: nestedelem.cc:285
double doublereal
Definition: colamd.c:52
virtual const DofOwner * pGetDofOwner(void) const
Definition: nestedelem.cc:523
virtual Elem * pGetElem(void) const
Definition: nestedelem.cc:60
long int integer
Definition: colamd.c:51
virtual void AfterPredict(VectorHandler &X, VectorHandler &XP)
Definition: nestedelem.cc:177
virtual doublereal dGetPrivData(unsigned int i) const
Definition: nestedelem.cc:268
Vec3 GetS(void) const
Definition: nestedelem.cc:498
virtual DofOrder::Order GetDofType(unsigned int i) const
Definition: nestedelem.cc:108