MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
force.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/force.h,v 1.34 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 /* Forza */
33 
34 #ifndef FORCE_H
35 #define FORCE_H
36 
37 #include "elem.h"
38 #include "drive.h"
39 #include "strnode.h"
40 
41 extern const char* psForceNames[];
42 
43 
44 /* Force - begin */
45 
46 class Force
47 : virtual public Elem, public InitialAssemblyElem {
48 public:
49  /* Tipi di Force */
50  enum Type {
51  UNKNOWN = -1,
54 
55  // in mbdyn/struct/strforce[_impl].{h,cc}
58 
63 
68 
69  // in mbdyn/struct/totalj.{h,cc}
72 
73  // in mbdyn/struct/strext.{h,cc}
75 
76  // in mbdyn/struct/modalforce.{h,cc}
78 
79  // in mbdyn/struct/modalext.{h,cc}
81 
83  };
84 
85 public:
86  /* Costruttore banale */
87  Force(unsigned int uL, flag fOut)
88  : Elem(uL, fOut),
89  InitialAssemblyElem(uL, fOut)
90  {
91  NO_OP;
92  };
93 
94  virtual ~Force(void) {
95  NO_OP;
96  };
97 
98  /* Tipo dell'elemento (usato per debug ecc.) */
99  virtual Elem::Type GetElemType(void) const {
100  return Elem::FORCE;
101  };
102 
103  /* Tipo di forza */
104  virtual Force::Type GetForceType(void) const = 0;
105 
106  virtual VariableSubMatrixHandler&
108  doublereal /* dCoef */ ,
109  const VectorHandler& /* XCurr */ ,
110  const VectorHandler& /* XPrimeCurr */ )
111  {
112  DEBUGCOUT("Entering Force::AssJac()" << std::endl);
113 
114  WorkMat.SetNullMatrix();
115  return WorkMat;
116  };
117 
118  virtual std::ostream& Restart(std::ostream& out) const;
119 
120  virtual unsigned int iGetInitialNumDof(void) const {
121  return 0;
122  };
123 
124  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
125  virtual VariableSubMatrixHandler&
127  const VectorHandler& /* XCurr */ )
128  {
129  WorkMat.SetNullMatrix();
130  return WorkMat;
131  };
132 };
133 
134 /* Force - end */
135 
136 
137 /* AbstractForce - begin */
138 
139 class AbstractForce : virtual public Elem, public Force, public DriveOwner {
140 protected:
141  const Node* pNode;
142 
143 public:
144  /* Costruttore banale */
145  AbstractForce(unsigned int uL, const Node* pN,
146  const DriveCaller* pDC, flag fOut);
147 
148  virtual ~AbstractForce(void);
149 
150  /* Tipo di forza */
151  virtual Force::Type GetForceType(void) const {
152  return Force::ABSTRACTFORCE;
153  };
154 
155  /* Contributo al file di restart */
156  virtual std::ostream& Restart(std::ostream& out) const;
157 
158  void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
159  *piNumRows = 1;
160  *piNumCols = 1;
161  };
162 
163  /* Contributo al residuo */
165  doublereal dCoef,
166  const VectorHandler& XCurr,
167  const VectorHandler& XPrimeCurr);
168 
169  virtual void Output(OutputHandler& OH) const;
170 
171  virtual void
172  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const
173  {
174  *piNumRows = 1;
175  *piNumCols = 1;
176  };
177 
178  /* Contributo al residuo nell'assemblaggio iniziale */
180  InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
181 
182  /* *******PER IL SOLUTORE PARALLELO******** */
183  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
184  * utile per l'assemblaggio della matrice di connessione fra i dofs */
185  virtual void
186  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
187  connectedNodes.resize(1);
188  connectedNodes[0] = pNode;
189  };
190  /* ************************************************ */
191 };
192 
193 /* AbstractForce - end */
194 
195 
196 /* AbstractInternalForce - begin */
197 
198 class AbstractInternalForce : virtual public Elem, public Force, public DriveOwner {
199 protected:
200  const Node* pNode1;
201  const Node* pNode2;
202 
203 public:
204  /* Costruttore banale */
205  AbstractInternalForce(unsigned int uL, const Node* pN1, const Node* pN2,
206  const DriveCaller* pDC, flag fOut);
207 
208  virtual ~AbstractInternalForce(void);
209 
210  /* Tipo di forza */
211  virtual Force::Type GetForceType(void) const {
213  };
214 
215  /* Contributo al file di restart */
216  virtual std::ostream& Restart(std::ostream& out) const;
217 
218  void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
219  *piNumRows = 2;
220  *piNumCols = 2;
221  };
222 
223  /* Contributo al residuo */
225  AssRes(SubVectorHandler& WorkVec,
226  doublereal dCoef,
227  const VectorHandler& XCurr,
228  const VectorHandler& XPrimeCurr);
229 
230  virtual void Output(OutputHandler& OH) const;
231 
232  virtual void
233  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const
234  {
235  *piNumRows = 2;
236  *piNumCols = 2;
237  };
238 
239  /* Contributo al residuo nell'assemblaggio iniziale */
241  InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
242 
243  /* *******PER IL SOLUTORE PARALLELO******** */
244  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
245  * utile per l'assemblaggio della matrice di connessione fra i dofs */
246  virtual void
247  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
248  connectedNodes.resize(2);
249  connectedNodes[0] = pNode1;
250  connectedNodes[1] = pNode2;
251  };
252  /* ************************************************ */
253 };
254 
255 /* AbstractInternalForce - end */
256 
257 extern Elem*
258 ReadForce(DataManager* pDM,
259  MBDynParser& HP,
260  unsigned int uLabel,
261  bool);
262 
263 #endif /* FORCE_H */
264 
virtual unsigned int iGetInitialNumDof(void) const
Definition: force.h:120
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: force.h:247
const char * psForceNames[]
Definition: enums.cc:256
long int flag
Definition: mbdyn.h:43
AbstractInternalForce(unsigned int uL, const Node *pN1, const Node *pN2, const DriveCaller *pDC, flag fOut)
Definition: force.cc:148
Definition: node.h:67
Type
Definition: force.h:50
virtual Force::Type GetForceType(void) const
Definition: force.h:151
virtual void Output(OutputHandler &OH) const
Definition: force.cc:117
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal, const VectorHandler &, const VectorHandler &)
Definition: force.h:107
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: force.h:172
Force(unsigned int uL, flag fOut)
Definition: force.h:87
Definition: force.h:46
Elem * ReadForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, bool)
Definition: force.cc:246
virtual std::ostream & Restart(std::ostream &out) const
Definition: force.cc:52
#define NO_OP
Definition: myassert.h:74
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: force.h:186
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &)
Definition: force.h:126
const Node * pNode2
Definition: force.h:201
virtual void Output(OutputHandler &OH) const
Definition: force.cc:214
virtual ~AbstractForce(void)
Definition: force.cc:74
virtual std::ostream & Restart(std::ostream &out) const
Definition: force.cc:176
virtual Force::Type GetForceType(void) const =0
virtual std::ostream & Restart(std::ostream &out) const
Definition: force.cc:84
void SetNullMatrix(void)
Definition: submat.h:1159
#define DEBUGCOUT(msg)
Definition: myassert.h:232
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: force.cc:133
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: force.h:158
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: force.h:233
virtual ~AbstractInternalForce(void)
Definition: force.cc:159
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: force.cc:189
Definition: elem.h:75
const Node * pNode1
Definition: force.h:200
Type
Definition: elem.h:91
virtual Force::Type GetForceType(void) const
Definition: force.h:211
virtual ~Force(void)
Definition: force.h:94
AbstractForce(unsigned int uL, const Node *pN, const DriveCaller *pDC, flag fOut)
Definition: force.cc:64
double doublereal
Definition: colamd.c:52
const Node * pNode
Definition: force.h:141
long int integer
Definition: colamd.c:51
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: force.cc:95
void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: force.h:218
virtual Elem::Type GetElemType(void) const
Definition: force.h:99
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: force.cc:232