40 #if defined(USE_RUNTIME_LOADING) && defined(HAVE_LTDL_H)
69 const char* sInputFileName)
77 const char* sKeyWords[] = {
117 "skip" "initial" "joint" "assembly",
120 "initial" "stiffness",
123 "initial" "tolerance",
125 "max" "initial" "iterations",
135 "make" "restart" "file",
136 "output" "file" "name",
137 "output" "precision",
138 "output" "frequency",
144 "reference" "frames",
148 "default" "orientation",
149 "default" "beam" "output",
150 "default" "aerodynamic" "output",
153 "finite" "difference" "jacobian" "meter",
155 "read" "solution" "array",
160 "rigid" "body" "kinematics",
182 JOINT_REGULARIZATIONS,
186 INDUCEDVELOCITYELEMENTS,
192 ELECTRICBULKELEMENTS,
199 SOCKETSTREAMOUTPUTELEMENTS,
207 SKIPINITIALJOINTASSEMBLY,
215 MAXINITIALITERATIONS,
241 DEFAULTAERODYNAMICOUTPUT,
265 case STRUCTURALNODES: {
273 case ELECTRICNODES: {
289 case ABSTRACTNODES: {
297 case PARAMETERNODES: {
304 case HYDRAULICNODES: {
324 << iDmy << std::endl);
331 silent_cerr(
"warning: gravity acceleration already defined;" << std::endl
332 <<
"only one definition will be considered" << std::endl);
364 case JOINT_REGULARIZATIONS: {
397 silent_cerr(
"warning: air properties already defined;" << std::endl
398 <<
"only one definition will be considered" << std::endl);
406 silent_cerr(
"deprecated \"rotors\", use \"induced velocity elements\" instead at line " << HP.
GetLineData() << std::endl);
408 case INDUCEDVELOCITYELEMENTS: {
423 case AERODYNAMICELEMENTS: {
446 case ELECTRICELEMENTS: {
454 case THERMALELEMENTS: {
462 case HYDRAULICELEMENTS: {
477 case LOADABLEELEMENTS: {
485 #if defined(USE_RUNTIME_LOADING)
488 if (!moduleInitialized) {
490 moduleInitialized =
true;
501 silent_cerr(
"missing path "
502 "in \"loadable path\" statement "
509 if (lt_dladdsearchdir(s) != 0) {
510 silent_cerr(
"unable to add path "
512 "in \"loadable path\" "
519 if (lt_dlsetsearchpath(s) != 0) {
520 silent_cerr(
"unable to set path "
522 "in \"loadable path\" "
530 #else // ! USE_RUNTIME_LOADING
531 silent_cerr(
"loadable path allowed "
532 "only in presence of libltdl (ignored)"
535 #endif // ! USE_RUNTIME_LOADING
538 case EXTERNALELEMENTS: {
545 silent_cerr(
"cannot use external elements "
546 "when not compiled with -DUSE_EXTERNAL"
551 case SOCKETSTREAMOUTPUTELEMENTS:
552 case RTAIOUTPUTELEMENTS: {
558 if (CurrDesc == RTAIOUTPUTELEMENTS) {
559 silent_cerr(
"cannot use "
560 "RTAI output elements "
561 "when not configured "
563 "using \"socket stream output\" "
581 case SKIPINITIALJOINTASSEMBLY: {
597 "Rigid bodies will be used "
598 "in initial joint assembly"
605 "Gravity will be used "
606 "in initial joint assembly"
613 "Forces will be used "
614 "in initial joint assembly"
624 "Beams are used by default "
625 "in initial joint assembly"
632 "Plates will be used "
633 "in initial joint assembly"
637 case AERODYNAMICELEMENTS:
640 "Aerodynamic Elements will be used "
641 "in initial joint assembly"
650 case LOADABLEELEMENTS:
653 "Loadable Elements will be used "
654 "in initial joint assembly"
660 silent_cerr(
"Element type at line "
662 <<
" is not allowed; aborting..."
669 silent_cerr(
"Unknown element type "
671 "aborting..." << std::endl);
687 case INITIALSTIFFNESS:
688 pedantic_cout(
"\"initial stiffness\" deprecated at line "
706 <<
"Initial velocity stiffness: "
714 silent_cerr(
"Invalid option at line "
723 case INITIALTOLERANCE:
724 pedantic_cout(
"\"initial tolerance\" deprecated at line "
738 case MAXINITIALITERATIONS:
739 pedantic_cout(
"\"max initial iterations\" deprecated at line "
752 silent_cerr(
"illegal \"epsilon\"=" <<
dEpsilon
764 }
else if (HP.
IsKeyWord(
"dof" "description")) {
767 }
else if (HP.
IsKeyWord(
"equation" "description")) {
770 }
else if (HP.
IsKeyWord(
"description")) {
773 }
else if (HP.
IsKeyWord(
"element" "connection")) {
776 }
else if (HP.
IsKeyWord(
"node" "connection")) {
792 silent_cerr(
"unknown print flag at line "
800 silent_cerr(
"\"solver\" keyword at line "
802 "use \"linear solver\" instead" << std::endl);
820 case MAKERESTARTFILE:
828 <<
" iterations" << std::endl);
834 <<
" time units" << std::endl);
839 silent_cerr(
"illegal number of restart times "
852 silent_cerr(
"Error: unrecognized restart option at line "
861 if (HP.
IsKeyWord(
"with" "solution" "array")) {
867 silent_cerr(
"\"output file name\" no longer supported at line "
871 case OUTPUTPRECISION: {
876 case OUTPUTFREQUENCY: {
878 silent_cerr(
"Output meter/frequency already defined" << std::endl);
883 silent_cerr(
"Illegal output frequency " << iFreq
890 -std::numeric_limits<double>::max(),
891 std::numeric_limits<double>::max(),
898 silent_cerr(
"Output meter/frequency already defined" << std::endl);
908 #if defined USE_ADAMS
913 if (sAdamsModelName != 0) {
915 <<
": ADAMS output model name "
916 "already defined; replacing..."
929 silent_cerr(
"unknown value "
930 "for \"velocity\" flag at line "
937 if (!HP.
GetYesNo(bAdamsAcceleration)) {
938 silent_cerr(
"unknown value "
939 "for \"acceleration\" flag at line "
946 if (sAdamsModelName == 0) {
950 silent_cerr(
"Please rebuild with ADAMS output enabled"
955 }
else if (HP.
IsKeyWord(
"motion" "view")) {
956 #if defined USE_MOTIONVIEW
963 silent_cerr(
"Please rebuild with MotionView output enabled"
977 bNetCDFnoText =
true;
981 silent_cerr(
"\"netcdf\" ignored; please rebuild with NetCDF output enabled"
986 silent_cerr(
"unknown \"output results\" "
997 switch (CurrDefOut) {
1016 case REFERENCEFRAMES:
1028 case STRUCTURALNODES:
1044 case HYDRAULICNODES:
1073 case INDUCEDVELOCITYELEMENTS:
1081 case AERODYNAMICELEMENTS:
1093 case ELECTRICBULKELEMENTS:
1097 case ELECTRICELEMENTS:
1101 case THERMALELEMENTS:
1105 case HYDRAULICELEMENTS:
1108 case LOADABLEELEMENTS:
1112 case EXTERNALELEMENTS:
1118 silent_cerr(
"warning: unknown output case at line "
1124 silent_cerr(
"case " << sKeyWords[CurrDesc] <<
" at line "
1125 << HP.
GetLineData() <<
" is not allowed" << std::endl);
1132 case DEFAULTORIENTATION:
1136 case DEFAULTBEAMOUTPUT:
1141 case DEFAULTAERODYNAMICOUTPUT:
1147 while (HP.
IsArg()) {
1151 switch (CurrDefOut) {
1154 DofData[iCnt].dDefScale= dScale;
1158 case STRUCTURALNODES:
1174 case HYDRAULICNODES:
1183 case INDUCEDVELOCITYELEMENTS:
1195 case ELECTRICBULKELEMENTS:
1199 case ELECTRICELEMENTS:
1203 case THERMALELEMENTS:
1207 case HYDRAULICELEMENTS:
1211 case LOADABLEELEMENTS:
1216 silent_cerr(
"warning: unknown output case at line "
1222 silent_cerr(
"case " << sKeyWords[CurrDesc] <<
" at line "
1223 << HP.
GetLineData() <<
" is not allowed" << std::endl);
1232 if (pFDJacMeter != 0) {
1233 silent_cerr(
"\"finite difference jacobian meter\" already defined" << std::endl);
1236 #endif // MBDYN_FDJAC
1240 #else // !MBDYN_FDJAC
1241 silent_cerr(
"warning, \"finite difference jacobian meter\" not supported (ignored)" << std::endl);
1243 #endif // !MBDYN_FDJAC
1246 case READSOLUTIONARRAY:{
1247 int len = strlen(sInputFileName) +
sizeof(
".X");
1255 SocketUsersTimeout = 0;
1260 silent_cerr(
"warning: illegal select timeout " << timeout
1264 SocketUsersTimeout = 60*
timeout;
1267 #else // ! USE_SOCKET
1268 silent_cerr(
"warning: \"select timeout\" not allowed (ignored) "
1270 <<
" because the current architecture "
1271 "apparently does not support sockets"
1273 #endif // ! USE_SOCKET
1282 case RIGIDBODYKINEMATICS: {
1314 if (HP.
IsKeyWord(
"angular" "velocity")) {
1328 if (HP.
IsKeyWord(
"angular" "acceleration")) {
1336 silent_cerr(
"null rigid body kinematics "
1371 if (HP.
IsKeyWord(
"angular" "velocity")) {
1381 if (HP.
IsKeyWord(
"angular" "acceleration")) {
1387 silent_cerr(
"null rigid body kinematics "
1396 pThetaDrv, pVDrv, pWDrv,
1400 silent_cerr(
"unknown rigid body kinematics "
1407 silent_cerr(
"Semicolon expected at line "
1420 silent_cerr(
"unknown description at line "
1427 silent_cerr(
"case " << sKeyWords[CurrDesc] <<
" at line "
1428 << HP.
GetLineData() <<
" is not allowed" << std::endl);
1435 silent_cerr(
"\"end: control data;\" expected at line "
1443 silent_cerr(
"semicolon expected at line "
1450 if (bNetCDFnoText) {
1454 #endif // USE_NETCDF
1471 iOutputFrequency = 1;
1480 if (iOutputFrequency == 0) {
1481 OutHdl.
Log() <<
"output frequency: custom" << std::endl;
1484 OutHdl.
Log() <<
"output frequency: " << iOutputFrequency << std::endl;
1518 <<
") already defined" << std::endl);
1526 <<
"): initial value specified without "
1527 "\"value\" keyword (deprecated)" << std::endl);
1531 <<
" is supplied" << std::endl);
1547 "Initial derivative value xp = "
1548 << dXP <<
" is supplied" << std::endl);
1562 const char* sKeyWords[] = {
1608 NodeVecType::iterator ni =
Nodes.begin();
1612 if (CurrDesc ==
OUTPUT) {
1653 silent_cerr(
"Error: unknown node type, cannot modify output"
1659 while (HP.
IsArg()) {
1661 unsigned int uL = (
unsigned int)HP.
GetInt();
1662 unsigned int uEndL = (
unsigned int)HP.
GetInt();
1665 silent_cerr(
"End label " << uEndL
1666 <<
" must be larger "
1667 "than or equal to start label " << uL
1672 for (; uL <= uEndL; uL++) {
1676 "node " << uL << std::endl);
1682 unsigned int uL = (
unsigned int)HP.
GetInt();
1687 <<
"(" << uL <<
") "
1688 "is not defined (ignored); "
1689 "output cannot be modified "
1704 unsigned int uLabel = 0;
1705 if (CurrDesc >= 0) {
1706 uLabel = unsigned(HP.
GetInt());
1752 silent_cout(
"Reading "
1762 "exceeds structural nodes number"
1773 "already defined" << std::endl);
1794 silent_cout(
"Reading "
1795 <<
psNodeNames[
Node::ELECTRIC] <<
"(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")"
1805 "exceeds declared number" << std::endl);
1834 silent_cout(
"Reading "
1835 <<
psNodeNames[
Node::THERMAL] <<
"(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")"
1845 "exceeds declared number" << std::endl);
1875 silent_cout(
"Reading "
1876 <<
psNodeNames[
Node::ABSTRACT] <<
"(" << uLabel << ( sName.empty() ?
"" : ( std::string(
", \"") + sName +
"\"" ) ) <<
")"
1879 bool bAlgebraic(
false);
1888 "exceeds declared number" << std::endl);
1895 }
else if (!HP.
IsKeyWord(
"differential")) {
1896 pedantic_cout(
"unspecified "
1899 "assuming \"differential\"" << std::endl);
1940 silent_cout(
"Reading "
1950 "exceeds parameters number" << std::endl);
1960 "already defined" << std::endl);
1971 "will be linked to an element" << std::endl);
1979 }
else if (HP.
IsKeyWord(
"sample" "and" "hold") ||
1985 "is a sample-and-hold" << std::endl);
1995 silent_cerr(
"illegal sample period "
1996 "for SampleAndHold(" << uLabel <<
") "
2008 SD.
pNode, pDC, dSP, fOut));
2011 }
else if (HP.
IsKeyWord(
"strain" "gage")
2012 || HP.
IsKeyWord(
"beam" "strain" "gage"))
2016 "is a strain gage" << std::endl);
2037 pedantic_cerr(
"ParameterNode(" << uLabel <<
"): "
2038 "initial value specified without "
2039 "\"value\" keyword (deprecated)" << std::endl);
2043 "Initial value x = " << dX
2044 <<
" is supplied" << std::endl);
2063 silent_cout(
"Reading "
2074 "exceeds declared number" << std::endl);
2107 silent_cerr(
"unknown node type at line "
2113 silent_cerr(
"node type " << sKeyWords[CurrDesc]
2115 <<
" is not allowed" << std::endl);
2123 silent_cerr(
"error in allocation "
2124 "of " <<
psNodeNames[CurrDesc] <<
"(" << uLabel <<
")"
2130 if (!sName.empty()) {
2131 (*ppN)->PutName(sName);
2144 silent_cerr(
"\"end: nodes;\" expected at line "
2153 silent_cerr(
"semicolon expected at line "
2159 if (iMissingNodes > 0) {
2161 silent_cerr(
"warning: " << iMissingNodes
2162 <<
" nodes are missing;" << std::endl);
2164 if (iNumTypes[iCnt] > 0) {
2165 silent_cerr(
" " << iNumTypes[iCnt]
2174 unsigned iNumNodes = 0;
2192 const char* sKeyWords[] = {
2229 unsigned int uLabel = 0;
2230 if (CurrDesc >= 0) {
2231 uLabel = unsigned(HP.
GetInt());
2238 silent_cout(
"Reading "
2246 "exceeds file drivers number" << std::endl);
2263 silent_cerr(
"unknown drive type at line "
2272 silent_cerr(
"error in allocation "
2284 silent_cerr(
"\"end: drivers;\" expected at line "
2292 silent_cerr(
"semicolon expected at line "
2297 if (iMissingDrivers > 0) {
2298 silent_cerr(
"warning, " << iMissingDrivers
2299 <<
" drivers are missing" << std::endl);
2313 silent_cerr(
"DataManager::ReadNode: invalid node label " << iNode
2317 unsigned int uNode = (
unsigned int)iNode;
2324 silent_cerr(
"DataManager::ReadNode: " <<
psNodeNames[type] <<
"(" << uNode <<
")"
2325 " not defined at line "
2338 silent_cerr(
"DataManager::ReadElem: invalid node label " << iElem
2342 unsigned int uElem = (
unsigned int)iElem;
2349 silent_cerr(
"DataManager::ReadElem: " <<
psElemNames[type] <<
"(" << uElem <<
")"
2350 " not defined at line "
2373 if (iOrder < 0 || iOrder > 2) {
2375 <<
"(" << pNode->
GetLabel() <<
"): "
2376 "illegal order " << iOrder
2381 }
else if (iOrder == 2) {
2383 if (pStrNode == 0) {
2385 <<
"(" << pNode->
GetLabel() <<
"): "
2386 "order " << iOrder <<
" not allowed "
2399 <<
"): invalid order for index " << iIndex
2413 <<
"): unknown or illegal order for index " << iIndex << std::endl
2414 <<
"(hint: you may need to specify "
2415 "\"differential\" or \"algebraic\" or \"order <n>\" when referencing " << std::endl
2416 <<
"a generic degree of freedom at line "
2431 silent_cerr(
"ReadScalarDof: invalid node label " << iNode
2436 unsigned uNode = unsigned(iNode);
2442 silent_cerr(
"ReadScalarDof: unknown node type "
2451 silent_cerr(
psNodeNames[Type] <<
"(" << uNode <<
") not defined"
2457 unsigned int iMaxIndex = pNode->
iGetNumDof();
2460 if (bDof && iMaxIndex == 0) {
2461 silent_cerr(
psNodeNames[Type] <<
"(" << uNode <<
") must have dofs "
2467 unsigned int iIndex = 1;
2468 if (iMaxIndex > 1) {
2470 if (iIndex < 1 || iIndex > iMaxIndex) {
2471 silent_cerr(
"Illegal index " << iIndex <<
", "
2473 "has only " << iMaxIndex <<
" dofs "
2490 if (iMaxIndex > 1) {
2491 NodeDof nd(iIndex - 1, pNode);
2498 return ScalarDof(dynamic_cast<ScalarNode *>(pNode), iOrder, iIndex);
2509 }
else if (HP.
IsKeyWord(
"euler" "313")) {
2512 }
else if (HP.
IsKeyWord(
"euler" "321")) {
2515 }
else if (HP.
IsKeyWord(
"orientation" "vector")) {
2518 }
else if (HP.
IsKeyWord(
"orientation" "matrix")) {
2522 silent_cerr(
"Unknown orientation description "
2535 if (HP.
IsKeyWord(
"orientation" "description")) {
2538 }
else if (pDM != 0) {
2544 silent_cerr(
"Warning, data manager not defined yet, "
2545 "using default orientation (\"euler 123\") "
flag fReadOutput(MBDynParser &HP, const T &t) const
void ReadLinSol(LinSol &cs, HighParser &HP, bool bAllowEmpty)
void SetNetCDF(const OutputHandler::OutFiles out)
unsigned int iExpectedNum
void module_initialize(void)
const Vec3 Zero3(0., 0., 0.)
const char * psReadNodesNodes[]
#define MBDYN_EXCEPT_ARGS
integer iGetSteps(void) const
#define DEBUGCOUTFNAME(fname)
virtual integer GetInt(integer iDefval=0)
Mat3x3 GetRotAbs(const ReferenceFrame &rf)
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
void ReadControl(MBDynParser &HP, const char *sInputFileName)
OrientationDescription ReadOrientationDescription(MBDynParser &HP)
doublereal dInitialPositionStiffness
#define SAFEDELETEARR(pnt)
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
void ReadNodes(MBDynParser &HP)
doublereal dGetDefaultScale(DofOwner::Type t) const
integer iMaxInitialIterations
Drive * ReadDriveData(unsigned uLabel, const DataManager *pDM, MBDynParser &HP)
const char * psReadControlDrivers[]
NodeContainerType NodeContainer
int ReadScalarDifferentialNode(MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX, doublereal &dXP) const
void ReadBeamCustomOutput(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, Beam::Type BT, unsigned &uFlags, OrientationDescription &od)
int ReadScalarAlgebraicNode(MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX) const
bool bSkipInitialJointAssembly
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
void ReadDrivers(MBDynParser &HP)
doublereal dReadScale(MBDynParser &HP, enum DofOwner::Type t) const
void SetScale(const doublereal &d)
void ReadAerodynamicCustomOutput(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, unsigned &uFlags, OrientationDescription &od)
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)
TplDriveCaller< Vec3 > * ReadDC3D(const DataManager *pDM, MBDynParser &HP)
void SetPrecision(int iNewPrecision)
#define SAFENEW(pnt, item)
DriveCaller * pOutputMeter
bool IsExactlySame(const Mat3x3 &m) const
virtual bool IsKeyWord(const char *sKeyWord)
RigidBodyKinematics * pRBK
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
Vec3 GetPosAbs(const ReferenceFrame &rf)
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
virtual DofOrder::Order GetDofType(unsigned int i) const =0
doublereal dInitialAssemblyTol
integer iRestartIterations
#define ASSERT(expression)
OrientationDescription od
OrientationDescription ReadOptionalOrientationDescription(DataManager *pDM, MBDynParser &HP)
OrientationDescription GetOrientationDescription(void) const
bool bInitialJointAssemblyToBeDone
const char * psReadControlNodes[]
doublereal dInitialVelocityStiffness
const doublereal dDefaultInitialStiffness
bool bOutput(ResType t) const
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
static int iNumTypes[Elem::LASTELEMTYPE]
const integer iDefaultMaxInitialIterations
virtual bool ComputeAccelerations(bool b)
static int GetDofOrder(MBDynParser &HP, Node *pNode, int iIndex)
Vec3 GetVecAbs(const ReferenceFrame &rf)
virtual unsigned int iGetNumDof(void) const =0
const char * psNodeNames[]
virtual bool GetYesNo(bool &bRet)
virtual Node::Type GetNodeType(void) const =0
ScalarDof ReadScalarDof(const DataManager *pDM, MBDynParser &HP, bool bDof, bool bOrder)
doublereal * pdRestartTimes
const char * psElemNames[]
virtual int GetWord(void)
void ToBeUsedInAssembly(bool b)
Node * ReadStructNode(DataManager *pDM, MBDynParser &HP, DofOwner *pDO, unsigned int uLabel)
#define SAFESTRDUP(pnt, src)
const char * psReadControlElems[]
Node ** InsertNode(NodeDataStructure &nodedata, unsigned int uLabel, Node *pN)
unsigned int iExpectedNum
#define SAFENEWARR(pnt, item, sz)
void SetDataManager(DataManager *pdm)
std::ostream & Log(void) const
DriveCaller * GetDriveCaller(bool bDeferred=false)
const doublereal dDefaultInitialAssemblyTol
virtual void SetOutputFlag(flag f=flag(1))
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
virtual HighParser::ErrOut GetLineData(void) const
unsigned int GetLabel(void) const
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
Node * pFindNode(Node::Type Typ, unsigned int uNode) const
Node * ReadNode(MBDynParser &HP, Node::Type type) const
#define DEBUGLCOUT(level, msg)
TplDriveCaller< Vec3 > * ReadDCVecRel(const DataManager *pDM, MBDynParser &HP, const ReferenceFrame &rf)
virtual doublereal GetReal(const doublereal &dDefval=0.0)
const char * psDriveNames[]