MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
hbeam.cc File Reference
#include "mbconfig.h"
#include <limits>
#include <cfloat>
#include "dataman.h"
#include "constltp.h"
#include "shapefnc.h"
#include "beam.h"
#include "hbeam.h"
#include "hbeam_interp.h"
Include dependency graph for hbeam.cc:

Go to the source code of this file.

Functions

ElemReadHBeam (DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
 

Function Documentation

Elem* ReadHBeam ( DataManager pDM,
MBDynParser HP,
unsigned int  uLabel 
)

Definition at line 1091 of file hbeam.cc.

References Node::ABSTRACT, Elem::BEAM, DEBUGCOUTFNAME, DEBUGLCOUT, ConstLawType::ELASTIC, DataManager::fReadOutput(), MBDynParser::GetConstLaw6D(), ConstitutiveLaw< T, Tder >::GetFDE(), HighParser::GetInt(), IncludeParser::GetLineData(), MBDynParser::GetMat6xN(), MBDynParser::GetPosRel(), StructNode::GetRCurr(), MBDynParser::GetRotRel(), StructDispNode::GetXCurr(), ConstitutiveLaw< T, Tder >::iGetNumDof(), HighParser::IsArg(), HighParser::IsKeyWord(), LASTKEYWORD, MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, NO_OP, DataManager::ReadNode(), Mat3xN::Resize(), SAFENEWARR, SAFENEWWITHCONSTRUCTOR, Node::STRUCTURAL, and ConstLawType::UNKNOWN.

Referenced by DataManager::ReadOneElem().

1092 {
1093  DEBUGCOUTFNAME("ReadHBeam");
1094 
1095  const char* sKeyWords[] = {
1096  "piezoelectric",
1097  NULL
1098  };
1099 
1100  /* enum delle parole chiave */
1101  enum KeyWords {
1102  UNKNOWN = -1,
1103 
1104  PIEZOELECTRIC = 0,
1105 
1106  LASTKEYWORD
1107  };
1108 
1109  /* tabella delle parole chiave */
1110  KeyTable K(HP, sKeyWords);
1111 
1112  /* Nodo 1 */
1113  const StructNode* pNode1 = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
1114  if (HP.IsKeyWord("position")) {
1115  /* just eat it! */
1116  NO_OP;
1117  }
1118  Vec3 f1(HP.GetPosRel(ReferenceFrame(pNode1)));
1119  Mat3x3 R1;
1120  if (HP.IsKeyWord("orientation") || HP.IsKeyWord("rot")) {
1121  R1 = HP.GetRotRel(ReferenceFrame(pNode1));
1122  } else {
1123  R1 = pNode1->GetRCurr();
1124  }
1125 
1126  DEBUGLCOUT(MYDEBUG_INPUT, "node 1 offset (node reference frame): "
1127  << f1 << std::endl << "(global frame): "
1128  << pNode1->GetXCurr()+pNode1->GetRCurr()*R1*f1 << std::endl);
1129 
1130  /* Nodo 2 */
1131  const StructNode* pNode2 = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
1132  if (HP.IsKeyWord("position")) {
1133  /* just eat it! */
1134  NO_OP;
1135  }
1136  Vec3 f2(HP.GetPosRel(ReferenceFrame(pNode2)));
1137  Mat3x3 R2;
1138  if (HP.IsKeyWord("orientation") || HP.IsKeyWord("rot")) {
1139  R2 = HP.GetRotRel(ReferenceFrame(pNode2));
1140  } else {
1141  R2 = pNode1->GetRCurr();
1142  }
1143 
1144  DEBUGLCOUT(MYDEBUG_INPUT, "node 2 offset (node reference frame): "
1145  << f2 << std::endl << "(global frame): "
1146  << pNode2->GetXCurr()+pNode2->GetRCurr()*R2*f2 << std::endl);
1147 
1148  /* Legame costitutivo */
1150  ConstitutiveLaw6D* pD = HP.GetConstLaw6D(CLType);
1151 
1152  if (pD->iGetNumDof() != 0) {
1153  silent_cerr("line " << HP.GetLineData()
1154  << ": HBeam(" << uLabel << ") does not support "
1155  "dynamic constitutive laws yet"
1156  << std::endl);
1158  }
1159 
1160 #ifdef DEBUG
1161  Mat6x6 MTmp(pD->GetFDE());
1162  Mat3x3 D11(MTmp.GetMat11());
1163  Mat3x3 D12(MTmp.GetMat12());
1164  Mat3x3 D21(MTmp.GetMat21());
1165  Mat3x3 D22(MTmp.GetMat22());
1166 
1168  "First point matrix D11: " << std::endl << D11 << std::endl
1169  << "First point matrix D12: " << std::endl << D12 << std::endl
1170  << "First point matrix D21: " << std::endl << D21 << std::endl
1171  << "First point matrix D22: " << std::endl << D22 << std::endl);
1172 #endif /* DEBUG */
1173 
1174 #ifdef PIEZO_BEAM
1175  flag fPiezo(0);
1176  Mat3xN PiezoMat[2];
1177  integer iNumElec = 0;
1178  const ScalarDifferentialNode** pvElecDofs = 0;
1179  if (HP.IsKeyWord("piezoelectricactuator")) {
1180  fPiezo = flag(1);
1182  "Piezoelectric actuator beam is expected"
1183  << std::endl);
1184 
1185  iNumElec = HP.GetInt();
1187  "piezo actuator " << uLabel
1188  << " has " << iNumElec
1189  << " electrodes" << std::endl);
1190  if (iNumElec <= 0) {
1191  silent_cerr("HBeam(" << uLabel << "): "
1192  "illegal number of electric nodes "
1193  << iNumElec
1194  << " at line " << HP.GetLineData()
1195  << std::endl);
1197  }
1198 
1199  SAFENEWARR(pvElecDofs, const ScalarDifferentialNode *, iNumElec);
1200 
1201  for (integer i = 0; i < iNumElec; i++) {
1202  pvElecDofs[i] = pDM->ReadNode<const ScalarDifferentialNode, Node::ABSTRACT>(HP);
1203  }
1204 
1205  PiezoMat[0].Resize(iNumElec);
1206  PiezoMat[1].Resize(iNumElec);
1207 
1208  /* leggere le matrici (6xN sez. 1, 6xN sez. 2) */
1209  HP.GetMat6xN(PiezoMat[0], PiezoMat[1], iNumElec);
1210 
1211 #if 0
1212  DEBUGLCOUT(MYDEBUG_INPUT, "Piezo matrix I:" << std::endl
1213  << PiezoMat[0][0] << PiezoMat[1][0]);
1214 #endif /* 0 */
1215  }
1216 #endif /* PIEZO_BEAM */
1217 
1218  flag fOut = pDM->fReadOutput(HP, Elem::BEAM);
1219 
1220  Elem* pEl = NULL;
1221 
1222  if (CLType == ConstLawType::ELASTIC) {
1223 #ifdef PIEZO_BEAM
1224  if (fPiezo == 0) {
1225 #endif /* PIEZO_BEAM */
1227  HBeam,
1228  HBeam(uLabel,
1229  pNode1, pNode2,
1230  f1, f2,
1231  R1, R2,
1232  pD,
1233  fOut));
1234 #ifdef PIEZO_BEAM
1235  } else {
1237  PiezoActuatorHBeam,
1238  PiezoActuatorHBeam(uLabel,
1239  pNode1, pNode2,
1240  f1, f2,
1241  R,
1242  pD,
1243  iNumElec,
1244  pvElecDofs,
1245  PiezoMat[0], PiezoMat[1],
1246  fOut));
1247  }
1248 #endif /* PIEZO_BEAM */
1249 
1250  } else /* At least one is VISCOUS or VISCOELASTIC */ {
1251 #ifdef VISCOELASTIC_BEAM
1252 #ifdef PIEZO_BEAM
1253  if (fPiezo == 0) {
1254 #endif /* PIEZO_BEAM */
1256  ViscoElasticHBeam,
1257  ViscoElasticHBeam(uLabel,
1258  pNode1, pNode2,
1259  f1, f2,
1260  R,
1261  pD,
1262  fOut));
1263 #ifdef PIEZO_BEAM
1264  } else {
1266  PiezoActuatorVEHBeam,
1267  PiezoActuatorVEHBeam(uLabel,
1268  pNode1, pNode2,
1269  f1, f2,
1270  R,
1271  pD,
1272  iNumElec,
1273  pvElecDofs,
1274  PiezoMat[0], PiezoMat[1],
1275  fOut));
1276  }
1277 #endif /* PIEZO_BEAM */
1278 
1279 #else /* VISCOELASTIC_BEAM */
1280  silent_cerr("Sorry, the ViscoElasticHBeam element"
1281  " is not available yet" << std::endl);
1283 #endif /* VISCOELASTIC_BEAM */
1284  }
1285 
1286  /* Se non c'e' il punto e virgola finale */
1287  if (HP.IsArg()) {
1288  silent_cerr("semicolon expected at line "
1289  << HP.GetLineData() << std::endl);
1291  }
1292 
1293  return pEl;
1294 } /* End of ReadHBeam() */
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
Mat3x3 GetRotRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1795
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual void GetMat6xN(Mat3xN &m1, Mat3xN &m2, integer iNumCols)
Definition: mbpar.cc:2743
virtual const Tder & GetFDE(void) const
Definition: constltp.h:129
#define NO_OP
Definition: myassert.h:74
Definition: hbeam.h:57
Vec3 GetPosRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1331
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
ConstitutiveLaw6D * GetConstLaw6D(ConstLawType::Type &clt)
Definition: mbpar.cc:1995
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
void Resize(integer ns)
Definition: matvec3n.cc:318
virtual unsigned int iGetNumDof(void) const
Definition: constltp.h:138
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
Mat3x3 R

Here is the call graph for this function: