MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
distance.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/distance.h,v 1.30 2017/05/12 17:29:26 morandini 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 generali */
33 
34 
35 #ifndef DISTANCE_H
36 #define DISTANCE_H
37 
38 #ifdef MBDYN_X_DISTANCE_JOINT
39 
40 #include <joint.h>
41 #include <drive.h>
42 
43 /* DistanceJoint - begin */
44 
45 class DistanceJoint : virtual public Elem, public Joint, public DriveOwner {
46 protected:
47  const StructDispNode *pNode1;
48  const StructDispNode *pNode2;
49  Vec3 Vec;
51  doublereal dDistance;
52 
53  void Abort(void);
54 
55  /*
56  * Assembla le due matrici
57  *
58  * A = dF/dx e B = dCoef * dF/dxp
59  */
60  virtual void
61  AssMat(FullSubMatrixHandler& WorkMatA,
62  FullSubMatrixHandler& WorkMatB,
63  doublereal dCoef,
64  const VectorHandler& XCurr,
65  const VectorHandler& XPrimeCurr);
66 
67 public:
68  /* Costruttore non banale */
69  DistanceJoint(unsigned int uL, const DofOwner* pDO,
70  const StructDispNode* pN1, const StructDispNode* pN2,
71  const DriveCaller* pDC, flag fOut);
72 
73  ~DistanceJoint(void);
74 
75  /* Tipo di Joint */
76  virtual Joint::Type GetJointType(void) const {
77  return Joint::DISTANCE;
78  };
79 
80  /* Contributo al file di restart */
81  virtual std::ostream& Restart(std::ostream& out) const;
82 
83  virtual unsigned int iGetNumDof(void) const {
84  return 1;
85  };
86 
87  virtual DofOrder::Order GetDofType(unsigned int i) const {
88  ASSERT(i == 0);
89  return DofOrder::ALGEBRAIC;
90  };
91 
92  virtual DofOrder::Order GetEqType(unsigned int i) const {
93  ASSERT(i == 0);
94  return DofOrder::ALGEBRAIC;
95  };
96 
97  virtual void
98  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
99  *piNumRows = 7;
100  *piNumCols = 7;
101  };
102 
103  virtual VariableSubMatrixHandler&
105  doublereal dCoef,
106  const VectorHandler& XCurr,
107  const VectorHandler& XPrimeCurr);
108 
109  virtual void
111  VariableSubMatrixHandler& WorkMatB,
112  const VectorHandler& XCurr,
113  const VectorHandler& XPrimeCurr);
114 
115  virtual SubVectorHandler&
116  AssRes(SubVectorHandler& WorkVec,
117  doublereal dCoef,
118  const VectorHandler& XCurr,
119  const VectorHandler& XPrimeCurr);
120 
121  virtual void Output(OutputHandler& OH) const;
122 
123  /* funzioni usate nell'assemblaggio iniziale */
124 
125  virtual unsigned int iGetInitialNumDof(void) const {
126  return 2;
127  };
128 
129  virtual void
130  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
131  *piNumRows = 14;
132  *piNumCols = 14;
133  };
134 
135  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
136  virtual VariableSubMatrixHandler&
138  const VectorHandler& XCurr);
139 
140  /* Contributo al residuo durante l'assemblaggio iniziale */
141  virtual SubVectorHandler&
143  const VectorHandler& XCurr);
144 
145  virtual void SetValue(DataManager *pDM,
147  SimulationEntity::Hints *ph = 0);
148 
149  /* Dati privati */
150  virtual unsigned int iGetNumPrivData(void) const;
151  virtual unsigned int iGetPrivDataIdx(const char *s) const;
152  virtual doublereal dGetPrivData(unsigned int i) const;
153 
154  /* *******PER IL SOLUTORE PARALLELO******** */
155  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
156  * utile per l'assemblaggio della matrice di connessione fra i dofs */
157  virtual void
158  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
159  connectedNodes.resize(2);
160  connectedNodes[0] = pNode1;
161  connectedNodes[1] = pNode2;
162  };
163  /* ************************************************ */
164 
165 };
166 
167 /* DistanceJoint - end */
168 
169 
170 /* DistanceJointWithOffset - begin */
171 
173 virtual public Elem, public DistanceJoint {
174 private:
175  Vec3 f1;
176  Vec3 f2;
177 
178  /*
179  * Assembla le due matrici
180  *
181  * A = dF/dx e B = dCoef * dF/dxp
182  */
183  virtual void
184  AssMat(FullSubMatrixHandler& WorkMatA,
185  FullSubMatrixHandler& WorkMatB,
186  doublereal dCoef,
187  const VectorHandler& XCurr,
188  const VectorHandler& XPrimeCurr);
189 
190 public:
191  /* Costruttore non banale */
192  DistanceJointWithOffset(unsigned int uL, const DofOwner* pDO,
193  const StructNode* pN1, const StructNode* pN2,
194  const Vec3& f1Tmp, const Vec3& f2Tmp,
195  const DriveCaller* pDC, flag fOut);
196 
198 
199  /* Tipo di Joint */
200  virtual Joint::Type GetJointType(void) const {
202  };
203 
204  /* Contributo al file di restart */
205  virtual std::ostream& Restart(std::ostream& out) const;
206 
207  virtual void
208  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
209  *piNumRows = 13;
210  *piNumCols = 13;
211  };
212 
213  virtual VariableSubMatrixHandler&
215  doublereal dCoef,
216  const VectorHandler& XCurr,
217  const VectorHandler& XPrimeCurr);
218 
219  virtual void
221  VariableSubMatrixHandler& WorkMatB,
222  const VectorHandler& XCurr,
223  const VectorHandler& XPrimeCurr);
224 
225  virtual SubVectorHandler&
226  AssRes(SubVectorHandler& WorkVec,
227  doublereal dCoef,
228  const VectorHandler& XCurr,
229  const VectorHandler& XPrimeCurr);
230 
231  /* funzioni usate nell'assemblaggio iniziale */
232 
233  virtual void
234  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
235  *piNumRows = 26;
236  *piNumCols = 26;
237  };
238 
239  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
240  virtual VariableSubMatrixHandler&
242  const VectorHandler& XCurr);
243 
244  /* Contributo al residuo durante l'assemblaggio iniziale */
245  virtual SubVectorHandler&
247  const VectorHandler& XCurr);
248 
249  virtual void SetValue(DataManager *pDM,
251  SimulationEntity::Hints *ph = 0);
252 
253 };
254 
255 /* DistanceJointWithOffset - end */
256 
257 #endif
258 
259 #endif /* DISTANCE_H */
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: genj.cc:111
Type
Definition: joint.h:66
virtual void Output(OutputHandler &OH) const
Definition: genj.cc:268
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: genj.cc:1046
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: genj.cc:796
SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: genj.cc:202
long int flag
Definition: mbdyn.h:43
virtual std::ostream & Restart(std::ostream &out) const
Definition: genj.cc:669
Definition: matvec3.h:98
virtual doublereal dGetPrivData(unsigned int i) const
Definition: genj.cc:88
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: genj.cc:76
virtual std::ostream & Restart(std::ostream &out) const
Definition: genj.cc:100
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: genj.cc:547
~DistanceJoint(void)
Definition: genj.cc:62
virtual DofOrder::Order GetEqType(unsigned int i) const
Definition: genj.h:76
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genj.h:81
virtual Joint::Type GetJointType(void) const
Definition: genj.h:60
doublereal dAlpha
Definition: genj.h:49
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genj.h:201
virtual unsigned int iGetInitialNumDof(void) const
Definition: genj.h:98
DistanceJointWithOffset(unsigned int uL, const DofOwner *pDO, const StructNode *pN1, const StructNode *pN2, const Vec3 &f1Tmp, const Vec3 &f2Tmp, const DriveCaller *pDC, flag fOut)
Definition: genj.cc:608
const StructDispNode * pNode1
Definition: genj.h:46
SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: genj.cc:447
virtual unsigned int iGetNumDof(void) const
Definition: genj.h:67
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
Definition: genj.cc:1151
VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: genj.cc:878
~DistanceJointWithOffset(void)
Definition: genj.cc:631
#define ASSERT(expression)
Definition: colamd.c:977
DistanceJoint(unsigned int uL, const DofOwner *pDO, const StructDispNode *pN1, const StructDispNode *pN2, const DriveCaller *pDC, flag fOut)
Definition: genj.cc:49
virtual Joint::Type GetJointType(void) const
Definition: genj.h:159
const StructDispNode * pNode2
Definition: genj.h:47
VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: genj.cc:290
Definition: elem.h:75
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genj.h:181
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: elem.cc:55
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: genj.h:99
virtual DofOrder::Order GetDofType(unsigned int i) const
Definition: genj.h:70
Definition: joint.h:50
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: genj.h:125
VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: genj.cc:684
virtual unsigned int iGetNumPrivData(void) const
Definition: genj.cc:70