MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
joint.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/joint.h,v 1.59 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 /* vincoli, tipo: Elem::Type JOINT */
33 
34 #ifndef JOINT_H
35 #define JOINT_H
36 
37 /* include per derivazione della classe */
38 
39 #include <cfloat>
40 
41 #include "strnode.h"
42 #include "elem.h"
43 #include "gravity.h"
44 #include "hint_impl.h"
45 
46 extern const char* psJointNames[];
47 
48 /* Joint - begin */
49 
50 class Joint
51 : virtual public Elem, public ElemGravityOwner,
52  public ElemWithDofs, public InitialAssemblyElem
53 {
54 protected:
55 #ifdef USE_NETCDF
56  NcVar *Var_F_local;
57  NcVar *Var_M_local;
58  NcVar *Var_F_global;
59  NcVar *Var_M_global;
60 #endif // USE_NETCDF
61 
62  virtual void OutputPrepare_int(const std::string& type, OutputHandler &OH, std::string& name);
63 
64 public:
65  /* Tipi di Joint */
66  enum Type {
67  UNKNOWN = -1,
68 
69  DISTANCE = 0,
73  PIN,
86  ROD,
113 
116 
118  };
119 
120 public:
121  struct JointHint : public Hint {
122  virtual ~JointHint(void) {};
123  };
124 
125  template <int i>
126  struct OffsetHint : public Joint::JointHint {};
127 
128  template <int i>
129  struct HingeHint : public Joint::JointHint {};
130  template <int i>
131  struct PositionHingeHint : public Joint::HingeHint<i> {};
132  template <int i>
133  struct OrientationHingeHint : public Joint::HingeHint<i> {};
134 
135  template <class T>
140  if (pTDH) {
141  delete pTDH;
142  }
143  };
144  };
145  template <class T>
148  };
149  template <class T>
152  };
153  template <class T>
156  };
157  template <class T>
160  };
161  template <class T>
164  };
165  template <class T>
168  };
169 
170  struct ReactionsHint : public Joint::JointHint {};
171  struct ForcesHint : public Joint::ReactionsHint {};
172  struct MomentsHint : public Joint::ReactionsHint {};
173 
174 public:
175  class ErrGeneric : public MBDynErrBase {
176  public:
178  };
179 
180 public:
181  Joint(unsigned int uL, const DofOwner* pD, flag fOut);
182  virtual ~Joint(void);
183 
184  /* Derivate da Elem */
185 
186  /* Tipo dell'elemento (usato solo per debug ecc.) */
187  virtual Elem::Type GetElemType(void) const {
188  return Elem::JOINT;
189  };
190 
191  /* Tipo di joint */
192  virtual Joint::Type GetJointType(void) const = 0;
193 
194  /* Contributo al file di restart */
195  virtual std::ostream& Restart(std::ostream& out) const {
196  return out << " joint: " << GetLabel();
197  };
198 
199  /* Output specifico dei vincoli */
200  std::ostream&
201  Output(std::ostream& out, const char* sJointName,
202  unsigned int uLabel,
203  const Vec3& FLocal, const Vec3& MLocal,
204  const Vec3& FGlobal, const Vec3& MGlobal) const;
205 
206  /* Derivate da ElemWith Dofs */
207 
208  /* Setta il valore iniziale delle proprie variabili */
209  virtual void SetInitialValue(VectorHandler& /* X */ ) {
210  NO_OP;
211  };
212 
213  virtual void SetValue(DataManager *pDM,
214  VectorHandler& /* X */ , VectorHandler& /* Xp */ ,
215  SimulationEntity::Hints *ph = 0)
216  {
217  NO_OP;
218  };
219 
220  // inverse dynamics
221  /* inverse dynamics update */
223 
224  bool bIsPrescribedMotion(void) const;
225  bool bIsTorque(void) const;
226  // end of inverse dynamics
227 
228  /* per la lettura dei dati dell'elemento modale */
229 
230  friend Joint *
231  ReadModal(DataManager* pDM,MBDynParser& HP, const DofOwner* pD0,
232  unsigned int uLabel, const StructNode* pModalNode);
233 };
234 
235 /* Joint - end */
236 
237 
238 /* Lettura Joints */
239 class DataManager;
240 class MBDynParser;
241 
242 extern Elem* ReadJoint(DataManager* pDM,
243  MBDynParser& HP,
244  const DofOwner* pDO,
245  unsigned int uLabel);
246 
247 #endif // JOINT_H
Definition: hint.h:38
Type
Definition: joint.h:66
long int flag
Definition: mbdyn.h:43
Definition: matvec3.h:98
#define MBDYN_EXCEPT_ARGS_PASSTHRU
Definition: except.h:55
TplDriveHint< T > * pTDH
Definition: joint.h:137
const char * psJointNames[]
Definition: enums.cc:163
virtual void SetInitialValue(VectorHandler &)
Definition: joint.h:209
virtual Joint::Type GetJointType(void) const =0
Joint(unsigned int uL, const DofOwner *pD, flag fOut)
Definition: joint.cc:83
OrientationDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:159
#define MBDYN_EXCEPT_ARGS_DECL
Definition: except.h:43
#define NO_OP
Definition: myassert.h:74
std::vector< Hint * > Hints
Definition: simentity.h:89
friend Joint * ReadModal(DataManager *pDM, MBDynParser &HP, const DofOwner *pD0, unsigned int uLabel, const StructNode *pModalNode)
AngularAccelerationDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:167
JointDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:138
bool bIsPrescribedMotion(void) const
Definition: joint.cc:170
~JointDriveHint(void)
Definition: joint.h:139
PositionDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:147
DataManager * pDM
Definition: mbpar.h:252
Elem * ReadJoint(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: joint.cc:187
VelocityDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:151
ErrGeneric(MBDYN_EXCEPT_ARGS_DECL)
Definition: joint.h:177
virtual void SetValue(DataManager *pDM, VectorHandler &, VectorHandler &, SimulationEntity::Hints *ph=0)
Definition: joint.h:213
unsigned int uLabel
Definition: withlab.h:44
virtual std::ostream & Restart(std::ostream &out) const
Definition: joint.h:195
virtual void OutputPrepare_int(const std::string &type, OutputHandler &OH, std::string &name)
Definition: joint.cc:107
AngularVelocityDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:163
AccelerationDriveHint(TplDriveHint< T > *pTDH)
Definition: joint.h:155
Definition: elem.h:75
bool bIsTorque(void) const
Definition: joint.cc:176
Type
Definition: elem.h:91
virtual Elem::Type GetElemType(void) const
Definition: joint.h:187
virtual ~JointHint(void)
Definition: joint.h:122
virtual ~Joint(void)
Definition: joint.cc:100
Definition: joint.h:50
virtual void Update(const VectorHandler &XCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
Definition: joint.cc:163
std::ostream & Output(std::ostream &out, const char *sJointName, unsigned int uLabel, const Vec3 &FLocal, const Vec3 &MLocal, const Vec3 &FGlobal, const Vec3 &MGlobal) const
Definition: joint.cc:138
unsigned int GetLabel(void) const
Definition: withlab.cc:62