MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
autostr.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/autostr.h,v 1.34 2017/01/12 14:46:43 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 /* Elemento strutturale automatico */
33 
34 #ifndef AUTOSTR_H
35 #define AUTOSTR_H
36 
37 #include "elem.h"
38 #include "strnode.h"
39 #include "matvec3.h"
40 
41 /* AutomaticStructDispElem - begin */
42 
43 class AutomaticStructDispElem : virtual public Elem {
44  friend class DynamicStructDispNode;
45  friend class DynamicStructNode;
46 
47 protected:
51 
52  /* Accesso ai suoi dati */
53  // FIXME: return 0?
54  virtual inline const Vec3& GetBCurr(void) const { return B; };
55  virtual inline const Vec3& GetGCurr(void) const { return ::Zero3; };
56  virtual inline const Vec3& GetBPCurr(void) const { return BP; };
57  virtual inline const Vec3& GetGPCurr(void) const { return ::Zero3; };
58 
59  mutable doublereal m;
60 
61  virtual void ComputeAccelerations(Vec3& XPP) const;
62 
63 #ifdef USE_NETCDF
64  NcVar *Var_B,
65  *Var_G,
66  *Var_BP,
67  *Var_GP;
68 #endif /* USE_NETCDF */
69 
70 public:
72 
73  virtual ~AutomaticStructDispElem(void) {
74  NO_OP;
75  };
76 
77  /* inizializza i dati */
78  void Init(const Vec3& b, const Vec3& bp);
79 
80  /* Scrive il contributo dell'elemento al file di restart */
81  virtual std::ostream& Restart(std::ostream& out) const;
82 
83  /* Tipo dell'elemento (usato per debug ecc.) */
84  virtual Elem::Type GetElemType(void) const {
86  };
87 
88 #if 0
89  // FIXME: ?
90  virtual void AddInertia(const doublereal& dm, const Vec3& dS,
91  const Mat3x3& dJ);
92 #endif
93  virtual void AddInertia(const doublereal& dm);
94 
95  virtual doublereal dGetM(void) const {
96  return m;
97  };
98 
99  // FIXME:
100  virtual const Vec3& GetS(void) const {
102  };
103 
104  // FIXME: ?
105  virtual const Mat3x3& GetJ(void) const {
107  };
108 
109  /* funzioni di servizio */
110 
111  /* Il metodo iGetNumDof() serve a ritornare il numero di gradi di liberta'
112  * propri che l'elemento definisce. Non e' virtuale in quanto serve a
113  * ritornare 0 per gli elementi che non possiedono gradi di liberta'.
114  * Viene usato nella costruzione dei DofOwner e quindi deve essere
115  * indipendente da essi. In genere non comporta overhead in quanto il
116  * numero di dof aggiunti da un tipo e' una costante e non richede dati
117  * propri.
118  * Il metodo pGetDofOwner() ritorna il puntatore al DofOwner dell'oggetto.
119  * E' usato da tutti quelli che agiscono direttamente sui DofOwner.
120  * Non e' virtuale in quanto ritorna NULL per tutti i tipi che non hanno
121  * dof propri.
122  * Il metodo GetDofType() ritorna, per ogni dof dell'elemento, l'ordine.
123  * E' usato per completare i singoli Dof relativi all'elemento.
124  */
125 
126  /* funzioni proprie */
127 
128  /* Dimensioni del workspace */
129  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
130  *piNumRows = 6;
131  *piNumCols = 3;
132  };
133 
134  /* assemblaggio jacobiano */
135  virtual VariableSubMatrixHandler&
137  doublereal dCoef,
138  const VectorHandler& XCurr,
139  const VectorHandler& XPrimeCurr);
140 
141  /* assemblaggio eig */
142  void AssMats(VariableSubMatrixHandler& WorkMatA,
143  VariableSubMatrixHandler& WorkMatB,
144  const VectorHandler& XCurr,
145  const VectorHandler& XPrimeCurr);
146 
147  /* assemblaggio residuo */
148  virtual SubVectorHandler&
149  AssRes(SubVectorHandler& WorkVec,
150  doublereal dCoef,
151  const VectorHandler& XCurr,
152  const VectorHandler& XPrimeCurr);
153 
154  /* output; si assume che ogni tipo di elemento sappia, attraverso
155  * l'OutputHandler, dove scrivere il proprio output */
156  void OutputPrepare(OutputHandler &OH);
157  virtual void Output(OutputHandler& OH) const;
158 
159  /* Setta i valori iniziali delle variabili (e fa altre cose)
160  * prima di iniziare l'integrazione */
161  virtual void SetValue(DataManager *pDM,
163  SimulationEntity::Hints *ph = 0);
164 
165  /* *******PER IL SOLUTORE PARALLELO******** */
166  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
167  * utile per l'assemblaggio della matrice di connessione fra i dofs */
168  virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
169  connectedNodes.resize(1);
170  connectedNodes[0] = pNode;
171  };
172  /* ************************************************ */
173 
174  /* Dati privati */
175  virtual unsigned int iGetNumPrivData(void) const;
176  virtual unsigned int iGetPrivDataIdx(const char *s) const;
177  virtual doublereal dGetPrivData(unsigned int i) const;
178 };
179 
180 /* AutomaticStructDispElem - end */
181 
182 /* AutomaticStructElem - begin */
183 
184 class AutomaticStructElem : virtual public Elem, public AutomaticStructDispElem {
185  friend class DynamicStructNode;
186 
187 protected:
190 
191  /* Accesso ai suoi dati */
192  virtual inline const Vec3& GetGCurr(void) const { return G; };
193  virtual inline const Vec3& GetGPCurr(void) const { return GP; };
194 
195  mutable Vec3 S;
196  mutable Mat3x3 J;
197 
198  virtual void ComputeAccelerations(Vec3& XPP, Vec3& WP) const;
199 
200 public:
202 
203  virtual ~AutomaticStructElem(void) {
204  NO_OP;
205  };
206 
207  /* inizializza i dati */
208  void Init(const Vec3& b, const Vec3& g, const Vec3& bp, const Vec3& gp);
209 
210  /* Scrive il contributo dell'elemento al file di restart */
211  virtual std::ostream& Restart(std::ostream& out) const;
212 
213  virtual void AddInertia(const doublereal& dm, const Vec3& dS,
214  const Mat3x3& dJ);
215 
216  virtual const Vec3& GetS(void) const {
217  return S;
218  };
219 
220  virtual const Mat3x3& GetJ(void) const {
221  return J;
222  };
223 
224  /* funzioni di servizio */
225 
226  /* Il metodo iGetNumDof() serve a ritornare il numero di gradi di liberta'
227  * propri che l'elemento definisce. Non e' virtuale in quanto serve a
228  * ritornare 0 per gli elementi che non possiedono gradi di liberta'.
229  * Viene usato nella costruzione dei DofOwner e quindi deve essere
230  * indipendente da essi. In genere non comporta overhead in quanto il
231  * numero di dof aggiunti da un tipo e' una costante e non richede dati
232  * propri.
233  * Il metodo pGetDofOwner() ritorna il puntatore al DofOwner dell'oggetto.
234  * E' usato da tutti quelli che agiscono direttamente sui DofOwner.
235  * Non e' virtuale in quanto ritorna NULL per tutti i tipi che non hanno
236  * dof propri.
237  * Il metodo GetDofType() ritorna, per ogni dof dell'elemento, l'ordine.
238  * E' usato per completare i singoli Dof relativi all'elemento.
239  */
240 
241  /* funzioni proprie */
242 
243  /* Dimensioni del workspace */
244  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
245  *piNumRows = 12;
246  *piNumCols = 6;
247  };
248 
249  /* assemblaggio jacobiano */
250  virtual VariableSubMatrixHandler&
252  doublereal dCoef,
253  const VectorHandler& XCurr,
254  const VectorHandler& XPrimeCurr);
255 
256  /* assemblaggio eig */
257  void AssMats(VariableSubMatrixHandler& WorkMatA,
258  VariableSubMatrixHandler& WorkMatB,
259  const VectorHandler& XCurr,
260  const VectorHandler& XPrimeCurr);
261 
262  /* assemblaggio residuo */
263  virtual SubVectorHandler&
264  AssRes(SubVectorHandler& WorkVec,
265  doublereal dCoef,
266  const VectorHandler& XCurr,
267  const VectorHandler& XPrimeCurr);
268 
269  /* output; si assume che ogni tipo di elemento sappia, attraverso
270  * l'OutputHandler, dove scrivere il proprio output */
271  void OutputPrepare(OutputHandler &OH);
272  virtual void Output(OutputHandler& OH) const;
273 
274  /* Setta i valori iniziali delle variabili (e fa altre cose)
275  * prima di iniziare l'integrazione */
276  virtual void SetValue(DataManager *pDM,
278  SimulationEntity::Hints *ph = 0);
279 
280  /* *******PER IL SOLUTORE PARALLELO******** */
281  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
282  * utile per l'assemblaggio della matrice di connessione fra i dofs */
283  virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
284  connectedNodes.resize(1);
285  connectedNodes[0] = pNode;
286  };
287  /* ************************************************ */
288 
289  /* Dati privati */
290  virtual unsigned int iGetNumPrivData(void) const;
291  virtual unsigned int iGetPrivDataIdx(const char *s) const;
292  virtual doublereal dGetPrivData(unsigned int i) const;
293 };
294 
295 /* AutomaticStructElem - end */
296 
297 #endif /* AUTOSTR_H */
298 
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: autostr.h:283
virtual void Output(OutputHandler &OH) const
Definition: autostr.cc:253
const Vec3 Zero3(0., 0., 0.)
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: autostr.cc:660
Definition: matvec3.h:98
virtual const Vec3 & GetGPCurr(void) const
Definition: autostr.h:57
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: autostr.cc:180
void Init(const Vec3 &b, const Vec3 &bp)
Definition: autostr.cc:69
virtual doublereal dGetPrivData(unsigned int i) const
Definition: autostr.cc:740
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: autostr.cc:296
virtual Elem::Type GetElemType(void) const
Definition: autostr.h:84
void OutputPrepare(OutputHandler &OH)
Definition: autostr.cc:231
#define NO_OP
Definition: myassert.h:74
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual doublereal dGetM(void) const
Definition: autostr.h:95
virtual void AddInertia(const doublereal &dm)
Definition: autostr.cc:62
virtual const Mat3x3 & GetJ(void) const
Definition: autostr.h:220
AutomaticStructDispElem(const DynamicStructDispNode *pN)
Definition: autostr.cc:42
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: autostr.cc:454
virtual void ComputeAccelerations(Vec3 &XPP) const
Definition: autostr.cc:51
virtual ~AutomaticStructDispElem(void)
Definition: autostr.h:73
const Mat3x3 Zero3x3(0., 0., 0., 0., 0., 0., 0., 0., 0.)
virtual void ComputeAccelerations(Vec3 &XPP, Vec3 &WP) const
Definition: autostr.cc:400
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: autostr.cc:279
void OutputPrepare(OutputHandler &OH)
Definition: autostr.cc:612
void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: autostr.cc:513
virtual const Vec3 & GetGCurr(void) const
Definition: autostr.h:55
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: autostr.cc:678
virtual unsigned int iGetNumPrivData(void) const
Definition: autostr.cc:290
virtual void AddInertia(const doublereal &dm, const Vec3 &dS, const Mat3x3 &dJ)
Definition: autostr.cc:418
virtual const Vec3 & GetBPCurr(void) const
Definition: autostr.h:56
virtual const Vec3 & GetGPCurr(void) const
Definition: autostr.h:193
virtual const Vec3 & GetS(void) const
Definition: autostr.h:216
virtual const Vec3 & GetBCurr(void) const
Definition: autostr.h:54
virtual const Vec3 & GetS(void) const
Definition: autostr.h:100
virtual const Vec3 & GetGCurr(void) const
Definition: autostr.h:192
virtual const Mat3x3 & GetJ(void) const
Definition: autostr.h:105
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: autostr.cc:555
DynamicStructDispNode * pNode
Definition: autostr.h:48
virtual std::ostream & Restart(std::ostream &out) const
Definition: autostr.cc:440
void Init(const Vec3 &b, const Vec3 &g, const Vec3 &bp, const Vec3 &gp)
Definition: autostr.cc:428
const doublereal dS
Definition: beamslider.cc:71
AutomaticStructElem(const DynamicStructNode *pN)
Definition: autostr.cc:389
Definition: elem.h:75
Type
Definition: elem.h:91
virtual unsigned int iGetNumPrivData(void) const
Definition: autostr.cc:672
virtual doublereal dGetPrivData(unsigned int i) const
Definition: autostr.cc:358
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: autostr.h:129
Vec3 XCurr
Definition: strnode.h:90
void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: autostr.cc:142
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: autostr.cc:90
virtual void Output(OutputHandler &OH) const
Definition: autostr.cc:634
double doublereal
Definition: colamd.c:52
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: autostr.h:244
long int integer
Definition: colamd.c:51
virtual std::ostream & Restart(std::ostream &out) const
Definition: autostr.cc:78
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: autostr.h:168
virtual ~AutomaticStructElem(void)
Definition: autostr.h:203