162 const char* sKeyWords[] = {
169 "automatic" "structural",
171 "joint" "regularization",
184 "induced" "velocity",
186 "aerodynamic" "body",
187 "aerodynamic" "beam3",
188 "aerodynamic" "beam",
189 "aerodynamic" "beam2",
190 "aerodynamic" "external",
191 "aerodynamic" "external" "modal",
193 "aircraft" "instruments",
194 "generic" "aerodynamic" "force",
212 "stream" "motion" "output",
232 int iMissingElems =
Elems.size();
235 ElemVecType::iterator ei =
Elems.begin();
258 ASSERT(iNumTypes[Elem::AUTOMATICSTRUCTURAL] > 0);
263 "Initializing automatic structural element linked to StructuralNode("
264 << pN->
GetLabel() <<
")" << std::endl);
284 ASSERT(iNumTypes[Elem::AUTOMATICSTRUCTURAL] > 0);
289 "Initializing automatic structural element linked to StructDispNode(" << pDN->
GetLabel() <<
")" << std::endl);
415 silent_cerr(
"Error: unknown element type, cannot modify output"
421 silent_cerr(
"Error: element type " << sKeyWords[CurrDesc]
422 <<
" at line " << HP.
GetLineData() <<
" is not allowed"
431 unsigned int uL = (
unsigned int)HP.
GetInt();
432 unsigned int uEndL = (
unsigned int)HP.
GetInt();
434 silent_cerr(
"End label " << uEndL
435 <<
" must be larger than "
436 "or equal to start label "
440 for ( ; uL <= uEndL; uL++) {
445 if (dynamic_cast<const Modal *>(pE)) {
452 unsigned int uL = (
unsigned int)HP.
GetInt();
456 "is not defined (ignored); output cannot be modified "
462 if (dynamic_cast<const Modal *>(pE)) {
469 }
else if (CurrDesc ==
BIND) {
475 if (
ElemData[t].ElemContainer.empty()) {
476 silent_cerr(
"air properties not defined; "
477 "cannot bind at line "
486 unsigned int uL = HP.
GetInt();
579 <<
" does not support bind" << std::endl);
581 silent_cerr(
"DataManager::ReadElems: unknown element type (label=" << uL <<
") "
589 silent_cerr(
"cannot find " <<
psElemNames[t] <<
" (" << uL <<
") "
596 unsigned uL = HP.
GetInt();
598 Elem2Param* pNd = pFindNode<Elem2Param, ParameterNode, Node::PARAMETER>(uL);
600 silent_cerr(
"can't find parameter node (" << uL <<
") "
614 <<
"(" << pEl->
GetLabel() <<
") private data "
615 "\"" << s <<
"\"" << std::endl);
630 silent_cerr(
"error in private data \"" << s <<
"\" "
632 "while binding to ParameterNode(" << uL <<
") "
636 silent_cerr(
"error in private data #" << i <<
" "
638 "while binding to ParameterNode(" << uL <<
") "
647 "to Parameter " << pNd->
GetLabel() << std::endl);
651 }
else if (CurrDesc ==
GUST) {
653 silent_cerr(
"air properties not defined; "
654 "cannot add gust at line "
669 DEBUGCOUT(
"reading AutomaticStructElem(" << pAS->
GetLabel() <<
")" << std::endl);
681 <<
"G = " << g << std::endl
682 <<
"Qp = " << qp << std::endl
683 <<
"Gp = " << gp << std::endl);
685 pAS->
Init(q, g, qp, gp);
688 DEBUGCOUT(
"reading AutomaticStructDispElem(" << pASD->
GetLabel() <<
")" << std::endl);
694 <<
"Qp = " << qp << std::endl);
712 silent_cout(
"Reading Gravity" << std::endl);
717 ": Gravity is not defined" << std::endl);
734 silent_cout(
"Reading AirProperties" << std::endl);
739 "AirProperties is not defined"
761 uLabel = unsigned(HP.
GetInt());
768 std::vector<std::string> hints;
770 for (
unsigned i = 1; HP.
IsKeyWord(
"hint"); i++) {
773 silent_cerr(
"Driven(" << uLabel <<
"): "
774 "unable to read hint #" << i
779 hints.push_back(hint);
786 switch (CurrDriven) {
827 <<
" cannot be driven" << std::endl);
831 DEBUGCERR(
"warning, this element cannot be driven" << std::endl);
837 bool bExisting(
false);
842 unsigned int uL = (
unsigned int)HP.
GetInt();
844 silent_cerr(
"Error: the driving element must have "
845 "the same label of the driven one"
852 switch (CurrDriven) {
926 DEBUGCERR(
"warning, this element can't be driven" << std::endl);
932 silent_cerr(
"Error: element " << uLabel
933 <<
"cannot be driven since it doesn't exist"
945 unsigned int uDummy = (
unsigned int)HP.
GetInt();
946 if (uDummy != uLabel) {
947 silent_cerr(
"Error: the element label "
948 "(" << uDummy <<
") "
949 "must be the same of the driving element "
950 "(" << uLabel <<
") at line "
960 silent_cerr(
"error in allocation of element "
961 << uLabel << std::endl);
970 if (!hints.empty()) {
971 for (std::vector<std::string>::const_iterator i = hints.begin();
972 i != hints.end(); ++i)
979 pHints->push_back(ph);
991 ElemVecType::iterator eitmp =
Elems.begin();
992 for (; eitmp !=
Elems.end(); ++eitmp) {
1067 silent_cerr(
"error - element type "
1068 << sKeyWords[CurrDesc] <<
": "
1069 "unable to parse name"
1077 #ifdef USE_RUNTIME_LOADING
1079 && !moduleInitialized)
1082 moduleInitialized =
true;
1084 #endif // USE_RUNTIME_LOADING
1090 if (!sName.empty() && sName != pE->
GetName()) {
1104 silent_cerr(
"error - unknown element type at line "
1112 silent_cerr(
"error - element type " << sKeyWords[CurrDesc]
1114 <<
" is not allowed " << std::endl);
1136 silent_cerr(
"<end: elements;> expected at line"
1145 silent_cerr(
"semicolon expected at line " << HP.
GetLineData()
1151 if (iMissingElems > 0) {
1153 silent_cerr(
"error: " << iMissingElems
1154 <<
" elements are missing;" << std::endl);
1156 if (iNumTypes[iCnt] > 0) {
1157 silent_cerr(
" " << iNumTypes[iCnt]
1172 if (
ElemData[iCnt].bGeneratesInertiaForces()
1173 && !
ElemData[iCnt].ElemContainer.empty())
1175 for (ElemContainerType::const_iterator p =
ElemData[iCnt].ElemContainer.begin();
1194 if (
ElemData[iCnt].bUsesAirProperties()
1195 && !
ElemData[iCnt].ElemContainer.empty())
1197 for (ElemContainerType::const_iterator p =
ElemData[iCnt].ElemContainer.begin();
1215 if (
ElemData[iCnt].bUsesAirProperties()
1216 && !
ElemData[iCnt].ElemContainer.empty())
1218 for (ElemContainerType::const_iterator p =
ElemData[iCnt].ElemContainer.begin();
1221 if (dynamic_cast<AerodynamicElem *>(p->second)->NeedsAirProperties()) {
1223 silent_cerr(
"The following aerodynamic elements "
1224 "are defined: " << std::endl);
1233 silent_cerr(
"while no air properties are defined; aborting..."
1244 unsigned iNumElems = 0;
1265 bool bCouple(
false);
1267 silent_cout(
"Reading Force(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1271 silent_cout(
"Reading Couple(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1277 <<
": Force(" << uLabel <<
") "
1278 <<
"exceeds force elements number" << std::endl);
1287 <<
": Force(" << uLabel <<
") "
1288 "already defined" << std::endl);
1294 pE =
ReadForce(
this, HP, uLabel, bCouple);
1303 silent_cout(
"Reading Body(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1308 <<
": Body(" << uLabel <<
") "
1309 "exceeds rigid body elements number" << std::endl);
1318 <<
": Body(" << uLabel <<
") "
1319 "already defined" << std::endl);
1335 silent_cout(
"Reading Joint(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1340 <<
": Joint(" << uLabel <<
") "
1341 "exceeds joint elements number" << std::endl);
1350 <<
": Joint(" << uLabel <<
") "
1351 "already defined" << std::endl);
1373 silent_cout(
"Reading JointRegularization(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1379 <<
"(" << uLabel <<
")"
1381 <<
" elements number" << std::endl);
1391 <<
"(" << uLabel <<
")"
1392 <<
" already defined" << std::endl);
1413 silent_cout(
"Reading Beam(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1418 "Beam(" << uLabel <<
") "
1419 "exceeds beam elements number" << std::endl);
1428 "Beam(" << uLabel <<
") "
1429 "already defined" << std::endl);
1479 silent_cout(
"Reading " << sType <<
"(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1484 << sType <<
"(" << uLabel <<
") "
1485 "exceeds plate elements number" << std::endl);
1494 << sType <<
"(" << uLabel <<
") "
1495 "already defined" << std::endl);
1533 silent_cout(
"Reading InducedVelocity(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1537 silent_cerr(
"InducedVelocity(" << uLabel <<
"): deprecated \"rotor\", use \"induced velocity\" of type \"rotor\" instead at line " << HP.
GetLineData() << std::endl);
1544 silent_cerr(
"InducedVelocity(" << uLabel <<
"): unknown \"induced velocity\" type at line " << HP.
GetLineData() <<
" (missing \"rotor\" keyword?)" << std::endl);
1555 silent_cerr(
"InducedVelocity(" << uLabel <<
"): "
1556 "exceeds induced velocity elements number "
1565 silent_cerr(
"InducedVelocity(" << uLabel <<
") "
1566 "already defined at line "
1587 silent_cout(
"Reading AeroModal(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1592 "AeroModal(" << uLabel <<
") "
1593 "exceeds aeromodal elements number" << std::endl);
1602 "AeroModal(" << uLabel <<
") "
1603 "already defined" << std::endl);
1625 silent_cout(
"Reading External(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1630 "External(" << uLabel <<
") "
1631 "exceeds external elements number" << std::endl);
1640 "External(" << uLabel <<
") "
1641 "already defined" << std::endl);
1649 pE = ReadAerodynamicExternal(
this, HP, uLabel);
1653 pE = ReadAerodynamicExternalModal(
this, HP, uLabel);
1657 ASSERTMSG(0,
"You shouldn't have reached this point");
1664 silent_cerr(
"You need mpi and -DUSE_AERODYNAMIC_EXTERNAL "
1665 <<
"to use this type of elements." << std::endl);
1677 silent_cout(
"Reading AerodynamicElement(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1682 "AerodynamicElement(" << uLabel <<
") "
1683 "exceeds aerodynamic elements number" << std::endl);
1692 "AerodynamicElement(" << uLabel <<
") "
1693 "already defined" << std::endl);
1727 ASSERTMSG(0,
"You shouldn't have reached this point");
1739 silent_cout(
"Reading Genel(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1744 "Genel(" << uLabel <<
") "
1745 "exceeds genel elements number" << std::endl);
1754 "Genel(" << uLabel <<
") "
1755 "already defined" << std::endl);
1775 silent_cout(
"Reading HydraulicElement(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1780 "HydraulicElement(" << uLabel <<
") "
1781 "exceeds hydraulic elements number" << std::endl);
1790 "HydraulicElement(" << uLabel <<
") "
1791 "already defined" << std::endl);
1814 silent_cout(
"Reading ElectricElement(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1819 "ElectricElement(" << uLabel <<
") "
1820 "exceeds electric elements number" << std::endl);
1829 "ElectricElement(" << uLabel <<
") "
1830 "already defined" << std::endl);
1853 silent_cout(
"Reading ThermalElement(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1858 "ThermalElement(" << uLabel <<
") "
1859 "exceeds thermal elements number" << std::endl);
1868 "ThermalElement(" << uLabel <<
") "
1869 "already defined" << std::endl);
1892 silent_cout(
"Reading BulkElement(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1897 "BulkElement(" << uLabel <<
") "
1898 "exceeds bulk elements number" << std::endl);
1907 "BulkElement(" << uLabel <<
") "
1908 "already defined" << std::endl);
1925 silent_cout(
"Reading LoadableElement(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1930 "LoadableElement(" << uLabel <<
") "
1931 "exceeds loadable elements number" << std::endl);
1940 "LoadableElement(" << uLabel <<
") "
1941 "already defined" << std::endl);
1966 silent_cout(
"need --with-rtai to allow RTMBDyn mailboxes; "
1967 "using stream output instead..." << std::endl);
1975 silent_cout(
"Reading StreamOutElem(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
1980 "StreamOutElem(" << uLabel <<
") "
1981 "exceeds stream output elements number" << std::endl);
1990 "StreamOutElem(" << uLabel <<
") "
1991 "already defined" << std::endl);
2002 pedantic_cerr(
"SocketStreamElem(" << uLabel <<
"): "
2003 "deprecated in favour of 'output element: <label>, socket stream, ...' "
2010 pedantic_cerr(
"SocketStreamMotionElem(" << uLabel <<
"): "
2011 "deprecated in favour of 'output element: <label>, socket stream, motion, ...' "
2032 silent_cout(
"Reading Inertia(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")" << std::endl);
2046 std::set<const ElemGravityOwner *> elements;
2050 bool bAlways(
false);
2051 while (HP.
IsArg()) {
2074 silent_cerr(
"Inertia(" << uLabel <<
"): "
2075 "unknown output mode "
2101 if (!sName.empty()) {
2102 silent_cerr(
"Inertia(" << uLabel <<
", \"" << sName <<
"\"): ");
2104 silent_cerr(
"Inertia(" << uLabel <<
"): ");
2106 silent_cerr(
"unknown or undefined element type "
2116 for (ElemContainerType::const_iterator i =
ElemData[Type].ElemContainer.begin();
2122 <<
"(" << i->second->GetLabel() <<
"): "
2123 "not a gravity related element "
2129 if (elements.find(pEl) != elements.end()) {
2132 " duplicate label at line "
2136 elements.insert(pEl);
2140 unsigned int uL = (
unsigned int)HP.
GetInt();
2143 silent_cerr(
"Inertia(" << uLabel <<
"): "
2145 <<
"(" << uL <<
") "
2152 silent_cerr(
"Inertia(" << uLabel <<
"): "
2154 <<
"(" << uL <<
"): "
2155 "not a gravity related element "
2161 if (elements.find(pEl) != elements.end()) {
2162 silent_cerr(
"Inertia(" << uLabel <<
"): "
2169 elements.insert(pEl);
2184 "Inertia(" << uLabel <<
") "
2185 "exceeds inertia elements number" << std::endl);
2194 "Inertia(" << uLabel <<
") "
2195 "already defined" << std::endl);
2220 silent_cerr(
"You shouldn't be here" << std::endl);
flag fReadOutput(MBDynParser &HP, const T &t) const
Elem * ReadJointRegularization(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Elem * ReadGravity(DataManager *pDM, MBDynParser &HP)
void PutName(const std::string &sN)
Elem * ReadAerodynamicBeam(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
virtual StructDispNode::Type GetStructDispNodeType(void) const
unsigned int iExpectedNum
void module_initialize(void)
ElemContainerType ElemContainer
const Vec3 Zero3(0., 0., 0.)
Elem * ReadShell4EASANS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
#define MBDYN_EXCEPT_ARGS
Elem * ReadAerodynamicModal(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
#define DEBUGCOUTFNAME(fname)
void PutGravity(const Gravity *pG)
Elem * ReadOutputElem(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, StreamOutElem::Type eType, StreamContent::Type sType)
virtual integer GetInt(integer iDefval=0)
void Init(const Vec3 &b, const Vec3 &bp)
Mat3x3 GetRotAbs(const ReferenceFrame &rf)
Elem ** InsertElem(ElemDataStructure &eldata, unsigned int uLabel, Elem *pE)
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
virtual void PutAirProperties(const AirProperties *pAP)
virtual unsigned int iGetPrivDataIdx(const char *s) const
Gust * ReadGustData(const DataManager *pDM, MBDynParser &HP)
Elem * ReadAircraftInstruments(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
#define ASSERTMSG(expr, msg)
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
virtual Elem::Type GetElemType(void) const =0
Elem * ReadMembrane4EAS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Elem * ReadJoint(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Elem * ReadShell4EAS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
std::vector< Hint * > Hints
Elem * ReadThermal(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Elem * ReadLoadable(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
NodeContainerType NodeContainer
Elem * ReadHydraulicElem(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Elem * ReadAirProperties(DataManager *pDM, MBDynParser &HP)
virtual void ExpectDescription(void)
Elem * ReadBody(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Elem * ReadForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, bool bCouple)
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
const ReferenceFrame AbsRefFrame(0, Vec3(0., 0., 0), Mat3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), Vec3(0., 0., 0), Vec3(0., 0., 0), EULER_123)
Elem * ReadBeam2(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
virtual bool IsKeyWord(const char *sKeyWord)
virtual void Bind(const Elem *pEl, unsigned int i)
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
Vec3 GetPosAbs(const ReferenceFrame &rf)
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
void ReadElems(MBDynParser &HP)
Elem * ReadAerodynamicBody(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
#define ASSERT(expression)
Elem ** ppFindElem(Elem::Type Typ, unsigned int uElem) const
Elem * ReadRotor(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Elem * ReadAerodynamicBeam2(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
static int iNumTypes[Elem::LASTELEMTYPE]
void Init(const Vec3 &b, const Vec3 &g, const Vec3 &bp, const Vec3 &gp)
Elem * ReadElectric(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Elem ** ReadOneElem(MBDynParser &HP, unsigned int uLabel, const std::string &sName, int CurrType)
virtual unsigned int iGetNumPrivData(void) const
Vec3 GetVecAbs(const ReferenceFrame &rf)
Mat3x3 Transpose(void) const
const char * psElemNames[]
virtual int GetWord(void)
Elem * ReadGenel(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Elem * ReadBulk(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Elem * ReadHBeam(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
std::ostream & Log(void) const
Elem * ReadBeam(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
DriveCaller * GetDriveCaller(bool bDeferred=false)
Elem * ReadGenericAerodynamicForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
void OutputOpen(const OutputHandler::OutFiles out)
virtual void SetOutputFlag(flag f=flag(1))
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
const std::string & GetName(void) const
virtual HighParser::ErrOut GetLineData(void) const
virtual StructNode::Type GetStructNodeType(void) const
unsigned int GetLabel(void) const
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
UserDefinedElem * ParseUserDefinedElem(unsigned uLabel, DofOwner *pDO, DataManager *const pDM, MBDynParser &HP)