MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
elem.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/elem.cc,v 1.46 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 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
33 
34 #include "dataman.h"
35 #include "elem.h"
36 #include "gravity.h"
37 #include "aerodyn.h"
38 
39 /* Elem - begin */
40 
41 Elem::Elem(unsigned int uL, flag fOut)
42 : WithLabel(uL), ToBeOutput(fOut),
43 m_uInverseDynamicsFlags(InverseDynamics::ERGONOMY|InverseDynamics::RIGHT_HAND_SIDE)
44 {
45  NO_OP;
46 }
47 
49 {
50  NO_OP;
51 }
52 
53 /* assemblaggio matrici per autovalori */
54 void
56  VariableSubMatrixHandler& /* WorkMatB */ ,
57  const VectorHandler& /* XCurr */ ,
58  const VectorHandler& /* XPrimeCurr */ )
59 {
60  silent_cerr(psElemNames[GetElemType()] << "(" << GetLabel() << "): "
61  "AssMats() not implemented yet" << std::endl);
62 }
63 
64 bool
66 {
67  return false;
68 }
69 
70 void
72 {
74 }
75 
76 unsigned
78 {
80 }
81 
82 bool
83 Elem::bIsErgonomy(void) const
84 {
86 }
87 
88 bool
90 {
92 }
93 
94 /* inverse dynamics Jacobian matrix assembly */
97  const VectorHandler& XCurr)
98 {
99  silent_cerr(psElemNames[GetElemType()] << "(" << GetLabel() << "): "
100  "Elem::AssJac() for inverse dynamics not implemented yet" << std::endl);
101  return WorkMat;
102 };
103 
104 /* inverse dynamics residual assembly */
107  const VectorHandler& XCurr,
108  const VectorHandler& XPrimeCurr,
109  const VectorHandler& XPrimePrimeCurr,
110  InverseDynamics::Order iOrder)
111 {
112  silent_cerr(psElemNames[GetElemType()] << "(" << GetLabel() << "): "
113  "Elem::AssRes(" << invdyn2str(iOrder) << ") for inverse dynamics not implemented yet" << std::endl);
114  return WorkVec;
115 };
116 
117 unsigned int
118 Elem::iGetNumDof(void) const
119 {
120  return 0;
121 }
122 
123 std::ostream&
124 Elem::DescribeDof(std::ostream& out, const char *prefix, bool bInitial) const
125 {
126  return out;
127 }
128 
129 void
130 Elem::DescribeDof(std::vector<std::string>& desc, bool bInitial, int i) const
131 {
132  ASSERT(i <= 0);
133  desc.resize(0);
134 }
135 
136 std::ostream&
137 Elem::DescribeEq(std::ostream& out, const char *prefix, bool bInitial) const
138 {
139  return out;
140 }
141 
142 void
143 Elem::DescribeEq(std::vector<std::string>& desc, bool bInitial, int i) const
144 {
145  ASSERT(i <= 0);
146  desc.resize(0);
147 }
148 
150 Elem::GetDofType(unsigned int) const
151 {
152  silent_cerr(psElemNames[GetElemType()] << "(" << GetLabel() << "): "
153  "GetDofType() is undefined because element "
154  "has no degrees of freedom" << std::endl);
156 }
157 
159 str2elemtype(const char *const s)
160 {
161  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
162  if (strcasecmp(s, psReadElemsElems[i]) == 0) {
163  return Elem::Type(i);
164  }
165  }
166 
167  return Elem::UNKNOWN;
168 }
169 
170 /* Elem - end */
171 
172 /* database of registered element types */
173 typedef std::map<std::string, ElemRead *, ltstrcase> ElemFuncMapType;
175 
176 /* element parsing checkers */
178  /*
179  * returns true if the string "s" is recognized as an element type
180  * hijacks the database of registered element types for consistency
181  */
182  bool IsWord(const std::string& s) const {
183  return ElemFuncMap.find(std::string(s)) != ElemFuncMap.end();
184  };
185 };
186 
188 
189 /* element type registration functions: call to register one */
190 bool
191 SetElem(const char *name, ElemRead *rf)
192 {
193  pedantic_cout("registering element \"" << name << "\""
194  << std::endl );
195  return ElemFuncMap.insert(ElemFuncMapType::value_type(name, rf)).second;
196 }
197 
198 /* ElemWithDofs - begin */
199 
201  const DofOwner* pDO, flag fOut)
202 : Elem(uL, fOut), DofOwnerOwner(const_cast<DofOwner *>(pDO))
203 {
204  NO_OP;
205 }
206 
208 {
209  NO_OP;
210 }
211 
212 /* ElemWithDofs - end */
213 
214 
215 /* SubjectToInitialAssembly - begin */
216 
218 {
219  NO_OP;
220 }
221 
222 
224 {
225  NO_OP;
226 }
227 
228 /* SubjectToInitialAssembly - end */
229 
230 
231 /* InitialAssemblyElem - begin */
232 
234 : Elem(uL, fOut)
235 {
236  NO_OP;
237 }
238 
240 {
241  NO_OP;
242 }
243 
244 /* InitialAssemblyElem - end */
virtual bool bInverseDynamics(void) const
Definition: elem.cc:65
ElemWithDofs(unsigned int uL, const DofOwner *pDO, flag fOut)
Definition: elem.cc:200
long int flag
Definition: mbdyn.h:43
Elem::Type str2elemtype(const char *const s)
Definition: elem.cc:159
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bIsErgonomy(void) const
Definition: elem.cc:83
virtual ~InitialAssemblyElem(void)
Definition: elem.cc:239
SubjectToInitialAssembly(void)
Definition: elem.cc:217
bool bIsRightHandSide(void) const
Definition: elem.cc:89
#define NO_OP
Definition: myassert.h:74
virtual Elem::Type GetElemType(void) const =0
void SetInverseDynamicsFlags(unsigned uIDF)
Definition: elem.cc:71
bool IsWord(const std::string &s) const
Definition: elem.cc:182
unsigned m_uInverseDynamicsFlags
Definition: elem.h:81
virtual ~Elem(void)
Definition: elem.cc:48
virtual ~SubjectToInitialAssembly(void)
Definition: elem.cc:223
virtual ~ElemWithDofs(void)
Definition: elem.cc:207
Definition: elem.h:258
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:137
unsigned GetInverseDynamicsFlags(void) const
Definition: elem.cc:77
#define ASSERT(expression)
Definition: colamd.c:977
static ElemWordSetType ElemWordSet
Definition: elem.cc:187
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
bool SetElem(const char *name, ElemRead *rf)
Definition: elem.cc:191
static ElemFuncMapType ElemFuncMap
Definition: elem.cc:174
Definition: elem.h:75
Type
Definition: elem.h:91
const char * psElemNames[]
Definition: enums.cc:39
virtual DofOrder::Order GetDofType(unsigned int) const
Definition: elem.cc:150
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: elem.cc:55
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
const char * psReadElemsElems[]
Definition: enums.cc:79
InitialAssemblyElem(unsigned int uL, flag fOut)
Definition: elem.cc:233
const char * invdyn2str(InverseDynamics::Order iOrder)
Definition: invdyn.cc:36
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
unsigned int GetLabel(void) const
Definition: withlab.cc:62
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:124
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
std::map< std::string, ElemRead *, ltstrcase > ElemFuncMapType
Definition: elem.cc:173