MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
jointreg.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/jointreg.h,v 1.12 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 /* Joint regularizations, Elem::Type JOINT_REGULARIZATION */
33 
34 #ifndef JOINTREG_H
35 #define JOINTREG_H
36 
37 #include <cfloat>
38 
39 #include "joint.h"
40 
41 /* JointRegularization - begin */
42 
44 : virtual public Elem, public InitialAssemblyElem
45 {
46 protected:
47  const Joint *pJ;
48 
49 public:
50  /* JointRegularization types */
51  enum Type {
52  UNKNOWN = -1,
53 
57 
59  };
60 
61 public:
62  JointRegularization(unsigned int uL, const Joint *j, flag fOut);
63  virtual ~JointRegularization(void);
64 
65  /* Tipo dell'elemento (usato solo per debug ecc.) */
66  virtual Elem::Type GetElemType(void) const {
68  };
69 
70  /* Tipo di joint regularization */
72  GetJointRegularizationType(void) const = 0;
73 
74  /* Contributo al file di restart */
75  virtual std::ostream& Restart(std::ostream& out) const {
76  return out << " joint regularization: " << GetLabel();
77  };
78 
79  virtual unsigned int iGetInitialNumDof(void) const;
80 };
81 
82 /* JointRegularization - end */
83 
84 
85 /* TikhonovRegularization - begin */
86 
88 : virtual public Elem, public JointRegularization
89 {
90 protected:
91  std::vector<doublereal> dC;
92 
93 public:
94  TikhonovRegularization(unsigned int uL,
95  const Joint *j,
96  const std::vector<doublereal>& c,
97  flag fOut);
98  virtual ~TikhonovRegularization(void);
99 
101  GetJointRegularizationType(void) const;
102 
103  virtual void
104  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
105 
106  /* assemblaggio residuo */
107  virtual SubVectorHandler&
108  AssRes(SubVectorHandler& WorkVec,
109  doublereal dCoef,
110  const VectorHandler& XCurr,
111  const VectorHandler& XPrimeCurr);
112 
113  /* assemblaggio jacobiano */
114  virtual VariableSubMatrixHandler&
116  doublereal dCoef,
117  const VectorHandler& XCurr,
118  const VectorHandler& XPrimeCurr);
119 
120  /* inverse dynamics capable element */
121  virtual bool bInverseDynamics(void) const;
122 
123  /* Inverse Dynamics Jacobian matrix assembly */
126  const VectorHandler& XCurr);
127 
128  virtual void
129  InitialWorkSpaceDim(integer* piNumRows,
130  integer* piNumCols) const;
131  virtual VariableSubMatrixHandler&
133  const VectorHandler& XCurr);
134  virtual SubVectorHandler&
136  const VectorHandler& XCurr);
137 };
138 
139 /* TikhonovRegularization - end */
140 
141 
142 /* DynamicRegularization - begin */
143 
145 : virtual public Elem, public JointRegularization
146 {
147 protected:
148  std::vector<doublereal> dC;
149  std::vector<doublereal> dLambda;
150 
151 public:
152  DynamicRegularization(unsigned int uL,
153  const Joint *j,
154  const std::vector<doublereal>& c,
155  flag fOut);
156  virtual ~DynamicRegularization(void);
157 
159  GetJointRegularizationType(void) const;
160 
161  virtual void
162  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
163 
164  virtual void
166  const VectorHandler& XP);
167 
168  /* assemblaggio residuo */
169  virtual SubVectorHandler&
170  AssRes(SubVectorHandler& WorkVec,
171  doublereal dCoef,
172  const VectorHandler& XCurr,
173  const VectorHandler& XPrimeCurr);
174 
175  /* assemblaggio jacobiano */
176  virtual VariableSubMatrixHandler&
178  doublereal dCoef,
179  const VectorHandler& XCurr,
180  const VectorHandler& XPrimeCurr);
181 
182  virtual void
183  InitialWorkSpaceDim(integer* piNumRows,
184  integer* piNumCols) const;
185  virtual VariableSubMatrixHandler&
187  const VectorHandler& XCurr);
188  virtual SubVectorHandler&
190  const VectorHandler& XCurr);
191 };
192 
193 /* DynamicRegularization - end */
194 
195 /* JacobianRegularization - begin */
196 
198 : virtual public Elem, public JointRegularization
199 {
200 protected:
201  std::vector<doublereal> dC;
202 
203 public:
204  JacobianRegularization(unsigned int uL,
205  const Joint *j,
206  const std::vector<doublereal>& c,
207  flag fOut);
208  virtual ~JacobianRegularization(void);
209 
211  GetJointRegularizationType(void) const;
212 
213  virtual void
214  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const;
215 
216  /* assemblaggio residuo */
217  virtual SubVectorHandler&
218  AssRes(SubVectorHandler& WorkVec,
219  doublereal dCoef,
220  const VectorHandler& XCurr,
221  const VectorHandler& XPrimeCurr);
222 
223  /* assemblaggio jacobiano */
224  virtual VariableSubMatrixHandler&
226  doublereal dCoef,
227  const VectorHandler& XCurr,
228  const VectorHandler& XPrimeCurr);
229 
230  virtual void
231  InitialWorkSpaceDim(integer* piNumRows,
232  integer* piNumCols) const;
233  virtual VariableSubMatrixHandler&
235  const VectorHandler& XCurr);
236  virtual SubVectorHandler&
238  const VectorHandler& XCurr);
239 };
240 
241 /* JacobianRegularization - end */
242 
243 /* Lettura joint regularizations */
244 class DataManager;
245 class MBDynParser;
246 
247 extern Elem *
249  MBDynParser& HP,
250  unsigned int uLabel);
251 
252 #endif // JOINTREG_H
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: jointreg.cc:416
long int flag
Definition: mbdyn.h:43
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: jointreg.cc:317
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: jointreg.cc:408
virtual ~DynamicRegularization(void)
Definition: jointreg.cc:236
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: jointreg.cc:345
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: jointreg.cc:465
std::vector< doublereal > dC
Definition: jointreg.h:91
JacobianRegularization(unsigned int uL, const Joint *j, const std::vector< doublereal > &c, flag fOut)
Definition: jointreg.cc:384
std::vector< doublereal > dLambda
Definition: jointreg.h:149
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: jointreg.cc:163
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: jointreg.cc:437
virtual ~TikhonovRegularization(void)
Definition: jointreg.cc:79
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: jointreg.cc:192
virtual bool bInverseDynamics(void) const
Definition: jointreg.cc:142
TikhonovRegularization(unsigned int uL, const Joint *j, const std::vector< doublereal > &c, flag fOut)
Definition: jointreg.cc:68
virtual ~JacobianRegularization(void)
Definition: jointreg.cc:395
virtual JointRegularization::Type GetJointRegularizationType(void) const
Definition: jointreg.cc:242
DataManager * pDM
Definition: mbpar.h:252
DynamicRegularization(unsigned int uL, const Joint *j, const std::vector< doublereal > &c, flag fOut)
Definition: jointreg.cc:224
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: jointreg.cc:120
Elem * ReadJointRegularization(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: jointreg.cc:527
virtual JointRegularization::Type GetJointRegularizationType(void) const =0
const Joint * pJ
Definition: jointreg.h:47
virtual JointRegularization::Type GetJointRegularizationType(void) const
Definition: jointreg.cc:401
std::vector< doublereal > dC
Definition: jointreg.h:201
JointRegularization(unsigned int uL, const Joint *j, flag fOut)
Definition: jointreg.cc:42
static std::stack< cleanup * > c
Definition: cleanup.cc:59
Definition: elem.h:75
Type
Definition: elem.h:91
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: jointreg.cc:255
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: jointreg.cc:156
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: jointreg.cc:100
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: jointreg.cc:289
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: jointreg.cc:92
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: jointreg.cc:494
Definition: joint.h:50
virtual std::ostream & Restart(std::ostream &out) const
Definition: jointreg.h:75
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: jointreg.cc:248
virtual ~JointRegularization(void)
Definition: jointreg.cc:52
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual JointRegularization::Type GetJointRegularizationType(void) const
Definition: jointreg.cc:85
unsigned int GetLabel(void) const
Definition: withlab.cc:62
virtual unsigned int iGetInitialNumDof(void) const
Definition: jointreg.cc:58
virtual Elem::Type GetElemType(void) const
Definition: jointreg.h:66
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: jointreg.cc:458
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: jointreg.cc:267
std::vector< doublereal > dC
Definition: jointreg.h:148
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: jointreg.cc:310