MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
DataManager Class Reference

#include <dataman.h>

Inheritance diagram for DataManager:
Collaboration diagram for DataManager:

Classes

struct  ElemDataStructure
 
struct  ElemRead
 
struct  NodeDataStructure
 
struct  NodeRead
 

Public Types

enum  eRestart {
  NEVER, ATEND, ITERATIONS, TIME,
  TIMES
}
 
enum  ResType { RES_NONE = 0x00, RES_TEXT = 0x01, RES_NETCDF = 0x02 }
 
enum  ModuleInsertMode { MIM_FAIL, MIM_REPLACE, MIM_IGNORE }
 
enum  DerivationTable {
  ELEM = 0x0U, DOFOWNER = 0x1U, GRAVITYOWNER = 0x2U, AIRPROPOWNER = 0x4U,
  INITIALASSEMBLY = 0x8U
}
 
enum  DataFlags {
  NONE = 0x00U, ISUNIQUE = 0x01U, TOBEUSEDINASSEMBLY = 0x02U, GENERATESINERTIAFORCES = 0x04U,
  USESAIRPROPERTIES = 0x08U, DEFAULTOUT = 0x10U
}
 
typedef std::map< std::string,
DataManager::ElemRead
*, ltstrcase
ElemReadType
 
typedef std::pair< unsigned,
Elem * > 
KeyElemPair
 
typedef std::list< KeyElemPairElemContainerType
 
typedef std::map< unsigned,
ElemContainerType::iterator > 
ElemMapToListType
 
typedef std::map< std::string,
DataManager::NodeRead
*, ltstrcase
NodeReadType
 
typedef std::pair< unsigned,
Node * > 
KeyNodePair
 
typedef std::list< KeyNodePairNodeContainerType
 
typedef std::map< unsigned,
NodeContainerType::iterator > 
NodeMapToListType
 
typedef std::vector< DofDofVecType
 
typedef DofVecType::const_iterator DofIterator_const
 
typedef DofVecType::iterator DofIterator
 

Public Member Functions

bool bOutput (ResType t) const
 
template<class T >
flag fReadOutput (MBDynParser &HP, const T &t) const
 
doublereal dReadScale (MBDynParser &HP, enum DofOwner::Type t) const
 
bool bOutputAccelerations (void) const
 
bool bOutputDriveCallers (void) const
 
const doublerealdGetInitialPositionStiffness (void) const
 
const doublerealdGetInitialVelocityStiffness (void) const
 
bool bDoesOmegaRotate (void) const
 
void IncElemCount (Elem::Type type)
 
virtual clock_t GetCPUTime (void) const
 
 DataManager (MBDynParser &HP, unsigned OF, Solver *pS, doublereal dInitialTime, const char *sOutputFileName, const char *sInputFileName, bool bAbortAfterInput)
 
virtual ~DataManager (void)
 
int Cleanup (void)
 
int ReadScalarAlgebraicNode (MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX) const
 
int ReadScalarDifferentialNode (MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX, doublereal &dXP) const
 
NodeReadNode (MBDynParser &HP, Node::Type type) const
 
ElemReadElem (MBDynParser &HP, Elem::Type type) const
 
template<class Tbase , Node::Type type>
Tbase * ReadNode (MBDynParser &HP) const
 
template<class Tder , class Tbase , Node::Type type>
Tder * ReadNode (MBDynParser &HP) const
 
template<class Tbase , Elem::Type type>
Tbase * ReadElem (MBDynParser &HP) const
 
template<class Tder , class Tbase , Elem::Type type>
Tder * ReadElem (MBDynParser &HP) const
 
void SetTime (const doublereal &dTime, const doublereal &dTimeStep=-1., const integer &iStep=-1, bool bServePending=true)
 
doublereal dGetTime (void) const
 
NamedValueInsertSym (const char *const s, const Real &v, int redefine=0)
 
NamedValueInsertSym (const char *const s, const Int &v, int redefine=0)
 
void LinkToSolution (VectorHandler &XCurr, VectorHandler &XPrimeCurr)
 
void LinkToSolution (VectorHandler &XCurr, VectorHandler &XPrimeCurr, VectorHandler &XPrimePrimeCurr, VectorHandler &LambdaCurr)
 
std::ostream & GetOutFile (void) const
 
std::ostream & GetLogFile (void) const
 
const OutputHandlerpGetOutHdl (void) const
 
void SetOrientationDescription (OrientationDescription)
 
OrientationDescription GetOrientationDescription (void) const
 
void SetOutput (Elem::Type t, unsigned, OrientationDescription)
 
void GetOutput (Elem::Type t, unsigned &, OrientationDescription &) const
 
const DriveHandlerpGetDrvHdl (void) const
 
MathParserGetMathParser (void) const
 
MBDynParserGetMBDynParser (void) const
 
const SolverGetSolver (void) const
 
bool PushCurrData (const std::string &name, const TypedValue &value)
 
bool PopCurrData (const std::string &name)
 
virtual void AssJac (MatrixHandler &JacHdl, doublereal dCoef)
 
virtual void AssMats (MatrixHandler &A_Hdl, MatrixHandler &B_Hdl)
 
virtual void AssRes (VectorHandler &ResHdl, doublereal dCoef)
 
virtual void AssConstrRes (VectorHandler &ResHdl, InverseDynamics::Order iOrder)
 
virtual void AssRes (VectorHandler &ResHdl)
 
virtual void AssConstrJac (MatrixHandler &JacHdl)
 
unsigned ConvergedRegister (void)
 
void ConvergedSet (unsigned idx, Converged::State s)
 
bool IsConverged (void) const
 
bool EndOfSimulation (void) const
 
virtual void OutputPrepare (void)
 
virtual void OutputEigPrepare (const integer iNumAnalyses, const integer iSize)
 
virtual bool Output (long lStep, const doublereal &dTime, const doublereal &dTimeStep, bool force=false) const
 
virtual void Output (const VectorHandler &X, const VectorHandler &XP) const
 
void OutputOpen (const OutputHandler::OutFiles out)
 
void OutputEigOpen (const std::string &postfix)
 
void OutputEigParams (const doublereal &dTime, const doublereal &dCoef, const unsigned uCurrEigSol, const int iResultsPrecision)
 
void OutputEigFullMatrices (const MatrixHandler *pmMatA, const MatrixHandler *pmMatB, const unsigned uCurrEigSol, const int iMatrixPrecision)
 
void OutputEigSparseMatrices (const MatrixHandler *pmMatA, const MatrixHandler *pmMatB, const unsigned uCurrEigSol, const int iMatrixPrecision)
 
void OutputEigNaiveMatrices (const MatrixHandler *pmMatA, const MatrixHandler *pmMatB, const unsigned uCurrEigSol, const int iMatrixPrecision)
 
void OutputEigenvectors (const VectorHandler *pBeta, const VectorHandler &R, const VectorHandler &I, const doublereal &dShiftR, const MatrixHandler *pVL, const MatrixHandler &VR, const std::vector< bool > &vOut, const unsigned uCurrEigSol, const int iResultsPrecision)
 
void OutputEigGeometry (const unsigned uCurrSol, const int iResultsPrecision)
 
bool OutputEigClose (void)
 
void SetValue (VectorHandler &X, VectorHandler &XP)
 
virtual void MakeRestart (void)
 
virtual void DerivativesUpdate (void) const
 
virtual void BeforePredict (VectorHandler &X, VectorHandler &XP, VectorHandler &XPrev, VectorHandler &XPPrev) const
 
virtual void AfterPredict (void) const
 
virtual void Update (void) const
 
virtual void AfterConvergence (void) const
 
virtual void Update (InverseDynamics::Order iOrder) const
 
virtual void IDAfterConvergence (void) const
 
virtual void IDSetTest (NonlinearSolverTestRange *pResTest, NonlinearSolverTestRange *pSolTest, bool bFullResTest)
 
void bSetStaticModel (bool b)
 
bool bIsStaticModel (void) const
 
const RigidBodyKinematicspGetRBK (void) const
 
void bSetInverseDynamics (bool b)
 
bool bIsInverseDynamics (void) const
 
const LoadableCallsGetLoadableElemModule (std::string) const
 
void SetLoadableElemModule (std::string, const LoadableCalls *, ModuleInsertMode=MIM_FAIL)
 
DrivepFindDrive (Drive::Type Typ, unsigned int uL) const
 
ElempFindElem (Elem::Type Typ, unsigned int uElem=unsigned(-1)) const
 
template<class Tbase , Elem::Type type>
Tbase * pFindElem (unsigned int uElem=unsigned(-1)) const
 
template<class Tder , class Tbase , Elem::Type type>
Tder * pFindElem (unsigned int uElem=unsigned(-1)) const
 
const
DataManager::ElemDataStructure
GetElemDataStructure (Elem::Type Typ) const
 
std::vector< doublereal > & GetBufIn (unsigned uL)
 
const std::vector< doublereal > & GetBufOut (unsigned uL) const
 
doublerealGetBufInRaw (unsigned uL)
 
void SetBufInRaw (unsigned uL, integer n, const doublereal *p)
 
const doublerealGetBufOutRaw (unsigned uL) const
 
void SetBufOutRaw (unsigned uL, integer n, const doublereal *p)
 
void ElemManager (void)
 
void ElemManagerDestructor (void)
 
void ElemDataInit (void)
 
void ElemAssInit (void)
 
void ElemOutputPrepare (OutputHandler &OH)
 
void ElemOutput (OutputHandler &OH) const
 
void ElemOutput (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
void DriveOutput (OutputHandler &OH) const
 
void DriveTrace (OutputHandler &OH) const
 
DataManager::ElemContainerType::const_iterator begin (Elem::Type t) const
 
DataManager::ElemContainerType::const_iterator end (Elem::Type t) const
 
Node ** ppFindNode (Node::Type Typ, unsigned int uNode) const
 
NodepFindNode (Node::Type Typ, unsigned int uNode) const
 
template<class Tbase , Node::Type type>
Tbase * pFindNode (unsigned int uNode) const
 
template<class Tder , class Tbase , Node::Type type>
Tder * pFindNode (unsigned int uNode) const
 
void NodeManager (void)
 
void NodeManagerDestructor (void)
 
void NodeDataInit (void)
 
DataManager::NodeContainerType::const_iterator begin (Node::Type t) const
 
DataManager::NodeContainerType::const_iterator end (Node::Type t) const
 
void NodeOutputPrepare (OutputHandler &OH)
 
void NodeOutput (OutputHandler &OH) const
 
void NodeOutput (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
const DofVecTypeGetDofs (void) const
 
integer iGetNumDofs (void) const
 
void DofManager (void)
 
void DofManagerDestructor (void)
 
void DofDataInit (void)
 
void DofInit (void)
 
void IDDofInit (void)
 
int iIDGetNodeTotNumDofs (void) const
 
int iIDGetJointTotNumDofs (void) const
 
int iIDGetTotNumDofs (void) const
 
void SetScale (VectorHandler &XScale) const
 
const VectorHandlerGetpXCurr (void) const
 
const VectorHandlerGetpXPCurr (void) const
 
virtual void PrintResidual (const VectorHandler &Res, integer iIterCnt) const
 
virtual void PrintSolution (const VectorHandler &Sol, integer iIterCnt) const
 
virtual const std::string & GetDofDescription (int i) const
 
virtual const std::string & GetEqDescription (int i) const
 
virtual DofOrder::Order GetDofType (int i) const
 
virtual DofOrder::Order GetEqType (int i) const
 
- Public Member Functions inherited from SolutionDataManager
virtual ~SolutionDataManager (void)
 
- Public Member Functions inherited from SolverDiagnostics
 SolverDiagnostics (unsigned OF=OUTPUT_DEFAULT, DriveCaller *pOM=0)
 
virtual ~SolverDiagnostics (void)
 
void SetNoOutput (void)
 
void SetOutputMeter (DriveCaller *pOM)
 
void SetOutputDriveHandler (const DriveHandler *pDH)
 
void SetOutputFlags (unsigned OF)
 
void AddOutputFlags (unsigned OF)
 
void DelOutputFlags (unsigned OF)
 
MatrixHandler::Norm_t GetCondMatNorm (void) const
 
bool outputMeter (void) const
 
bool outputIters (void) const
 
bool outputRes (void) const
 
bool outputSol (void) const
 
bool outputJac (void) const
 
bool outputStep (void) const
 
bool outputBailout (void) const
 
bool outputCounter (void) const
 
bool outputMatrixConditionNumber (void) const
 
bool outputSolverConditionNumber (void) const
 
bool outputSolverConditionStat (void) const
 
bool outputCPUTime (void) const
 
bool outputMsg (void) const
 

Protected Types

enum  PrintFlags {
  PRINT_NONE = 0x00U, PRINT_DOF_STATS = 0x01U, PRINT_DOF_DESCRIPTION = 0x02U, PRINT_EQ_DESCRIPTION = 0x04U,
  PRINT_DESCRIPTION = (PRINT_DOF_DESCRIPTION|PRINT_EQ_DESCRIPTION), PRINT_NODE_CONNECTION = 0x10U, PRINT_EL_CONNECTION = 0x20U, PRINT_CONNECTION = (PRINT_NODE_CONNECTION|PRINT_EL_CONNECTION),
  PRINT_TO_FILE = 0x1000U
}
 
typedef std::vector
< Converged::State
Converged_t
 
typedef std::vector< Elem * > ElemVecType
 
typedef std::vector< Node * > NodeVecType
 
- Protected Types inherited from SolverDiagnostics
enum  {
  OUTPUT_NONE = 0x0000, OUTPUT_ITERS = 0x0001, OUTPUT_RES = 0x0002, OUTPUT_SOL = 0x0004,
  OUTPUT_JAC = 0x0008, OUTPUT_BAILOUT = 0x0010, OUTPUT_MSG = 0x0020, OUTPUT_COUNTER = 0x0040,
  OUTPUT_MAT_COND_NUM_1 = 0x0080, OUTPUT_MAT_COND_NUM_INF = 0x0100, OUTPUT_SOLVER_COND_NUM = 0x0200, OUTPUT_SOLVER_COND_STAT = 0x400,
  OUTPUT_CPU_TIME = 0x800, OUTPUT_MAT_COND_NUM = OUTPUT_MAT_COND_NUM_1 | OUTPUT_MAT_COND_NUM_INF, OUTPUT_DEFAULT = OUTPUT_MSG, OUTPUT_STEP = (OUTPUT_ITERS | OUTPUT_RES | OUTPUT_SOL | OUTPUT_JAC | OUTPUT_MAT_COND_NUM | OUTPUT_SOLVER_COND_NUM),
  OUTPUT_MASK = 0x07FF
}
 

Protected Member Functions

void ReadControl (MBDynParser &HP, const char *sInputFileName)
 
void ReadNodes (MBDynParser &HP)
 
void ReadDrivers (MBDynParser &HP)
 
void ReadElems (MBDynParser &HP)
 
template<class T >
T * Cast (Elem *pEl, bool bActive=false)
 
void InitialJointAssembly (void)
 
void DofOwnerSet (void)
 
void DofOwnerInit (void)
 
void IDDofOwnerSet (void)
 
virtual void AssJac (MatrixHandler &JacHdl, doublereal dCoef, VecIter< Elem * > &Iter, VariableSubMatrixHandler &WorkMat)
 
virtual void AssMats (MatrixHandler &A_Hdl, MatrixHandler &B_Hdl, VecIter< Elem * > &Iter, VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB)
 
virtual void AssRes (VectorHandler &ResHdl, doublereal dCoef, VecIter< Elem * > &Iter, SubVectorHandler &WorkVec)
 
void AssConstrJac (MatrixHandler &JacHdl, VecIter< Elem * > &Iter, VariableSubMatrixHandler &WorkMat)
 
void AssConstrRes (VectorHandler &ResHdl, VecIter< Elem * > &Iter, SubVectorHandler &WorkVec, InverseDynamics::Order iOrder)
 
void AssRes (VectorHandler &ResHdl, VecIter< Elem * > &Iter, SubVectorHandler &WorkVec)
 
Elem ** InsertElem (ElemDataStructure &eldata, unsigned int uLabel, Elem *pE)
 
ElempFindElem (Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
 
ElempChooseElem (Elem *p, unsigned int iDeriv) const
 
Elem ** ppFindElem (Elem::Type Typ, unsigned int uElem) const
 
flag fGetDefaultOutputFlag (const Elem::Type &t) const
 
Elem ** ReadOneElem (MBDynParser &HP, unsigned int uLabel, const std::string &sName, int CurrType)
 
Node ** InsertNode (NodeDataStructure &nodedata, unsigned int uLabel, Node *pN)
 
flag fGetDefaultOutputFlag (const Node::Type &t) const
 
doublereal dGetDefaultScale (DofOwner::Type t) const
 

Protected Attributes

void ** ppCleanupData
 
MBDynParserMBPar
 
MathParserMathPar
 
SolverpSolver
 
std::map< std::string, const
LoadableCalls * > 
MapOfLoadableElemHandlers
 
DriveHandler DrvHdl
 
OutputHandler OutHdl
 
VectorHandlerpXCurr
 
VectorHandlerpXPrimeCurr
 
VectorHandlerpXPrimePrimeCurr
 
VectorHandlerpLambdaCurr
 
bool bInitialJointAssemblyToBeDone
 
bool bSkipInitialJointAssembly
 
bool bOutputFrames
 
bool bOutputAccels
 
bool bOutputDriveCaller
 
doublereal dInitialPositionStiffness
 
doublereal dInitialVelocityStiffness
 
bool bOmegaRotates
 
doublereal dInitialAssemblyTol
 
integer iMaxInitialIterations
 
doublereal dEpsilon
 
LinSol CurrSolver
 
RigidBodyKinematicspRBK
 
bool bStaticModel
 
bool bInverseDynamics
 
int iIDNodeTotNumDofs
 
int iIDJointTotNumDofs
 
unsigned uPrintFlags
 
char * sSimulationTitle
 
eRestart RestartEvery
 
integer iRestartIterations
 
doublereal dRestartTime
 
doublerealpdRestartTimes
 
integer iNumRestartTimes
 
integer iCurrRestartTime
 
integer iCurrRestartIter
 
doublereal dLastRestartTime
 
bool saveXSol
 
char * solArrFileName
 
DriveCallerpOutputMeter
 
integer iOutputCount
 
int ResMode
 
OrientationDescription od
 
Converged_t m_IsConverged
 
struct
DataManager::ElemDataStructure 
ElemData [Elem::LASTELEMTYPE]
 
ElemVecType Elems
 
VecIter< Elem * > ElemIter
 
struct {
   Drive **   ppFirstDrive
 
   unsigned int   iNum
 
DriveData [Drive::LASTDRIVETYPE]
 
Drive ** ppDrive
 
unsigned int iTotDrive
 
integer iMaxWorkNumRowsRes
 
integer iMaxWorkNumRowsJac
 
integer iMaxWorkNumColsJac
 
integer iMaxWorkNumItemsJac
 
VariableSubMatrixHandlerpWorkMatA
 
VariableSubMatrixHandlerpWorkMatB
 
VariableSubMatrixHandlerpWorkMat
 
MySubVectorHandlerpWorkVec
 
struct
DataManager::NodeDataStructure 
NodeData [Node::LASTNODETYPE]
 
NodeVecType Nodes
 
unsigned int iTotNodes
 
struct {
   DofOwner *   pFirstDofOwner
 
   integer   iNum
 
   integer   iSize
 
   doublereal   dDefScale
 
DofData [DofOwner::LASTDOFTYPE]
 
integer iTotDofOwners
 
std::vector< DofOwnerDofOwners
 
integer iTotDofs
 
DofVecType Dofs
 
DofOwner DummyDofOwner
 
- Protected Attributes inherited from SolverDiagnostics
unsigned OutputFlags
 
DriveCallerpOutputMeter
 

Friends

class InitialAssemblyIterator
 

Detailed Description

Definition at line 85 of file dataman.h.

Member Typedef Documentation

Definition at line 398 of file dataman.h.

typedef DofVecType::iterator DataManager::DofIterator

Definition at line 803 of file dataman.h.

typedef DofVecType::const_iterator DataManager::DofIterator_const

Definition at line 802 of file dataman.h.

Definition at line 801 of file dataman.h.

Definition at line 554 of file dataman.h.

typedef std::map<unsigned, ElemContainerType::iterator> DataManager::ElemMapToListType

Definition at line 555 of file dataman.h.

typedef std::map<std::string, DataManager::ElemRead *, ltstrcase> DataManager::ElemReadType

Definition at line 552 of file dataman.h.

Definition at line 599 of file dataman.h.

typedef std::pair<unsigned, Elem*> DataManager::KeyElemPair

Definition at line 553 of file dataman.h.

typedef std::pair<unsigned, Node*> DataManager::KeyNodePair

Definition at line 708 of file dataman.h.

Definition at line 709 of file dataman.h.

typedef std::map<unsigned, NodeContainerType::iterator> DataManager::NodeMapToListType

Definition at line 710 of file dataman.h.

typedef std::map<std::string, DataManager::NodeRead *, ltstrcase> DataManager::NodeReadType

Definition at line 707 of file dataman.h.

Definition at line 739 of file dataman.h.

Member Enumeration Documentation

Enumerator
NONE 
ISUNIQUE 
TOBEUSEDINASSEMBLY 
GENERATESINERTIAFORCES 
USESAIRPROPERTIES 
DEFAULTOUT 

Definition at line 535 of file dataman.h.

Enumerator
ELEM 
DOFOWNER 
GRAVITYOWNER 
AIRPROPOWNER 
INITIALASSEMBLY 

Definition at line 526 of file dataman.h.

526  {
527  ELEM = 0x0U, // pleonastico
528  DOFOWNER = 0x1U,
529  GRAVITYOWNER = 0x2U,
530  AIRPROPOWNER = 0x4U,
531  INITIALASSEMBLY = 0x8U
532  };
Enumerator
NEVER 
ATEND 
ITERATIONS 
TIME 
TIMES 

Definition at line 161 of file dataman.h.

Enumerator
MIM_FAIL 
MIM_REPLACE 
MIM_IGNORE 

Definition at line 513 of file dataman.h.

enum DataManager::PrintFlags
protected
Enumerator
PRINT_NONE 
PRINT_DOF_STATS 
PRINT_DOF_DESCRIPTION 
PRINT_EQ_DESCRIPTION 
PRINT_DESCRIPTION 
PRINT_NODE_CONNECTION 
PRINT_EL_CONNECTION 
PRINT_CONNECTION 
PRINT_TO_FILE 

Definition at line 141 of file dataman.h.

Enumerator
RES_NONE 
RES_TEXT 
RES_NETCDF 

Definition at line 192 of file dataman.h.

192  {
193  RES_NONE = 0x00,
194  RES_TEXT = 0x01,
195  RES_NETCDF = 0x02,
196  };

Constructor & Destructor Documentation

DataManager::DataManager ( MBDynParser HP,
unsigned  OF,
Solver pS,
doublereal  dInitialTime,
const char *  sOutputFileName,
const char *  sInputFileName,
bool  bAbortAfterInput 
)

Definition at line 90 of file dataman.cc.

References bInitialJointAssemblyToBeDone, bInverseDynamics, bOutputFrames, bSkipInitialJointAssembly, datamanager_cleanup(), DEBUG_LEVEL_MATCH, DEBUGCERR, DEBUGCOUTFNAME, DEBUGLCOUT, dof_plugin(), DofData, DofDataInit(), DofInit(), DofManager(), DofOwnerInit(), DofOwners, DofOwnerSet(), Dofs, OutputHandler::DRIVECALLERS, DriveData, elem_priv_plugin(), ElemAssInit(), DataManager::ElemDataStructure::ElemContainer, ElemData, ElemDataInit(), ELEMENTS, ElemManager(), Elems, HighParser::GetDescription(), MBDynParser::GetDriveCallerContainer(), IncludeParser::GetLineData(), HighParser::GetMathParser(), MathParser::GetSymbolTable(), HighParser::GetWord(), IDDofInit(), IDDofOwnerSet(), InitDriveData(), InitGustData(), InitialJointAssembly(), InitUDE(), iTotDofs, iTotDrive, iTotNodes, DofOwner::LASTDOFTYPE, Drive::LASTDRIVETYPE, Elem::LASTELEMTYPE, LASTKEYWORD, Node::LASTNODETYPE, MathPar, mbdyn_cleanup_register(), MBDYN_EXCEPT_ARGS, MBPar, MYDEBUG_INIT, NO_OP, node_priv_plugin(), DataManager::NodeDataStructure::NodeContainer, NodeData, NodeDataInit(), NodeManager(), OutputHandler::Open(), OutHdl, OUTPUT, MBDynParser::OutputFrames(), ppCleanupData, psDofOwnerNames, psDriveNames, psElemNames, psNodeNames, ReadControl(), ReadDrivers(), ReadElems(), ReadNodes(), OutputHandler::REFERENCEFRAMES, OutputHandler::ReferenceFrames(), MathParser::RegisterNameSpace(), MathParser::RegisterPlugIn(), OutputHandler::SetExceptions(), SetTime(), OutputHandler::TRACES, and OutputHandler::UNKNOWN.

97 :
99 #ifdef USE_MULTITHREAD
100 nThreads(0),
101 #endif /* USE_MULTITHREAD */
102 MBPar(HP),
103 MathPar(HP.GetMathParser()),
104 pSolver(pS),
105 DrvHdl(HP.GetMathParser()),
106 OutHdl(sOutputFileName, 0),
107 pXCurr(0), pXPrimeCurr(0),
108 /* Inverse Dynamics: */
110 pLambdaCurr(0),
113 bOutputFrames(false),
114 bOutputAccels(false),
115 bOutputDriveCaller(false),
121 dEpsilon(1.),
123 pRBK(0),
124 bStaticModel(false),
125 /* auto-detect if running inverse dynamics */
126 bInverseDynamics(dynamic_cast<InverseSolver *>(pS) != 0),
129 #if defined(USE_RUNTIME_LOADING)
130 moduleInitialized(false),
131 #endif // USE_RUNTIME_LOADING
132 uPrintFlags(PRINT_NONE), /* Morandini, 2003-11-17 */
136 dRestartTime(0.),
137 pdRestartTimes(0),
141 dLastRestartTime(dInitialTime),
142 saveXSol(false),
143 solArrFileName(0),
144 pOutputMeter(0),
145 iOutputCount(0),
146 #ifdef MBDYN_FDJAC
147 pFDJacMeter(0),
148 #endif // MBDYN_FDJAC
150 #ifdef USE_NETCDF
151 // NetCDF stuff
152 bNetCDFsync(false),
153 bNetCDFnoText(false),
154 Var_Step(0),
155 Var_Time(0),
156 Var_TimeStep(0),
157 Var_Eig_lStep(0),
158 Var_Eig_dTime(0),
159 Var_Eig_dCoef(0),
160 Var_Eig_dAplus(0),
161 Var_Eig_dAminus(0),
162 Var_Eig_dAlpha(0),
163 Var_Eig_Idx(0),
164 Var_Eig_dVR(0),
165 Var_Eig_dVL(0),
166 #endif // USE_NETCDF
167 od(EULER_123),
168 
169 #ifdef USE_SOCKET
170 SocketUsersTimeout(0),
171 #endif // USE_SOCKET
172 
173 /* ElemManager */
174 ElemIter(),
175 ppDrive(0),
176 iTotDrive(0),
177 iMaxWorkNumRowsRes(1), // Allocating a work space size >= 1 will be safe in any case
181 pWorkMatA(0),
182 pWorkMatB(0),
183 pWorkMat(0),
184 pWorkVec(0),
185 
186 /* NodeManager */
187 iTotNodes(0),
188 
189 /* DofManager */
190 iTotDofOwners(0),
191 DofOwners(),
192 iTotDofs(0),
193 Dofs()
194 {
195  DEBUGCOUTFNAME("DataManager::DataManager");
196 
198  *ppCleanupData = (void *)this;
199 
200  OutHdl.SetExceptions(std::ios::badbit); // terminate if disk is full
201 
202  /* pseudocostruttori */
203  ElemManager();
204  NodeManager();
205  DofManager();
206 
207  InitDriveData();
208  InitUDE();
209  InitGustData();
210 
211  /* registra il plugin per i dofs */
212  HP.GetMathParser().RegisterPlugIn("dof", dof_plugin, this);
213 
214  /* registra il plugin per i dati privati dei nodi */
215  HP.GetMathParser().RegisterPlugIn("node", node_priv_plugin, this);
216 
217  /* registra il plugin per i dati privati degli elementi */
218  HP.GetMathParser().RegisterPlugIn("element", elem_priv_plugin, this);
219 
220  /* registra il namespace del modello */
221 
223 
224  /* Setta il tempo al valore iniziale */
225  SetTime(dInitialTime, 0., 0, false);
226 
227  DEBUGLCOUT(MYDEBUG_INIT, "Global symbol table:"
228  << MathPar.GetSymbolTable() << std::endl);
229 
230  /*
231  * Possiede MathParser, con relativa SymbolTable.
232  * Crea ExternKeyTable, MBDynParser,
233  * e legge i dati esterni. Quindi, quando trova
234  * i dati di controllo, chiama la relativa
235  * funzione di lettura (distinta per comodita')
236  */
237 
238  /* parole chiave */
239  const char* sKeyWords[] = {
240  "begin",
241  "control" "data",
242  "scalar" "function",
243  "nodes",
244  "elements",
245  "drivers",
246  "output",
247  0
248  };
249 
250  /* enum delle parole chiave */
251  enum KeyWords {
252  BEGIN = 0,
253  CONTROLDATA,
254  SCALARFUNCTION,
255  NODES,
256  ELEMENTS,
257  DRIVERS,
258  OUTPUT,
260  };
261 
262  /* tabella delle parole chiave */
263  KeyTable K(HP, sKeyWords);
264 
265  KeyWords CurrDesc = KeyWords(HP.GetDescription());
266  /* legge i dati di controllo */
267  if (CurrDesc != BEGIN) {
268  DEBUGCERR("");
269  silent_cerr("<begin> expected at line "
270  << HP.GetLineData() << std::endl);
271 
273  }
274 
275  if (KeyWords(HP.GetWord()) != CONTROLDATA) {
276  DEBUGCERR("");
277  silent_cerr("<begin: control data;> expected at line "
278  << HP.GetLineData() << std::endl);
279 
281  }
282 
283  ReadControl(HP, sInputFileName);
284  try {
285  CurrDesc = KeyWords(HP.GetDescription());
286  } catch (EndOfFile) {
287  NO_OP;
288  }
289 
290  /* fine lettura dati di controllo */
291 
292 
293 
294  /*
295  * a questo punto ElemManager contiene i numeri totali di elementi;
296  * NodeManager contiene i numeri totali di nodi;
297  * DofManager contiene i numeri totali di potenziali possessori di gradi
298  * di liberta'; quindi si puo' cominciare ad allocare matrici
299  */
300 
301 
302 
303  /* Costruzione struttura DofData e creazione array DofOwner */
304  DofDataInit();
305 
306  /* Costruzione struttura NodeData e creazione array Node* */
307  NodeDataInit();
308 
309  /*
310  * legge i nodi, crea gli item della struttura ppNodes
311  * e contemporaneamente aggiorna i dof
312  */
313  if (iTotNodes > 0) {
314  if (CurrDesc != BEGIN) {
315  DEBUGCERR("");
316  silent_cerr("<begin> expected at line "
317  << HP.GetLineData() << std::endl);
318 
320  }
321 
322  if (KeyWords(HP.GetWord()) != NODES) {
323  DEBUGCERR("");
324  silent_cerr("<begin: nodes;> expected at line "
325  << HP.GetLineData() << std::endl);
326 
328  }
329 
330  ReadNodes(HP);
331  try {
332  CurrDesc = KeyWords(HP.GetDescription());
333  } catch (EndOfFile) {}
334  } else {
335  DEBUGCERR("");
336  silent_cerr("warning, no nodes are defined" << std::endl);
337  }
338  /* fine lettura nodi */
339 
340  /*
341  * Costruzione struttura ElemData, DriveData
342  * e creazione array Elem* e Drive*
343  */
344  ElemDataInit();
345 
346  /* legge i drivers, crea la struttura ppDrive */
347  bool bGotDrivers = false;
348  if (iTotDrive > 0) {
349  if (CurrDesc != BEGIN) {
350  DEBUGCERR("");
351  silent_cerr("\"begin\" expected at line "
352  << HP.GetLineData() << std::endl);
353 
355  }
356 
357  if (KeyWords(HP.GetWord()) != DRIVERS) {
358  DEBUGCERR("");
359  silent_cerr("\"begin: drivers;\" expected at line "
360  << HP.GetLineData() << std::endl);
361 
363  }
364 
365  bGotDrivers = true;
366 
367  ReadDrivers(HP);
368  try {
369  CurrDesc = KeyWords(HP.GetDescription());
370  } catch (EndOfFile) {}
371 
372  } else {
373  DEBUGCERR("warning, no drivers are defined" << std::endl);
374  }
375 
376  /* fine lettura drivers */
377 
378 
379  /*
380  * legge gli elementi, crea la struttura ppElems
381  * e contemporaneamente aggiorna i dof
382  */
383  if (!Elems.empty()) {
384  if (CurrDesc != BEGIN) {
385  DEBUGCERR("");
386  silent_cerr("\"begin\" expected at line "
387  << HP.GetLineData() << std::endl);
388 
390  }
391 
392  switch (KeyWords(HP.GetWord())) {
393  case ELEMENTS:
394  break;
395 
396  case DRIVERS:
397  if (!bGotDrivers) {
398  silent_cerr("got unexpected \"begin: drivers;\" "
399  "at line " << HP.GetLineData() << std::endl
400  << "(hint: define \"file drivers\" in \"control data\" block)"
401  << std::endl);
402  }
403  // fallthru
404 
405  default:
406  DEBUGCERR("");
407  silent_cerr("\"begin: elements;\" expected at line "
408  << HP.GetLineData() << std::endl);
409 
411  }
412 
413  ReadElems(HP);
414 #if 0
415  /* FIXME: we don't check extra statements after "end: elements;"
416  * because there might be more... */
417  try {
418  CurrDesc = KeyWords(HP.GetDescription());
419  } catch (EndOfFile) {}
420 #endif
421  } else {
422  DEBUGCERR("");
423  silent_cerr("warning, no elements are defined" << std::endl);
424  }
425 
426  if (bOutputFrames) {
429  }
430 
431  /* fine lettura elementi */
432 
433  // if output is defined and at least one node wants to output,
434  // open file
435  for (int i = 0; i < Node::LASTNODETYPE; i++) {
436  if (NodeData[i].OutFile != OutputHandler::UNKNOWN)
437  {
438  for (NodeContainerType::const_iterator n = NodeData[i].NodeContainer.begin();
439  n != NodeData[i].NodeContainer.end(); ++n)
440  {
441  if (n->second->bToBeOutput()) {
442  OutHdl.Open(NodeData[i].OutFile);
443  break;
444  }
445  }
446  }
447  }
448 
449  // if output is defined and at least one element wants to output,
450  // open file
451  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
452  if (ElemData[i].OutFile != OutputHandler::UNKNOWN)
453  {
454  for (ElemContainerType::const_iterator e = ElemData[i].ElemContainer.begin();
455  e != ElemData[i].ElemContainer.end(); ++e)
456  {
457  if (e->second->bToBeOutput()) {
458  OutHdl.Open(ElemData[i].OutFile);
459  break;
460  }
461  }
462  }
463  }
464 
465  // open drive output & trave files only if needed
467  for (MBDynParser::DCType::const_iterator i = DC.begin(); i != DC.end(); ++i) {
468  if (i->second->fToBeTraced()) {
470  break;
471  }
472  }
473 
474  for (MBDynParser::DCType::const_iterator i = DC.begin(); i != DC.end(); ++i) {
475  if (i->second->bToBeOutput()) {
477  break;
478  }
479  }
480 
481  /* Verifica dei dati di controllo */
482 #ifdef DEBUG
484  /* mostra in modo succinto il numero di DofOwner per tipo */
485  for (int i = 0; i < DofOwner::LASTDOFTYPE; i++) {
486  std::cout << "DofType " << i << " "
487  "(" << psDofOwnerNames[i] << "), "
488  "n. of owners: " << DofData[i].iNum
489  << std::endl;
490  }
491 
492  /* mostra in modo succinto il numero di nodi per tipo */
493  for (int i = 0; i < Node::LASTNODETYPE; i++) {
494  std::cout << "NodeType " << i << " "
495  "(" << psNodeNames[i] << "), "
496  "n. of nodes: " << NodeData[i].NodeContainer.size()
497  << std::endl;
498  }
499 
500  /* mostra in modo succinto il numero di elementi per tipo */
501  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
502  std::cout << "Element Type " << i << " "
503  "(" << psElemNames[i] << "), "
504  "n. of elems: " << ElemData[i].ElemContainer.size()
505  << std::endl;
506  }
507 
508  /* mostra in modo succinto il numero di drivers per tipo */
509  for (int i = 0; i < Drive::LASTDRIVETYPE; i++) {
510  std::cout << "DriveType " << i << " "
511  "(" << psDriveNames[i] << "), "
512  "n. of drivers: " << DriveData[i].iNum
513  << std::endl;
514  }
515  }
516 #endif /* DEBUG */
517 
518  if (bAbortAfterInput) {
519  silent_cout("Only input is required" << std::endl);
520  return;
521  }
522 
523 #ifdef USE_SOCKET
524  /* waits for all pending sockets to connect */
525  WaitSocketUsers();
526 #endif // USE_SOCKET
527 
528  /* Qui intercetto la struttura dei Dof prima che venga costruita e modifico
529  * in modo che sia adatta all'assemblaggio dei vincoli; quindi la resetto
530  * e la lascio generare correttamente.
531  * L'assemblaggio iniziale viene gestito dal DataManager perche'
532  * concettualmente la consistenza dei dati deve essere assicurata da lui,
533  * che conosce gli aspetti fisici del problema
534  */
535 
537  for (int i = 0; i < Elem::LASTELEMTYPE; ++i) {
538  if (ElemData[i].bToBeUsedInAssembly() && !ElemData[i].ElemContainer.empty()) {
540  break;
541  }
542  }
543  }
544 
548 
549  } else {
550  silent_cout("Skipping initial joints assembly" << std::endl);
551  }
552 
553  } else {
554  silent_cout("No initial assembly is required since no joints are defined"
555  << std::endl);
556  }
557 
558  /* Costruzione dei dati dei Dof definitivi da usare nella simulazione */
559 
560  /* Aggiornamento DofOwner degli elementi (e dei nodi) */
561  if (bInverseDynamics) {
562  IDDofOwnerSet();
563  } else {
564  DofOwnerSet();
565  }
566 
567  /* Verifica dei dati di controllo */
568 #ifdef DEBUG
570  /* mostra in modo succinto i DofOwners */
571  int k = 0;
572  for (int i = 0; i < DofOwner::LASTDOFTYPE; i++) {
573  std::cout << "DofType " << i << ':' << std::endl;
574  for (int j = 0; j < DofData[i].iNum; j++) {
575  std::cout << "DofOwner " << j << ", n. of dofs: "
576  << DofOwners[k++].iNumDofs << std::endl;
577  }
578  }
579  }
580 #endif /* DEBUG */
581 
582  /* a questo punto i dof sono completamente scritti in quanto a numero.
583  * Rimane da sistemare il vettore con gli indici "interni" ed il tipo */
584 
585  /* Costruzione array DofOwner e Dof */
586  if(bInverseDynamics) {
587  IDDofInit();
588  } else {
589  DofInit();
590  }
591 
592  /* Aggiornamento Dof di proprieta' degli elementi e dei nodi */
593 // if(bInverseDynamics) {
594 // InverseDofOwnerInit();
595 // } else {
596  DofOwnerInit();
597 // }
598 
599  /* Creazione strutture di lavoro per assemblaggio e residuo */
600  ElemAssInit();
601 
602 #ifdef DEBUG
604  for (int iCnt = 0; iCnt < iTotDofs; iCnt++) {
605  std::cout << "Dof " << std::setw(4) << iCnt+1 << ": order "
606  << Dofs[iCnt].Order << std::endl;
607  }
608  }
609 #endif /* DEBUG */
610 
611 
612 } /* End of DataManager::DataManager() */
integer iTotDofOwners
Definition: dataman.h:795
std::ostream & ReferenceFrames(void) const
Definition: output.h:534
eRestart RestartEvery
Definition: dataman.h:164
integer iMaxWorkNumItemsJac
Definition: dataman.h:628
#define DEBUG_LEVEL_MATCH(level)
Definition: myassert.h:241
ElemVecType Elems
Definition: dataman.h:609
MathParser::PlugIn * node_priv_plugin(MathParser &mp, void *arg)
Definition: privpgin.cc:299
ElemContainerType ElemContainer
Definition: dataman.h:591
const bool bDefaultSkipInitialJointAssembly(false)
doublereal dEpsilon
Definition: dataman.h:126
VariableSubMatrixHandler * pWorkMatA
Definition: dataman.h:630
char * sSimulationTitle
Definition: dataman.h:158
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
MathParser & MathPar
Definition: dataman.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
int mbdyn_cleanup_register(mbdyn_cleanup_f handler, void ***datapp)
Definition: cleanup.cc:62
const DCType & GetDriveCallerContainer(void) const
Definition: mbpar.cc:854
DofVecType Dofs
Definition: dataman.h:813
integer iMaxWorkNumRowsRes
Definition: dataman.h:625
int iIDNodeTotNumDofs
Definition: dataman.h:134
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
void ElemManager(void)
Definition: elman.cc:51
void ReadControl(MBDynParser &HP, const char *sInputFileName)
Definition: dataman3.cc:68
int RegisterNameSpace(NameSpace *ns)
Definition: mathp.cc:4602
doublereal dInitialPositionStiffness
Definition: dataman.h:121
bool bOmegaRotates
Definition: dataman.h:123
integer iCurrRestartTime
Definition: dataman.h:170
OutputHandler OutHdl
Definition: dataman.h:105
unsigned int iTotNodes
Definition: dataman.h:748
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
void ReadNodes(MBDynParser &HP)
Definition: dataman3.cc:1557
void DofOwnerSet(void)
Definition: dataman2.cc:1368
VariableSubMatrixHandler * pWorkMatB
Definition: dataman.h:631
void NodeDataInit(void)
Definition: nodeman.cc:98
#define DEBUGCERR(msg)
Definition: myassert.h:235
unsigned int iTotDrive
Definition: dataman.h:622
#define NO_OP
Definition: myassert.h:74
integer iMaxInitialIterations
Definition: dataman.h:125
int iIDJointTotNumDofs
Definition: dataman.h:135
std::vector< DofOwner > DofOwners
Definition: dataman.h:796
virtual const LinSol & GetLinearSolver(void) const
Definition: solver.h:401
void DofOwnerInit(void)
Definition: dataman2.cc:182
void InitialJointAssembly(void)
Definition: dataman2.cc:679
bool bInverseDynamics
Definition: dataman.h:133
NodeContainerType NodeContainer
Definition: dataman.h:731
void DofDataInit(void)
Definition: dofman.cc:69
integer iTotDofs
Definition: dataman.h:809
bool Open(const OutputHandler::OutFiles out)
Definition: output.cc:298
bool bSkipInitialJointAssembly
Definition: dataman.h:117
bool saveXSol
Definition: dataman.h:175
void ReadDrivers(MBDynParser &HP)
Definition: dataman3.cc:2187
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
void IDDofOwnerSet(void)
Definition: invdataman.cc:852
void DofInit(void)
Definition: dofman.cc:111
const bool bDefaultInitialJointAssemblyToBeMade(false)
doublereal dRestartTime
Definition: dataman.h:166
std::map< unsigned, const DriveCaller * > DCType
Definition: mbpar.h:207
void ** ppCleanupData
Definition: dataman.h:89
integer iMaxWorkNumRowsJac
Definition: dataman.h:626
void IDDofInit(void)
Definition: invdataman.cc:895
Solver * pSolver
Definition: dataman.h:99
int ResMode
Definition: dataman.h:201
DriveCaller * pOutputMeter
Definition: dataman.h:179
doublereal dLastRestartTime
Definition: dataman.h:173
RigidBodyKinematics * pRBK
Definition: dataman.h:129
SolverDiagnostics(unsigned OF=OUTPUT_DEFAULT, DriveCaller *pOM=0)
int GetDescription(void)
Definition: parser.cc:730
void NodeManager(void)
Definition: nodeman.cc:44
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
void SetExceptions(std::ios::iostate flags)
Definition: output.cc:678
const char * psDofOwnerNames[]
Definition: enums.cc:423
integer iMaxWorkNumColsJac
Definition: dataman.h:627
void ReadElems(MBDynParser &HP)
Definition: dataman4.cc:157
int datamanager_cleanup(void *data)
Definition: dataman.cc:914
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
bool bOutputFrames
Definition: dataman.h:118
virtual MathParser & GetMathParser(void)
Definition: parser.cc:668
doublereal dInitialAssemblyTol
Definition: dataman.h:124
integer iRestartIterations
Definition: dataman.h:165
VecIter< Elem * > ElemIter
Definition: dataman.h:612
OrientationDescription od
Definition: dataman.h:229
bool bInitialJointAssemblyToBeDone
Definition: dataman.h:116
KeyWords
Definition: dataman4.cc:94
VectorHandler * pLambdaCurr
Definition: dataman.h:113
doublereal dInitialVelocityStiffness
Definition: dataman.h:122
const doublereal dDefaultInitialStiffness
Definition: dataman.cc:80
integer iOutputCount
Definition: dataman.h:180
const bool bDefaultOmegaRotates(false)
void SetTime(const doublereal &dTime, const doublereal &dTimeStep=-1., const integer &iStep=-1, bool bServePending=true)
Definition: dataman2.cc:139
const integer iDefaultMaxInitialIterations
Definition: dataman.cc:83
bool bOutputDriveCaller
Definition: dataman.h:120
integer iCurrRestartIter
Definition: dataman.h:172
char * solArrFileName
Definition: dataman.h:176
Drive ** ppDrive
Definition: dataman.h:621
const char * psNodeNames[]
Definition: enums.cc:372
void DofManager(void)
Definition: dofman.cc:40
MathParser::PlugIn * elem_priv_plugin(MathParser &mp, void *arg)
Definition: privpgin.cc:308
doublereal * pdRestartTimes
Definition: dataman.h:168
const char * psElemNames[]
Definition: enums.cc:39
virtual int GetWord(void)
Definition: parser.cc:1083
MathParser::PlugIn * dof_plugin(MathParser &mp, void *arg)
Definition: dofpgin.cc:278
bool bStaticModel
Definition: dataman.h:130
MBDynParser & MBPar
Definition: dataman.h:97
LinSol CurrSolver
Definition: dataman.h:127
void InitUDE(void)
Definition: userelem.cc:107
integer iNumRestartTimes
Definition: dataman.h:169
void InitDriveData(void)
Definition: drive_.cc:3002
const doublereal dDefaultInitialAssemblyTol
Definition: dataman.cc:82
DriveHandler DrvHdl
Definition: dataman.h:104
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
int RegisterPlugIn(const char *name, MathParser::PlugIn *(*)(MathParser &, void *), void *arg)
Definition: mathp.cc:4584
void ElemDataInit(void)
Definition: elman.cc:248
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Table & GetSymbolTable(void) const
Definition: mathp.cc:1931
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
unsigned uPrintFlags
Definition: dataman.h:156
VariableSubMatrixHandler * pWorkMat
Definition: dataman.h:632
void OutputFrames(std::ostream &out) const
Definition: mbpar.cc:1323
void InitGustData(void)
Definition: gust.cc:212
bool bOutputAccels
Definition: dataman.h:119
VectorHandler * pXCurr
Definition: dataman.h:108
void ElemAssInit(void)
Definition: elman.cc:318
const char * psDriveNames[]
Definition: enums.cc:351

Here is the call graph for this function:

DataManager::~DataManager ( void  )
virtual

Definition at line 618 of file dataman.cc.

References ATEND, DestroyDriveData(), DestroyGustData(), DestroyUDE(), DofManagerDestructor(), ElemManagerDestructor(), MakeRestart(), module_finalize(), NodeManagerDestructor(), pOutputMeter, ppCleanupData, pRBK, RestartEvery, SAFEDELETE, SAFEDELETEARR, and sSimulationTitle.

619 {
620  *ppCleanupData = 0;
621 
622  /* Se e' richiesto il file di restart, il distruttore del DataManager
623  * crea il file e forza gli oggetti a scrivere il loro contributo nel modo
624  * opportuno
625  */
626  if (RestartEvery == ATEND) {
627  MakeRestart();
628  }
629 
630  if (sSimulationTitle != 0) {
632  sSimulationTitle = 0;
633  }
634 
635  if (pOutputMeter) {
637  pOutputMeter = 0;
638  }
639 
640 #ifdef MBDYN_FDJAC
641  if (pFDJacMeter) {
642  SAFEDELETE(pFDJacMeter);
643  pFDJacMeter = 0;
644  }
645 #endif // MBDYN_FDJAC
646 
647  if (pRBK) {
648  SAFEDELETE(pRBK);
649  pRBK = 0;
650  }
651 
655 
657  DestroyUDE();
658  DestroyGustData();
659 
660 #if defined(USE_RUNTIME_LOADING)
661  if (moduleInitialized) {
662  module_finalize();
663  }
664 #endif // USE_RUNTIME_LOADING
665 } /* End of DataManager::DataManager() */
eRestart RestartEvery
Definition: dataman.h:164
char * sSimulationTitle
Definition: dataman.h:158
void module_finalize(void)
Definition: modules.cc:67
void DofManagerDestructor(void)
Definition: dofman.cc:56
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
void ** ppCleanupData
Definition: dataman.h:89
void ElemManagerDestructor(void)
Definition: elman.cc:196
DriveCaller * pOutputMeter
Definition: dataman.h:179
void NodeManagerDestructor(void)
Definition: nodeman.cc:84
virtual void MakeRestart(void)
Definition: dataman.cc:699
RigidBodyKinematics * pRBK
Definition: dataman.h:129
void DestroyGustData(void)
Definition: gust.cc:233
void DestroyDriveData(void)
Definition: drive_.cc:3028
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710
void DestroyUDE(void)
Definition: userelem.cc:134

Here is the call graph for this function:

Member Function Documentation

void DataManager::AfterConvergence ( void  ) const
virtual

Reimplemented in SchurDataManager.

Definition at line 2527 of file dataman2.cc.

References SimulationEntity::AfterConvergence(), ASSERT, VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), Solver::dGetInitialTimeStep(), DriveHandler::dGetTime(), dLastRestartTime, dRestartTime, DrvHdl, ElemIter, iCurrRestartIter, iCurrRestartTime, iNumRestartTimes, iRestartIterations, ITERATIONS, MakeRestart(), NEVER, Nodes, pdRestartTimes, pSolver, pXCurr, pXPrimeCurr, RestartEvery, TIME, and TIMES.

Referenced by DerivativeSolver::Advance(), Step1Integrator::Advance(), and Step2Integrator::Advance().

2528 {
2529  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
2530  (*i)->AfterConvergence(*pXCurr, *pXPrimeCurr);
2531  }
2532 
2533  /* Versione con iteratore: */
2534  Elem* pEl = NULL;
2535  if (ElemIter.bGetFirst(pEl)) {
2536  do {
2537  pEl->AfterConvergence(*pXCurr,
2538  *pXPrimeCurr);
2539  } while (ElemIter.bGetNext(pEl));
2540  }
2541 
2542  /* Restart condizionato */
2543  switch (RestartEvery) {
2544  case NEVER:
2545  break;
2546 
2547  case ITERATIONS:
2549  iCurrRestartIter = 0;
2550  const_cast<DataManager *>(this)->MakeRestart();
2551  }
2552  break;
2553 
2554  case TIME: {
2555  doublereal dT = DrvHdl.dGetTime();
2556  if (dT - dLastRestartTime >= dRestartTime) {
2557  dLastRestartTime = dT;
2558  const_cast<DataManager *>(this)->MakeRestart();
2559  }
2560  break;
2561  }
2562 
2563  case TIMES: {
2564  doublereal dT = DrvHdl.dGetTime()
2565  + pSolver->dGetInitialTimeStep()/100.;
2567  break;
2568  }
2569 
2571 
2572  if (dT >= pdRestartTimes[iCurrRestartTime]) {
2573  iCurrRestartTime++;
2574  const_cast<DataManager *>(this)->MakeRestart();
2575  }
2576  break;
2577  }
2578 
2579  default:
2580  ASSERT(0);
2581  break;
2582  }
2583 }
eRestart RestartEvery
Definition: dataman.h:164
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
NodeVecType Nodes
Definition: dataman.h:743
integer iCurrRestartTime
Definition: dataman.h:170
doublereal dRestartTime
Definition: dataman.h:166
Solver * pSolver
Definition: dataman.h:99
virtual void MakeRestart(void)
Definition: dataman.cc:699
doublereal dLastRestartTime
Definition: dataman.h:173
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
integer iRestartIterations
Definition: dataman.h:165
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
integer iCurrRestartIter
Definition: dataman.h:172
Definition: elem.h:75
doublereal * pdRestartTimes
Definition: dataman.h:168
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: simentity.cc:120
doublereal dGetTime(void) const
Definition: drive.h:386
integer iNumRestartTimes
Definition: dataman.h:169
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
DriveHandler DrvHdl
Definition: dataman.h:104
double doublereal
Definition: colamd.c:52
virtual doublereal dGetInitialTimeStep(void) const
Definition: solver.h:417
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AfterPredict ( void  ) const
virtual

Reimplemented in SchurDataManager.

Definition at line 2472 of file dataman2.cc.

References SimulationEntity::AfterPredict(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), ElemIter, Elem::GetElemType(), WithLabel::GetLabel(), m_IsConverged, Nodes, Converged::NOT_CONVERGED, psElemNames, psNodeNames, pXCurr, and pXPrimeCurr.

Referenced by DerivativeSolver::Advance(), Step1Integrator::Advance(), Step2Integrator::Advance(), and ThirdOrderIntegrator::Predict().

2473 {
2474  /* reset any external convergence requirement before starting
2475  * a new step */
2476  for (Converged_t::iterator i = m_IsConverged.begin();
2477  i != m_IsConverged.end(); ++i)
2478  {
2480  }
2481 
2482  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
2483  try {
2484  (*i)->AfterPredict(*pXCurr, *pXPrimeCurr);
2485  }
2486  catch (Elem::ChangedEquationStructure& e) {
2487  // ignore by now
2488  silent_cerr("DataManager::AfterPredict: "
2489  "warning, caught Elem::ChangedEquationStructure while processing "
2490  << psNodeNames[(*i)->GetNodeType()] << "(" << (*i)->GetLabel() << ")" << std::endl);
2491  }
2492  }
2493 
2494  Elem* pEl = 0;
2495  if (ElemIter.bGetFirst(pEl)) {
2496  do {
2497  try {
2498  pEl->AfterPredict(*pXCurr, *pXPrimeCurr);
2499  }
2501  // ignore by now
2502  silent_cerr("DataManager::AfterPredict: "
2503  "warning, caught Elem::ChangedEquationStructure while processing "
2504  << psElemNames[pEl->GetElemType()] << "(" << pEl->GetLabel() << ")" << std::endl);
2505  }
2506  } while (ElemIter.bGetNext(pEl));
2507  }
2508 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
NodeVecType Nodes
Definition: dataman.h:743
Converged_t m_IsConverged
Definition: dataman.h:399
virtual Elem::Type GetElemType(void) const =0
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
VecIter< Elem * > ElemIter
Definition: dataman.h:612
const char * psNodeNames[]
Definition: enums.cc:372
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
virtual void AfterPredict(VectorHandler &X, VectorHandler &XP)
Definition: simentity.cc:91
unsigned int GetLabel(void) const
Definition: withlab.cc:62
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssConstrJac ( MatrixHandler JacHdl)
virtual

Definition at line 94 of file invdataman.cc.

References ASSERT, DEBUGCOUT, ElemIter, Elems, and pWorkMat.

Referenced by InverseDynamicsStepSolver::Jacobian().

95 {
96  DEBUGCOUT("Entering DataManager::AssJac()" << std::endl);
97 
98  ASSERT(pWorkMat != NULL);
99  ASSERT(Elems.begin() != Elems.end());
100 
101  AssConstrJac(JacHdl, ElemIter, *pWorkMat);
102 }
ElemVecType Elems
Definition: dataman.h:609
#define DEBUGCOUT(msg)
Definition: myassert.h:232
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
virtual void AssConstrJac(MatrixHandler &JacHdl)
Definition: invdataman.cc:94
VariableSubMatrixHandler * pWorkMat
Definition: dataman.h:632
void DataManager::AssConstrJac ( MatrixHandler JacHdl,
VecIter< Elem * > &  Iter,
VariableSubMatrixHandler WorkMat 
)
protected

Definition at line 105 of file invdataman.cc.

References VariableSubMatrixHandler::AddToT(), ASSERT, Elem::AssJac(), Beam2::AssJac(), Elem::BEAM, Elem::bIsErgonomy(), Joint::bIsPrescribedMotion(), Joint::bIsTorque(), Elem::BODY, DEBUGCOUT, Body::dGetM(), DriveHandler::dGetTimeStep(), DrvHdl, DataManager::ElemDataStructure::ElemContainer, ElemData, InverseDynamics::FULLY_ACTUATED_COLLOCATED, InverseDynamics::FULLY_ACTUATED_NON_COLLOCATED, Body::GetJ(), InverseDynamicsStepSolver::GetOrder(), InverseSolver::GetProblemType(), Body::GetS(), InverseSolver::GetWeight(), DofOwnerOwner::iGetFirstIndex(), SimulationEntity::iGetNumDof(), Elem::iGetNumDof(), InverseDynamics::INVERSE_DYNAMICS, Elem::JOINT, Elem::JOINT_REGULARIZATION, MBDYN_EXCEPT_ARGS, DataManager::NodeDataStructure::NodeContainer, NodeData, Body::pGetNode(), Solver::pGetStepIntegrator(), InverseDynamics::POSITION, pSolver, pXCurr, MatrixHandler::Reset(), Node::STRUCTURAL, InverseDynamics::UNDERDETERMINED_FULLY_ACTUATED, and InverseDynamics::UNDERDETERMINED_UNDERACTUATED_COLLOCATED.

108 {
109  DEBUGCOUT("Entering DataManager::AssJac()" << std::endl);
110 
111  JacHdl.Reset();
112 
113  InverseSolver *pIDS = dynamic_cast<InverseSolver *>(pSolver);
114 
115  switch (pIDS->GetProblemType()) {
117  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
118  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
119  {
120  Joint *pJ = Cast<Joint>(j->second);
121  if (pJ->bIsPrescribedMotion()) {
122  ASSERT(pJ->bIsTorque());
123  JacHdl += j->second->AssJac(WorkMat, *pXCurr);
124  }
125  }
126  break;
127 
130  silent_cerr("DataManager::AssConstrJac(" << pIDS->GetProblemType() << ") not implemented yet" << std::endl);
132 
134  // NOTE: in this case, the name of the function is misleading,
135  // since it assembles the entire problem's Jacobian matrix
136  // and not only the Jacobian matrix of the constraints
139  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
140  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
141  {
142  bool bActive(true);
143  Joint *pJ = Cast<Joint>(j->second, true);
144  if (pJ == 0) {
145  bActive = false;
146  pJ = Cast<Joint>(j->second, false);
147  }
148 
149  if (pJ->bIsTorque() && bActive) {
150  JacHdl += pJ->AssJac(WorkMat, *pXCurr);
151  WorkMat.AddToT(JacHdl);
152 
153  } else if (pJ->bIsPrescribedMotion() || (pJ->bIsTorque() && !bActive)) {
154  integer iNumDof = pJ->iGetNumDof();
155  integer iFirstIndex = pJ->iGetFirstIndex();
156  for (int iCnt = 1; iCnt <= iNumDof; iCnt++) {
157  JacHdl(iFirstIndex + iCnt, iFirstIndex + iCnt) = 1.;
158  }
159  }
160  }
161 
162  // FIXME: regularization could be needed also in other phases
163  // may need to be related to the state of the regularized joint
164  for (ElemContainerType::iterator j = ElemData[Elem::JOINT_REGULARIZATION].ElemContainer.begin();
166  {
167  JointRegularization *pJ = Cast<JointRegularization>(j->second, true);
168  if (pJ) {
169  JacHdl += pJ->AssJac(WorkMat, *pXCurr);
170  }
171  }
172 
173 #if 0
174  // this _should_ be harmless...
175  for (NodeContainerType::const_iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
176  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
177  {
178  ASSERT(n->second->iGetNumDof() == 6);
179  integer iFirstIndex = n->second->iGetFirstIndex();
180 
181  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
182  JacHdl(iFirstIndex + iCnt, iFirstIndex + iCnt) += 1.;
183  }
184  }
185 #endif
186 
187  } else {
188  doublereal dw1, dw2;
189  pIDS->GetWeight(pIDSS->GetOrder(), dw1, dw2);
190  if (dw1 > 0.) {
191  for (NodeContainerType::const_iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
192  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
193  {
194  ASSERT(n->second->iGetNumDof() == 6);
195  integer iFirstIndex = n->second->iGetFirstIndex();
196 
197  for (integer iCnt = 1; iCnt <= 6; iCnt++) {
198  JacHdl(iFirstIndex + iCnt, iFirstIndex + iCnt) += dw1;
199  }
200  }
201  }
202 
203  if (dw2 > 0.) {
204 // DO NOT ENABLE, BROKEN
205 //#define TORQUE_OPTIMIZATION
206 #ifdef TORQUE_OPTIMIZATION
207  if (pIDSS->GetOrder() == InverseDynamics::POSITION) {
209  dw2 /= h*h;
210  }
211 #endif // TORQUE_OPTIMIZATION
212 
213  for (ElemContainerType::const_iterator b = ElemData[Elem::BODY].ElemContainer.begin();
214  b != ElemData[Elem::BODY].ElemContainer.end(); ++b)
215  {
216  if (!b->second->bIsErgonomy()) {
217  continue;
218  }
219 
220  const Body *pBody(Cast<Body>(b->second));
221  doublereal dm(pBody->dGetM()*dw2);
222  Vec3 S(pBody->GetS()*dw2);
223  Mat3x3 J = (pBody->GetJ()*dw2);
224  const StructNode *pNode = pBody->pGetNode();
225  ASSERT(pNode->iGetNumDof() == 6);
226  integer iFirstIndex = pNode->iGetFirstIndex();
227 
228  for (int iRow = 1; iRow <= 3; iRow++) {
229  JacHdl(iFirstIndex + iRow, iFirstIndex + iRow) += dm;
230 
231  for (int iCol = 1; iCol <= 3; iCol++) {
232  JacHdl(iFirstIndex + 3 + iRow, iFirstIndex + 3 + iCol) += J(iRow, iCol);
233  }
234  }
235 
236  JacHdl(iFirstIndex + 3 + 1, iFirstIndex + 2) = -S(3); // 1, 2
237  JacHdl(iFirstIndex + 3 + 1, iFirstIndex + 3) = S(2); // 1, 3
238  JacHdl(iFirstIndex + 3 + 2, iFirstIndex + 3) = -S(1); // 2, 3
239  JacHdl(iFirstIndex + 3 + 2, iFirstIndex + 1) = S(3); // 2, 1
240  JacHdl(iFirstIndex + 3 + 3, iFirstIndex + 1) = -S(2); // 3, 1
241  JacHdl(iFirstIndex + 3 + 3, iFirstIndex + 2) = S(1); // 3, 2
242 
243  JacHdl(iFirstIndex + 2, iFirstIndex + 3 + 1) = -S(3); // 2, 1
244  JacHdl(iFirstIndex + 3, iFirstIndex + 3 + 1) = S(2); // 3, 1
245  JacHdl(iFirstIndex + 3, iFirstIndex + 3 + 2) = -S(1); // 3, 2
246  JacHdl(iFirstIndex + 1, iFirstIndex + 3 + 2) = S(3); // 1, 2
247  JacHdl(iFirstIndex + 1, iFirstIndex + 3 + 3) = -S(2); // 1, 3
248  JacHdl(iFirstIndex + 2, iFirstIndex + 3 + 3) = S(1); // 2, 3
249  }
250  }
251 
252  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
253  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
254  {
255  bool bActive(true);
256  Joint *pJ = Cast<Joint>(j->second, true);
257  if (pJ == 0) {
258  bActive = false;
259  pJ = Cast<Joint>(j->second, false);
260  }
261 
262  if (pJ->bIsPrescribedMotion() && bActive) {
263  JacHdl += pJ->AssJac(WorkMat, *pXCurr);
264  WorkMat.AddToT(JacHdl);
265 
266  } else if (pJ->bIsErgonomy() && bActive && pIDSS->GetOrder() == InverseDynamics::POSITION) {
267  JacHdl += pJ->AssJac(WorkMat, *pXCurr);
268 
269  } else if (pJ->bIsTorque() || (pJ->bIsPrescribedMotion() && !bActive)) {
270  integer iNumDof = pJ->iGetNumDof();
271  integer iFirstIndex = pJ->iGetFirstIndex();
272  for (int iCnt = 1; iCnt <= iNumDof; iCnt++) {
273  JacHdl(iFirstIndex + iCnt, iFirstIndex + iCnt) = 1.;
274  }
275  }
276  }
277 
278  for (ElemContainerType::iterator j = ElemData[Elem::BEAM].ElemContainer.begin();
279  j != ElemData[Elem::BEAM].ElemContainer.end(); ++j)
280  {
281  bool bActive(true);
282  Beam2 *pB = Cast<Beam2>(j->second, true);
283  if (pB == 0) {
284  bActive = false;
285  pB = Cast<Beam2>(j->second, false);
286  }
287 
288  if (pB && pB->bIsErgonomy() && bActive && pIDSS->GetOrder() == InverseDynamics::POSITION) {
289  JacHdl += pB->AssJac(WorkMat, *pXCurr);
290  }
291  }
292  }
293  } break;
294 
295  default:
296  ASSERT(0);
298  }
299 }
ElemContainerType ElemContainer
Definition: dataman.h:591
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: body.h:270
Definition: matvec3.h:98
bool bIsErgonomy(void) const
Definition: elem.cc:83
Definition: beam2.h:50
MatrixHandler & AddToT(MatrixHandler &MH) const
Definition: submat.h:1277
InverseDynamics::Type GetProblemType(void) const
Definition: invsolver.cc:889
NodeContainerType NodeContainer
Definition: dataman.h:731
virtual void Reset(void)=0
bool bIsPrescribedMotion(void) const
Definition: joint.cc:170
virtual StepIntegrator * pGetStepIntegrator(void) const
Definition: solver.h:407
InverseDynamics::Order GetOrder(void) const
Definition: stepsol.cc:1516
Solver * pSolver
Definition: dataman.h:99
doublereal dGetTimeStep(void) const
Definition: drive.h:393
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
#define DEBUGCOUT(msg)
Definition: myassert.h:232
#define ASSERT(expression)
Definition: colamd.c:977
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
virtual unsigned int iGetNumDof(void) const =0
bool bIsTorque(void) const
Definition: joint.cc:176
Definition: joint.h:50
DriveHandler DrvHdl
Definition: dataman.h:104
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
void GetWeight(InverseDynamics::Order iOrder, doublereal &dw1, doublereal &dw2) const
Definition: invsolver.cc:895
long int integer
Definition: colamd.c:51
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: beam2.cc:485
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssConstrRes ( VectorHandler ResHdl,
InverseDynamics::Order  iOrder 
)
virtual

Definition at line 303 of file invdataman.cc.

References DEBUGCOUT, ElemIter, and pWorkVec.

Referenced by InverseDynamicsStepSolver::Residual().

304 {
305  DEBUGCOUT("Entering AssRes()" << std::endl);
306 
307  AssConstrRes(ResHdl, ElemIter, *pWorkVec, iOrder);
308 }
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VecIter< Elem * > ElemIter
Definition: dataman.h:612
virtual void AssConstrRes(VectorHandler &ResHdl, InverseDynamics::Order iOrder)
Definition: invdataman.cc:303
void DataManager::AssConstrRes ( VectorHandler ResHdl,
VecIter< Elem * > &  Iter,
SubVectorHandler WorkVec,
InverseDynamics::Order  iOrder 
)
protected

Definition at line 311 of file invdataman.cc.

References InverseDynamics::ACCELERATION, ASSERT, Elem::AssRes(), Elem::BEAM, Elem::bIsErgonomy(), Joint::bIsPrescribedMotion(), Joint::bIsTorque(), Elem::BODY, Vec3::Cross(), DEBUGCOUT, Body::dGetM(), DriveHandler::dGetTimeStep(), DrvHdl, DataManager::ElemDataStructure::ElemContainer, ElemData, InverseDynamics::FULLY_ACTUATED_COLLOCATED, InverseDynamics::FULLY_ACTUATED_NON_COLLOCATED, Body::GetJ(), InverseSolver::GetProblemType(), StructNode::GetRCurr(), StructNode::GetRPrev(), Body::GetS(), StructDispNode::GetVCurr(), StructDispNode::GetVPrev(), StructNode::GetWCurr(), InverseSolver::GetWeight(), StructNode::GetWPPrev(), StructNode::GetWPrev(), StructDispNode::GetXCurr(), StructDispNode::GetXPPPrev(), StructDispNode::GetXPrev(), DofOwnerOwner::iGetFirstIndex(), SimulationEntity::iGetNumDof(), Elem::iGetNumDof(), Elem::JOINT, MBDYN_EXCEPT_ARGS, Mat3x3::MulMT(), DataManager::NodeDataStructure::NodeContainer, NodeData, Body::pGetNode(), InverseDynamics::POSITION, pSolver, pXCurr, pXPrimeCurr, pXPrimePrimeCurr, Node::STRUCTURAL, InverseDynamics::UNDERDETERMINED_FULLY_ACTUATED, InverseDynamics::UNDERDETERMINED_UNDERACTUATED_COLLOCATED, RotManip::VecRot(), and InverseDynamics::VELOCITY.

315 {
316  DEBUGCOUT("Entering AssRes()" << std::endl);
317 
318  // TODO
319 
320  bool ChangedEqStructure(false);
321  InverseSolver *pIDS = dynamic_cast<InverseSolver *>(pSolver);
322 
323  switch (pIDS->GetProblemType()) {
325  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
326  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
327  {
328  Joint *pJ = Cast<Joint>(j->second);
329  if (pJ->bIsPrescribedMotion()) {
330  ASSERT(pJ->bIsTorque());
331  try {
332  ResHdl += pJ->AssRes(WorkVec, *pXCurr,
333  *pXPrimeCurr, *pXPrimePrimeCurr, iOrder);
334  }
336  ResHdl += WorkVec;
337  ChangedEqStructure = true;
338  }
339  }
340  }
341  break;
342 
345  silent_cerr("DataManager::AssConstrRes(" << pIDS->GetProblemType() << ") not implemented yet" << std::endl);
347 
349  // NOTE: in this case, the name of the function is misleading,
350  // since it assembles the entire problem's residual
351  // and not only the residual of the constraints
352  doublereal dw1, dw2;
353  pIDS->GetWeight(iOrder, dw1, dw2);
354  switch (iOrder) {
356  if (dw1 > 0.) {
357  for (NodeContainerType::const_iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
358  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
359  {
360  const StructNode *pNode = dynamic_cast<const StructNode *>(n->second);
361 
362  ASSERT(pNode->iGetNumDof() == 6);
363  integer iFirstIndex = pNode->iGetFirstIndex();
364 
365  Vec3 DX(pNode->GetXPrev() - pNode->GetXCurr());
366  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
367  ResHdl(iFirstIndex + iCnt) += dw1*DX(iCnt);
368  }
369 
370  // VecRot(Rp*Rc^T) = -VecRot(Rc*Rp^T)
371  Vec3 DTheta(RotManip::VecRot(pNode->GetRPrev().MulMT(pNode->GetRCurr())));
372  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
373  ResHdl(iFirstIndex + 3 + iCnt) += dw1*DTheta(iCnt);
374  }
375  }
376  }
377 
378  if (dw2 > 0.) {
379 #ifdef TORQUE_OPTIMIZATION
381  for (ElemContainerType::const_iterator b = ElemData[Elem::BODY].ElemContainer.begin();
382  b != ElemData[Elem::BODY].ElemContainer.end(); ++b)
383  {
384  if (!b->second->bIsRightHandSide()) {
385  continue;
386  }
387 
388  const Body *pBody(Cast<Body>(b->second));
389  doublereal dm(pBody->dGetM()*dw2);
390  Vec3 S(pBody->GetS()*dw2);
391  Mat3x3 J = (pBody->GetJ()*dw2);
392  const StructNode *pNode = pBody->pGetNode();
393  ASSERT(pNode->iGetNumDof() == 6);
394  integer iFirstIndex = pNode->iGetFirstIndex();
395 
396  Vec3 DXP((pNode->GetXCurr() - pNode->GetXPrev())/h);
397  Vec3 DXPP((DXP - pNode->GetVPrev())/h);
398  // VecRot(Rp*Rc^T) = -VecRot(Rc*Rp^T)
399  Vec3 DW(RotManip::VecRot(pNode->GetRCurr().MulMT(pNode->GetRPrev()))/h);
400  Vec3 DWP((DW - pNode->GetWPrev())/h);
401 
402  Vec3 XRes(DXPP*dm + DWP.Cross(S) + DW.Cross(DW.Cross(S)));
403  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
404  ResHdl(iFirstIndex + iCnt) -= XRes(iCnt);
405  }
406 
407  Vec3 ThetaRes(S.Cross(DXPP) + J*DWP + DW.Cross(J*DW));
408  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
409  ResHdl(iFirstIndex + 3 + iCnt) -= ThetaRes(iCnt);
410  }
411  }
412 #else // !TORQUE_OPTIMIZATION
413  for (ElemContainerType::const_iterator b = ElemData[Elem::BODY].ElemContainer.begin();
414  b != ElemData[Elem::BODY].ElemContainer.end(); ++b)
415  {
416  if (!b->second->bIsErgonomy()) {
417  continue;
418  }
419 
420  const Body *pBody(Cast<Body>(b->second));
421  doublereal dm(pBody->dGetM()*dw2);
422  Vec3 S(pBody->GetS()*dw2);
423  Mat3x3 J = (pBody->GetJ()*dw2);
424  const StructNode *pNode = pBody->pGetNode();
425  ASSERT(pNode->iGetNumDof() == 6);
426  integer iFirstIndex = pNode->iGetFirstIndex();
427 
428  Vec3 DX(pNode->GetXPrev() - pNode->GetXCurr());
429  // VecRot(Rp*Rc^T) = -VecRot(Rc*Rp^T)
430  Vec3 DTheta(RotManip::VecRot(pNode->GetRPrev().MulMT(pNode->GetRCurr())));
431 
432  Vec3 XRes(DX*dm - S.Cross(DTheta));
433  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
434  ResHdl(iFirstIndex + iCnt) += XRes(iCnt);
435  }
436 
437  Vec3 ThetaRes(S.Cross(DX) + J*DTheta);
438  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
439  ResHdl(iFirstIndex + 3 + iCnt) += ThetaRes(iCnt);
440  }
441  }
442 #endif // !TORQUE_OPTIMIZATION
443  }
444  break;
445 
447  if (dw1 > 0.) {
449 
450  // xp_k = xp_km1/3 + 2/3*(x_k - x_km1)/h
451  // xp_k = 2*(x_k - x_km1)/h - xp_km1
452  for (NodeContainerType::const_iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
453  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
454  {
455  const StructNode *pNode = dynamic_cast<const StructNode *>(n->second);
456 
457  ASSERT(pNode->iGetNumDof() == 6);
458  integer iFirstIndex = pNode->iGetFirstIndex();
459 
460  const Vec3& VPrev(pNode->GetVPrev());
461  const Vec3& XPrev(pNode->GetXPrev());
462  const Vec3& XCurr(pNode->GetXCurr());
463 
464 // #define USE_2XmV 1 // 2nd order, a-stable, oscillations
465 // #define USE_2XpVd3 1 // 1st order, a/l-stable, more accurate
466 #define USE_X 1 // 1st order, l-stable (implicit Euler), less accurate (alpha == 1.)
467 // #define USE_alphaX_betaV (1.0) // alpha = 1. + |rho|; beta = (1 - alpha) for 1st order accuracy
468 
469 #if USE_2XmV
470  Vec3 VRef((XCurr - XPrev)*(2./h) - VPrev);
471 #elif USE_2XpVd3
472  Vec3 VRef((XCurr - XPrev)*(2./3./h) + VPrev/3.);
473 #elif defined(USE_alphaX_betaV)
474  Vec3 VRef((XCurr - XPrev)*(USE_alphaX_betaV/h) + VPrev*(1 - USE_alphaX_betaV));
475 #elif USE_X
476  Vec3 VRef((XCurr - XPrev)/h);
477 #endif
478  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
479  ResHdl(iFirstIndex + iCnt) += dw1*VRef(iCnt);
480  }
481 
482  const Vec3& WPrev(pNode->GetWPrev());
483  const Mat3x3& RPrev(pNode->GetRPrev());
484  const Mat3x3& RCurr(pNode->GetRCurr());
485 
486 #if USE_2XmV
487  Vec3 WRef(RotManip::VecRot(RCurr.MulMT(RPrev))*(2./h) - WPrev);
488 #elif USE_2XpVd3
489  Vec3 WRef(RotManip::VecRot(RCurr.MulMT(RPrev))*(2./3./h) + WPrev/3.);
490 #elif defined(USE_alphaX_betaV)
491  Vec3 WRef(RotManip::VecRot(RCurr.MulMT(RPrev))*(USE_alphaX_betaV/h) + WPrev*(1 - USE_alphaX_betaV));
492 #elif USE_X
493  Vec3 WRef(RotManip::VecRot(RCurr.MulMT(RPrev))/h);
494 #endif
495  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
496  ResHdl(iFirstIndex + 3 + iCnt) += dw1*WRef(iCnt);
497  }
498  }
499  }
500 
501  if (dw2 > 0.) {
502  for (ElemContainerType::const_iterator b = ElemData[Elem::BODY].ElemContainer.begin();
503  b != ElemData[Elem::BODY].ElemContainer.end(); ++b)
504  {
505  if (!b->second->bIsErgonomy()) {
506  continue;
507  }
508 
509  const Body *pBody(Cast<Body>(b->second));
510  doublereal dm(pBody->dGetM()*dw2);
511  Vec3 S(pBody->GetS()*dw2);
512  Mat3x3 J = (pBody->GetJ()*dw2);
513  const StructNode *pNode = pBody->pGetNode();
514  ASSERT(pNode->iGetNumDof() == 6);
515  integer iFirstIndex = pNode->iGetFirstIndex();
516 
517  Vec3 BPrev(pNode->GetVPrev()*dm - S.Cross(pNode->GetWPrev()));
518  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
519  ResHdl(iFirstIndex + iCnt) += BPrev(iCnt);
520  }
521 
522  Vec3 GPrev(S.Cross(pNode->GetVPrev()) + J*pNode->GetWPrev());
523  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
524  ResHdl(iFirstIndex + 3 + iCnt) += GPrev(iCnt);
525  }
526  }
527  }
528  break;
529 
531  if (dw1 > 0.) {
533 
534  // xpp_k = xpp_km1/3 + 2/3*(xp_k - xp_km1)/h
535  // xpp_k = 2*(xp_k - xp_km1)/h - xpp_km1
536  // xpp_k = xpp_km1 + 6*(xp_k + xp_km1)/h - 12*(x_k - x_km1)/h^2
537  for (NodeContainerType::const_iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
538  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
539  {
540  const StructNode *pNode = dynamic_cast<const StructNode *>(n->second);
541 
542  ASSERT(pNode->iGetNumDof() == 6);
543  integer iFirstIndex = pNode->iGetFirstIndex();
544 
545  const Vec3& XPPPrev(pNode->GetXPPPrev());
546  const Vec3& VPrev(pNode->GetVPrev());
547  const Vec3& VCurr(pNode->GetVCurr());
548 
549 #if USE_2XmV
550  Vec3 XPPRef((VCurr - VPrev)*(2./h) - XPPPrev);
551 #elif USE_2XpVd3
552  Vec3 XPPRef((VCurr - VPrev)*(2./3./h) + XPPPrev/3.);
553 #elif defined(USE_alphaX_betaV)
554  Vec3 XPPRef((VCurr - VPrev)*(USE_alphaX_betaV/h) + XPPPrev*(1 - USE_alphaX_betaV));
555 #elif USE_X
556  Vec3 XPPRef((VCurr - VPrev)/h);
557 #endif
558 #if 0
559  const Vec3& XPrev(pNode->GetXPrev());
560  const Vec3& XCurr(pNode->GetXCurr());
561 
562  Vec3 XPPRef(XPPPrev + (VCurr + VPrev)*(6./h) - (XCurr - XPrev)*(12./h/h));
563 #endif
564  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
565  ResHdl(iFirstIndex + iCnt) += dw1*XPPRef(iCnt);
566  }
567 
568  const Vec3& WPPrev(pNode->GetWPPrev());
569  const Vec3& WPrev(pNode->GetWPrev());
570  const Vec3& WCurr(pNode->GetWCurr());
571 
572 #if USE_2XmV
573  Vec3 WPRef((WCurr - WPrev)*(2./h) - WPPrev);
574 #elif USE_2XpVd3
575  Vec3 WPRef((WCurr - WPrev)*(2./3./h) + WPPrev/3.);
576 #elif defined(USE_alphaX_betaV)
577  Vec3 WPRef((WCurr - WPrev)*(USE_alphaX_betaV/h) + WPPrev*(1 - USE_alphaX_betaV));
578 #elif USE_X
579  Vec3 WPRef((WCurr - WPrev)/h);
580 #endif
581 #if 0
582  const Mat3x3& RPrev(pNode->GetRPrev());
583  const Mat3x3& RCurr(pNode->GetRCurr());
584 
585  Vec3 WPRef(WPPrev + (WCurr + WPrev)*(6./h) - RotManip::VecRot(RCurr.MulMT(RPrev))*(12./h/h));
586 #endif
587  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
588  ResHdl(iFirstIndex + 3 + iCnt) += dw1*WPRef(iCnt);
589  }
590  }
591  }
592 
593  if (dw2 > 0.) {
594  for (ElemContainerType::const_iterator b = ElemData[Elem::BODY].ElemContainer.begin();
595  b != ElemData[Elem::BODY].ElemContainer.end(); ++b)
596  {
597  if (!b->second->bIsErgonomy()) {
598  continue;
599  }
600 
601  const Body *pBody(Cast<Body>(b->second));
602  doublereal dm(pBody->dGetM()*dw2);
603  Vec3 S(pBody->GetS()*dw2);
604  Mat3x3 J = (pBody->GetJ()*dw2);
605  const StructNode *pNode = pBody->pGetNode();
606  ASSERT(pNode->iGetNumDof() == 6);
607  integer iFirstIndex = pNode->iGetFirstIndex();
608 
609  Vec3 BPPrev(pNode->GetXPPPrev()*dm - S.Cross(pNode->GetWPPrev()));
610  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
611  ResHdl(iFirstIndex + iCnt) += BPPrev(iCnt);
612  }
613 
614  Vec3 GPPrev(S.Cross(pNode->GetXPPPrev()) + J*pNode->GetWPPrev());
615  for (integer iCnt = 1; iCnt <= 3; iCnt++) {
616  ResHdl(iFirstIndex + 3 + iCnt) += GPPrev(iCnt);
617  }
618  }
619  }
620  break;
621 
622  default:
623  ASSERT(0);
624  }
625 
626  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
627  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
628  {
629  bool bActive(true);
630  Joint *pJ = Cast<Joint>(j->second, true);
631  if (pJ == 0) {
632  bActive = false;
633  pJ = Cast<Joint>(j->second, false);
634  }
635 
636  if ((pJ->bIsPrescribedMotion()
637  || (iOrder == InverseDynamics::POSITION && pJ->bIsErgonomy())) && bActive)
638  {
639  try {
640  ResHdl += j->second->AssRes(WorkVec, *pXCurr,
641  *pXPrimeCurr, *pXPrimePrimeCurr, iOrder);
642  }
644  ResHdl += WorkVec;
645  ChangedEqStructure = true;
646  }
647 
648  } else if (pJ->bIsTorque() || (pJ->bIsPrescribedMotion() && !bActive)) {
649  integer iNumDof = pJ->iGetNumDof();
650  integer iFirstIndex = pJ->iGetFirstIndex();
651  if (iOrder == InverseDynamics::POSITION) {
652  for (int iCnt = 1; iCnt <= iNumDof; iCnt++) {
653  ResHdl(iFirstIndex + iCnt) = -(*pXCurr)(iFirstIndex + iCnt);
654  }
655 
656  } else {
657  for (int iCnt = 1; iCnt <= iNumDof; iCnt++) {
658  ResHdl(iFirstIndex + iCnt) = 0.;
659  }
660  }
661  }
662  }
663 
664  for (ElemContainerType::iterator j = ElemData[Elem::BEAM].ElemContainer.begin();
665  j != ElemData[Elem::BEAM].ElemContainer.end(); ++j)
666  {
667  bool bActive(true);
668  Beam2 *pB = Cast<Beam2>(j->second, true);
669  if (pB == 0) {
670  bActive = false;
671  pB = Cast<Beam2>(j->second, false);
672  }
673 
674  if (pB && (iOrder == InverseDynamics::POSITION && pB->bIsErgonomy()) && bActive)
675  {
676  try {
677  ResHdl += j->second->AssRes(WorkVec, *pXCurr,
678  *pXPrimeCurr, *pXPrimePrimeCurr, iOrder);
679  }
681  ResHdl += WorkVec;
682  ChangedEqStructure = true;
683  }
684  }
685  }
686 
687  } break;
688 
689  default:
690  ASSERT(0);
692  }
693 
694  if (ChangedEqStructure) {
695  throw ChangedEquationStructure(MBDYN_EXCEPT_ARGS);
696  }
697 }
virtual const Vec3 & GetWPrev(void) const
Definition: strnode.h:1018
ElemContainerType ElemContainer
Definition: dataman.h:591
Vec3 Cross(const Vec3 &v) const
Definition: matvec3.h:218
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: body.h:270
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
bool bIsErgonomy(void) const
Definition: elem.cc:83
Definition: beam2.h:50
virtual const Vec3 & GetXPrev(void) const
Definition: strnode.h:304
InverseDynamics::Type GetProblemType(void) const
Definition: invsolver.cc:889
NodeContainerType NodeContainer
Definition: dataman.h:731
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
bool bIsPrescribedMotion(void) const
Definition: joint.cc:170
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
Solver * pSolver
Definition: dataman.h:99
virtual const Mat3x3 & GetRPrev(void) const
Definition: strnode.h:1000
doublereal dGetTimeStep(void) const
Definition: drive.h:393
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
virtual const Vec3 & GetVPrev(void) const
Definition: strnode.h:316
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
#define ASSERT(expression)
Definition: colamd.c:977
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
virtual unsigned int iGetNumDof(void) const =0
bool bIsTorque(void) const
Definition: joint.cc:176
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
Definition: joint.h:50
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
virtual const Vec3 & GetWPPrev(void) const
Definition: strnode.h:1036
DriveHandler DrvHdl
Definition: dataman.h:104
virtual const Vec3 & GetXPPPrev(void) const
Definition: strnode.h:328
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
void GetWeight(InverseDynamics::Order iOrder, doublereal &dw1, doublereal &dw2) const
Definition: invsolver.cc:895
long int integer
Definition: colamd.c:51
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssJac ( MatrixHandler JacHdl,
doublereal  dCoef 
)
virtual

Reimplemented in SchurDataManager.

Definition at line 392 of file elman.cc.

References ASSERT, DEBUGCOUT, ElemIter, Elems, and pWorkMat.

Referenced by Solver::Eig(), ThirdOrderIntegrator::Jacobian(), DerivativeSolver::Jacobian(), and StepNIntegrator::Jacobian().

393 {
394  DEBUGCOUT("Entering DataManager::AssJac()" << std::endl);
395 
396  ASSERT(pWorkMat != NULL);
397  ASSERT(Elems.begin() != Elems.end());
398 
399  AssJac(JacHdl, dCoef, ElemIter, *pWorkMat);
400 }
ElemVecType Elems
Definition: dataman.h:609
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual void AssJac(MatrixHandler &JacHdl, doublereal dCoef)
Definition: elman.cc:392
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
VariableSubMatrixHandler * pWorkMat
Definition: dataman.h:632
void DataManager::AssJac ( MatrixHandler JacHdl,
doublereal  dCoef,
VecIter< Elem * > &  Iter,
VariableSubMatrixHandler WorkMat 
)
protectedvirtual

Definition at line 403 of file elman.cc.

References Elem::AssJac(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), c, DEBUGCOUT, Elem::GetElemType(), WithLabel::GetLabel(), MatrixHandler::iGetNumCols(), MatrixHandler::iGetNumRows(), MBDYN_EXCEPT_ARGS, psElemNames, pXCurr, pXPrimeCurr, and MatrixHandler::Reset().

406 {
407  DEBUGCOUT("Entering DataManager::AssJac()" << std::endl);
408 
409  JacHdl.Reset();
410 
411 #if 0
412  for (int r = 1; r <= JacHdl.iGetNumRows(); r++) {
413  for (int c = 1; c <= JacHdl.iGetNumCols(); c++) {
414  if (JacHdl(r, c) != 0.) {
415  silent_cerr("JacHdl(" << r << "," << c << ")="
416  << JacHdl(r, c) << std::endl);
417  }
418  JacHdl(r, c) = std::numeric_limits<doublereal>::epsilon();
419  }
420  }
421 #endif
422 
423  Elem* pTmpEl = NULL;
424  if (Iter.bGetFirst(pTmpEl)) {
425  do {
426  try {
427  JacHdl += pTmpEl->AssJac(WorkMat, dCoef,
428  *pXCurr, *pXPrimeCurr);
429  }
430  catch (ErrDivideByZero) {
431  silent_cerr("AssJac: divide by zero "
432  "in " << psElemNames[pTmpEl->GetElemType()]
433  << "(" << pTmpEl->GetLabel() << ")"
434  << std::endl);
436  }
437 
438 #if 0
439  silent_cerr("### " << psElemNames[pTmpEl->GetElemType()] << "(" << pTmpEl->GetLabel() <<"):" << std::endl);
440  silent_cerr(JacHdl << std::endl);
441 #endif
442  } while (Iter.bGetNext(pTmpEl));
443  }
444 }
virtual integer iGetNumCols(void) const =0
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
virtual Elem::Type GetElemType(void) const =0
virtual void Reset(void)=0
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
static std::stack< cleanup * > c
Definition: cleanup.cc:59
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
unsigned int GetLabel(void) const
Definition: withlab.cc:62
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
virtual integer iGetNumRows(void) const =0
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssMats ( MatrixHandler A_Hdl,
MatrixHandler B_Hdl 
)
virtual

Definition at line 447 of file elman.cc.

References ASSERT, DEBUGCOUT, ElemIter, Elems, pWorkMatA, and pWorkMatB.

448 {
449  DEBUGCOUT("Entering DataManager::AssMats()" << std::endl);
450 
451  ASSERT(pWorkMatA != NULL);
452  ASSERT(pWorkMatB != NULL);
453  ASSERT(Elems.begin() != Elems.end());
454 
455  AssMats(A_Hdl, B_Hdl, ElemIter, *pWorkMatA, *pWorkMatB);
456 }
ElemVecType Elems
Definition: dataman.h:609
VariableSubMatrixHandler * pWorkMatA
Definition: dataman.h:630
VariableSubMatrixHandler * pWorkMatB
Definition: dataman.h:631
#define DEBUGCOUT(msg)
Definition: myassert.h:232
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
virtual void AssMats(MatrixHandler &A_Hdl, MatrixHandler &B_Hdl)
Definition: elman.cc:447
void DataManager::AssMats ( MatrixHandler A_Hdl,
MatrixHandler B_Hdl,
VecIter< Elem * > &  Iter,
VariableSubMatrixHandler WorkMatA,
VariableSubMatrixHandler WorkMatB 
)
protectedvirtual

Definition at line 459 of file elman.cc.

References Elem::AssMats(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DEBUGCOUT, pXCurr, and pXPrimeCurr.

463 {
464  DEBUGCOUT("Entering DataManager::AssMats()" << std::endl);
465 
466  /* Versione con iteratore: */
467  Elem* pTmpEl = NULL;
468  if (Iter.bGetFirst(pTmpEl)) {
469  /* Nuova versione, piu' compatta.
470  * La funzione propria AssJac, comune a tutti gli elementi,
471  * scrive nella WorkMat (passata come reference) il contributo
472  * dell'elemento allo jacobiano e restituisce un reference
473  * alla workmat stessa, che viene quindi sommata allo jacobiano.
474  * Ogni elemento deve provvedere al resizing della WorkMat e al
475  * suo reset ove occorra */
476 
477  /* il SubMatrixHandler e' stato modificato in modo da essere
478  * in grado di trasformarsi agevolmente da Full a Sparse
479  * e quindi viene gestito in modo automatico, e del tutto
480  * trasparente, il passaggio da un modo all'altro.
481  * L'elemento switcha la matrice nel modo che ritiene
482  * opportuno; l'operatore += capisce di quale matrice
483  * si sta occupando ed agisce di conseguenza.
484  */
485 
486  /* Con VariableSubMatrixHandler */
487  do {
488  pTmpEl->AssMats(WorkMatA, WorkMatB,
489  *pXCurr, *pXPrimeCurr);
490  A_Hdl += WorkMatA;
491  B_Hdl += WorkMatB;
492  } while (Iter.bGetNext(pTmpEl));
493  }
494 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
Definition: elem.h:75
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: elem.cc:55
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssRes ( VectorHandler ResHdl,
doublereal  dCoef 
)
virtual

Implements SolutionDataManager.

Reimplemented in SchurDataManager.

Definition at line 498 of file elman.cc.

References DEBUGCOUT, ElemIter, and pWorkVec.

Referenced by AssRes(), ThirdOrderIntegrator::Jacobian(), StepNIntegrator::Jacobian(), ThirdOrderIntegrator::Residual(), DerivativeSolver::Residual(), StepNIntegrator::Residual(), and InverseDynamicsStepSolver::Residual().

499 {
500  DEBUGCOUT("Entering AssRes()" << std::endl);
501 
502  AssRes(ResHdl, dCoef, ElemIter, *pWorkVec);
503 }
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
virtual void AssRes(VectorHandler &ResHdl, doublereal dCoef)
Definition: elman.cc:498
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VecIter< Elem * > ElemIter
Definition: dataman.h:612
void DataManager::AssRes ( VectorHandler ResHdl)
virtual

Definition at line 701 of file invdataman.cc.

References AssRes(), DEBUGCOUT, DataManager::ElemDataStructure::ElemContainer, ElemData, ElemIter, Elem::INERTIA, InverseDynamics::INVERSE_DYNAMICS, pWorkVec, pXCurr, pXPrimeCurr, and pXPrimePrimeCurr.

702 {
703  DEBUGCOUT("Entering AssRes()" << std::endl);
704  AssRes(ResHdl, ElemIter, *pWorkVec);
705 
706  for (ElemContainerType::iterator j = ElemData[Elem::INERTIA].ElemContainer.begin();
707  j != ElemData[Elem::INERTIA].ElemContainer.end(); ++j)
708  {
709  bool bActive(true);
710  Inertia *pI = Cast<Inertia>(j->second, true);
711  if (pI == 0) {
712  bActive = false;
713  pI = Cast<Inertia>(j->second, false);
714  }
715  if (pI && bActive)
716  {
717  ResHdl += j->second->AssRes(*pWorkVec, *pXCurr,
720  }
721  }
722 }
ElemContainerType ElemContainer
Definition: dataman.h:591
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
virtual void AssRes(VectorHandler &ResHdl, doublereal dCoef)
Definition: elman.cc:498
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
VecIter< Elem * > ElemIter
Definition: dataman.h:612
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssRes ( VectorHandler ResHdl,
doublereal  dCoef,
VecIter< Elem * > &  Iter,
SubVectorHandler WorkVec 
)
protectedvirtual

Definition at line 506 of file elman.cc.

References Elem::AssRes(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DEBUGCOUT, Elem::GetElemType(), WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, PrintResidual(), psElemNames, pXCurr, and pXPrimeCurr.

509 {
510  DEBUGCOUT("Entering AssRes()" << std::endl);
511 
512  Elem* pTmpEl = NULL;
513  bool ChangedEqStructure(false);
514  if (Iter.bGetFirst(pTmpEl)) {
515  do {
516  try {
517  ResHdl += pTmpEl->AssRes(WorkVec, dCoef,
518  *pXCurr, *pXPrimeCurr);
519  }
521  ResHdl += WorkVec;
522  ChangedEqStructure = true;
523  }
524  catch (ErrDivideByZero) {
525  silent_cerr("AssRes: divide by zero "
526  "in " << psElemNames[pTmpEl->GetElemType()]
527  << "(" << pTmpEl->GetLabel() << ")"
528  << std::endl);
530  }
531 
532 #if 0
533  silent_cerr("### " << psElemNames[pTmpEl->GetElemType()] << "(" << pTmpEl->GetLabel() <<"):" << std::endl);
534  PrintResidual(ResHdl, -1);
535 #endif
536 
537  } while (Iter.bGetNext(pTmpEl));
538  }
539  if (ChangedEqStructure) {
540  throw ChangedEquationStructure(MBDYN_EXCEPT_ARGS);
541  }
542 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
virtual Elem::Type GetElemType(void) const =0
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
virtual void PrintResidual(const VectorHandler &Res, integer iIterCnt) const
Definition: dataman2.cc:2603
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
unsigned int GetLabel(void) const
Definition: withlab.cc:62
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::AssRes ( VectorHandler ResHdl,
VecIter< Elem * > &  Iter,
SubVectorHandler WorkVec 
)
protected

Definition at line 725 of file invdataman.cc.

References Elem::AssRes(), Elem::BEAM, Elem::bIsRightHandSide(), Elem::BODY, DEBUGCOUT, DataManager::ElemDataStructure::ElemContainer, ElemData, Elem::FORCE, InverseDynamics::INVERSE_DYNAMICS, Elem::JOINT, Elem::LASTELEMTYPE, MBDYN_EXCEPT_ARGS, pXCurr, pXPrimeCurr, and pXPrimePrimeCurr.

728 {
729  DEBUGCOUT("Entering AssRes()" << std::endl);
730 
731  // TODO
732  // FIXME: could be as the rest?
733 
734  const Elem::Type ElemType[] = {
735  Elem::BODY,
736  Elem::BEAM,
737  Elem::FORCE,
738 
740  };
741 
742  bool ChangedEqStructure(false);
743 
744  for (int et = 0; ElemType[et] != Elem::LASTELEMTYPE; et++) {
745  for (ElemContainerType::iterator j = ElemData[ElemType[et]].ElemContainer.begin();
746  j != ElemData[ElemType[et]].ElemContainer.end(); ++j)
747  {
748  if (!j->second->bIsRightHandSide()) {
749  continue;
750  }
751 
752  try {
753  ResHdl += j->second->AssRes(WorkVec, *pXCurr,
756  }
758  ResHdl += WorkVec;
759  ChangedEqStructure = true;
760  }
761  }
762  }
763 
764  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
765  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
766  {
767  bool bActive(true);
768  Joint *pJ = Cast<Joint>(j->second, true);
769  if (pJ == 0) {
770  bActive = false;
771  pJ = Cast<Joint>(j->second, false);
772  }
773 
774  if (bActive && pJ->bIsRightHandSide()) {
775  try {
776  ResHdl += pJ->AssRes(WorkVec, *pXCurr,
779  }
781  ResHdl += WorkVec;
782  ChangedEqStructure = true;
783  }
784  }
785  }
786 
787  if (ChangedEqStructure) {
788  throw ChangedEquationStructure(MBDYN_EXCEPT_ARGS);
789  }
790 }
ElemContainerType ElemContainer
Definition: dataman.h:591
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bIsRightHandSide(void) const
Definition: elem.cc:89
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
Type
Definition: elem.h:91
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
Definition: joint.h:50
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

bool DataManager::bDoesOmegaRotate ( void  ) const

Definition at line 123 of file dataman2.cc.

References bOmegaRotates.

Referenced by ReadStructNode().

124 {
125  return bOmegaRotates;
126 }
bool bOmegaRotates
Definition: dataman.h:123
void DataManager::BeforePredict ( VectorHandler X,
VectorHandler XP,
VectorHandler XPrev,
VectorHandler XPPrev 
) const
virtual

Reimplemented in SchurDataManager.

Definition at line 2454 of file dataman2.cc.

References SimulationEntity::BeforePredict(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), ElemIter, and Nodes.

Referenced by Solver::Advance(), Solver::Prepare(), and Solver::Start().

2457 {
2458  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
2459  (*i)->BeforePredict(X, XP, XPrev, XPPrev);
2460  }
2461 
2462  /* Versione con iteratore: */
2463  Elem* pEl = NULL;
2464  if (ElemIter.bGetFirst(pEl)) {
2465  do {
2466  pEl->BeforePredict(X, XP, XPrev, XPPrev);
2467  } while (ElemIter.bGetNext(pEl));
2468  }
2469 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
NodeVecType Nodes
Definition: dataman.h:743
VecIter< Elem * > ElemIter
Definition: dataman.h:612
virtual void BeforePredict(VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
Definition: simentity.cc:82
Definition: elem.h:75
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88

Here is the call graph for this function:

DataManager::ElemContainerType::const_iterator DataManager::begin ( Elem::Type  t) const

Definition at line 902 of file dataman.cc.

References DataManager::ElemDataStructure::ElemContainer, and ElemData.

Referenced by DofOwnerInit(), LoadIncNorm::LoadIncNorm(), and TimeStep::TimeStep().

903 {
904  return ElemData[t].ElemContainer.begin();
905 }
ElemContainerType ElemContainer
Definition: dataman.h:591
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
DataManager::NodeContainerType::const_iterator DataManager::begin ( Node::Type  t) const

Definition at line 890 of file dataman.cc.

References DataManager::NodeDataStructure::NodeContainer, and NodeData.

891 {
892  return NodeData[t].NodeContainer.begin();
893 }
NodeContainerType NodeContainer
Definition: dataman.h:731
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
bool DataManager::bIsInverseDynamics ( void  ) const
inline

Definition at line 493 of file dataman.h.

References bInverseDynamics.

Referenced by ReadBeam2(), ReadBody(), and ReadVariableBody().

493  {
494  return bInverseDynamics;
495  };
bool bInverseDynamics
Definition: dataman.h:133
bool DataManager::bIsStaticModel ( void  ) const
inline

Definition at line 482 of file dataman.h.

References bStaticModel.

Referenced by ReadBody(), ReadStructNode(), and ReadVariableBody().

482  {
483  return bStaticModel;
484  };
bool bStaticModel
Definition: dataman.h:130
bool DataManager::bOutput ( ResType  t) const

Definition at line 694 of file dataman.cc.

References ResMode.

Referenced by ReadControl().

695 {
696  return (ResMode & t) ? true : false;
697 }
int ResMode
Definition: dataman.h:201
bool DataManager::bOutputAccelerations ( void  ) const

Definition at line 878 of file dataman.cc.

References bOutputAccels.

Referenced by ReadStructNode().

879 {
880  return bOutputAccels;
881 }
bool bOutputAccels
Definition: dataman.h:119
bool DataManager::bOutputDriveCallers ( void  ) const

Definition at line 884 of file dataman.cc.

References bOutputDriveCaller.

Referenced by DriveCallerRead::ReadOutput().

885 {
886  return bOutputDriveCaller;
887 }
bool bOutputDriveCaller
Definition: dataman.h:120
void DataManager::bSetInverseDynamics ( bool  b)
inline

Definition at line 490 of file dataman.h.

References bInverseDynamics.

490  {
491  bInverseDynamics = b;
492  };
bool bInverseDynamics
Definition: dataman.h:133
void DataManager::bSetStaticModel ( bool  b)
inline

Definition at line 479 of file dataman.h.

References bStaticModel.

479  {
480  bStaticModel = b;
481  };
bool bStaticModel
Definition: dataman.h:130
template<class T >
T * DataManager::Cast ( Elem pEl,
bool  bActive = false 
)
protected

Definition at line 875 of file dataman.h.

References ASSERT, DrivenElem::bIsActive(), Elem::GetElemType(), WithLabel::GetLabel(), MBDYN_EXCEPT_ARGS, NestedElem::pGetElem(), and psElemNames.

876 {
877  ASSERT(pEl != NULL);
878 
879  T *pT = dynamic_cast<T *>(pEl);
880 
881  if (pT == 0) {
882  DrivenElem *pDE = dynamic_cast<DrivenElem *>(pEl);
883  if (pDE == 0) {
884  silent_cerr("unable to cast "
885  << psElemNames[pEl->GetElemType()]
886  << "(" << pEl->GetLabel() << ") as \"" << mbdyn_demangle<T>() << "\" (not driven)" << std::endl);
888  }
889 
890  if (bActive && !pDE->bIsActive()) {
891  pedantic_cerr("unable to cast "
892  << psElemNames[pEl->GetElemType()]
893  << "(" << pEl->GetLabel() << ") as \"" << mbdyn_demangle<T>() << "\""
894  " (driven but currently inactive)" << std::endl);
895  return 0;
896  }
897 
898  pT = dynamic_cast<T *>(pDE->pGetElem());
899  if (pT == 0) {
900  pedantic_cerr("unable to cast "
901  << psElemNames[pEl->GetElemType()]
902  << "(" << pEl->GetLabel() << ") as \"" << mbdyn_demangle<T>() << "\""
903  " (driven but cast failed)" << std::endl);
904  }
905  }
906 
907  return pT;
908 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual Elem::Type GetElemType(void) const =0
#define ASSERT(expression)
Definition: colamd.c:977
const char * psElemNames[]
Definition: enums.cc:39
virtual Elem * pGetElem(void) const
Definition: nestedelem.cc:60
unsigned int GetLabel(void) const
Definition: withlab.cc:62
virtual bool bIsActive(void) const
Definition: driven.cc:74

Here is the call graph for this function:

int DataManager::Cleanup ( void  )

Definition at line 668 of file dataman.cc.

Referenced by datamanager_cleanup().

669 {
670 #ifdef USE_SOCKET
671  DeleteSocketUsers();
672 #endif // USE_SOCKET
673  return 0;
674 }
unsigned DataManager::ConvergedRegister ( void  )

Definition at line 2675 of file dataman2.cc.

References Converged::CONVERGED, and m_IsConverged.

Referenced by Converged::Register().

2676 {
2677  unsigned idx = m_IsConverged.size();
2678  m_IsConverged.resize(idx + 1);
2680  return idx;
2681 }
Converged_t m_IsConverged
Definition: dataman.h:399
void DataManager::ConvergedSet ( unsigned  idx,
Converged::State  s 
)

Definition at line 2684 of file dataman2.cc.

References ASSERT, and m_IsConverged.

Referenced by Converged::Set().

2685 {
2686  ASSERT(idx < m_IsConverged.size());
2687 
2688  m_IsConverged[idx] = s;
2689 }
Converged_t m_IsConverged
Definition: dataman.h:399
#define ASSERT(expression)
Definition: colamd.c:977
void DataManager::DerivativesUpdate ( void  ) const
virtual

Reimplemented in SchurDataManager.

Definition at line 2587 of file dataman2.cc.

References VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), SimulationEntity::DerivativesUpdate(), ElemIter, Nodes, pXCurr, and pXPrimeCurr.

Referenced by DerivativeSolver::Update().

2588 {
2589  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
2590  (*i)->DerivativesUpdate(*pXCurr, *pXPrimeCurr);
2591  }
2592 
2593  /* Versione con iteratore: */
2594  Elem* pEl = NULL;
2595  if (ElemIter.bGetFirst(pEl)) {
2596  do {
2598  } while (ElemIter.bGetNext(pEl));
2599  }
2600 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
NodeVecType Nodes
Definition: dataman.h:743
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Definition: elem.h:75
virtual void DerivativesUpdate(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: simentity.cc:105
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

doublereal DataManager::dGetDefaultScale ( DofOwner::Type  t) const
protected

Definition at line 64 of file dofman.cc.

References DofData.

Referenced by DofDataInit(), and dReadScale().

65 {
66  return DofData[t].dDefScale;
67 }
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
const doublereal & DataManager::dGetInitialPositionStiffness ( void  ) const

Definition at line 111 of file dataman2.cc.

References dInitialPositionStiffness.

Referenced by ReadStructNode().

112 {
114 }
doublereal dInitialPositionStiffness
Definition: dataman.h:121
const doublereal & DataManager::dGetInitialVelocityStiffness ( void  ) const

Definition at line 117 of file dataman2.cc.

References dInitialVelocityStiffness.

Referenced by ReadStructNode().

118 {
120 }
doublereal dInitialVelocityStiffness
Definition: dataman.h:122
doublereal DataManager::dGetTime ( void  ) const

Definition at line 165 of file dataman2.cc.

References DriveHandler::dGetTime(), and DrvHdl.

Referenced by DerivativeSolver::Advance(), Step1Integrator::Advance(), Step2Integrator::Advance(), ModuleFMU::AssRes(), ThirdOrderIntegrator::Jacobian(), LineSearchSolver::LineSearch(), ModuleFMU::ModuleFMU(), ThirdOrderIntegrator::Residual(), InverseSolver::Restart(), Solver::Restart(), and LineSearchSolver::Solve().

166 {
167  return DrvHdl.dGetTime();
168 } /* End of DataManager::dGetTime() */
doublereal dGetTime(void) const
Definition: drive.h:386
DriveHandler DrvHdl
Definition: dataman.h:104

Here is the call graph for this function:

void DataManager::DofDataInit ( void  )

Definition at line 69 of file dofman.cc.

References DEBUGLCOUT, dGetDefaultScale(), DofData, DofOwners, iTotDofOwners, DofOwner::LASTDOFTYPE, MBDYN_EXCEPT_ARGS, and MYDEBUG_INIT.

Referenced by DataManager().

70 {
71  /* struttura dei DofOwner */
72 
73  /* Calcola il numero totale di DofOwner */
74  for (int iCnt = 0; iCnt < DofOwner::LASTDOFTYPE; iCnt++) {
75  iTotDofOwners += DofData[iCnt].iNum;
76  }
77 
78  DEBUGLCOUT(MYDEBUG_INIT, "iTotDofOwners = " << iTotDofOwners << std::endl);
79 
80  /* Crea la struttura dinamica dei DofOwner */
81  if (iTotDofOwners > 0) {
82  DofOwners.resize(iTotDofOwners);
83 
84  /* Resetta la struttura dinamica dei DofOwner */
85  for (int iCnt = 0; iCnt < iTotDofOwners; iCnt++) {
86  DofOwners[iCnt].iFirstIndex = 0;
87  DofOwners[iCnt].iNumDofs = 0;
88  }
89 
90  /* Inizializza la struttura dinamica dei DofOwner
91  * con il numero di Dof di ognuno */
92  DofData[0].pFirstDofOwner = &DofOwners[0];
93  for (int iType = 0; iType < DofOwner::LASTDOFTYPE - 1; iType++) {
94  DofData[iType + 1].pFirstDofOwner =
95  DofData[iType].pFirstDofOwner+
96  DofData[iType].iNum;
97 
98  for (int iDof = 0; iDof < DofData[iType].iNum; iDof++) {
99  DofData[iType].pFirstDofOwner[iDof].SetScale(dGetDefaultScale(DofOwner::Type(iType)));
100  }
101  }
102 
103  } else {
104  /* Se non sono definiti DofOwners, la simulazione non ha senso,
105  * quindi il programma termina */
106  silent_cerr("warning, no dof owners are defined" << std::endl);
107  throw NoErr(MBDYN_EXCEPT_ARGS);
108  }
109 }
integer iTotDofOwners
Definition: dataman.h:795
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
doublereal dGetDefaultScale(DofOwner::Type t) const
Definition: dofman.cc:64
std::vector< DofOwner > DofOwners
Definition: dataman.h:796
Definition: except.h:79
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

void DataManager::DofInit ( void  )

Definition at line 111 of file dofman.cc.

References DEBUGCERR, DEBUGLCOUT, DofOrder::DIFFERENTIAL, DofOwners, Dofs, iTotDofOwners, iTotDofs, MBDYN_EXCEPT_ARGS, and MYDEBUG_INIT.

Referenced by DataManager().

112 {
113  if (iTotDofOwners > 0) {
114 
115  /* Di ogni DofOwner setta il primo indice
116  * e calcola il numero totale di Dof */
117  integer iIndex = 0; /* contatore dei Dof */
118  integer iNumDofs = 0; /* numero di dof di un owner */
119 
120  for (int iCnt = 0; iCnt < iTotDofOwners; iCnt++) {
121  iNumDofs = DofOwners[iCnt].iNumDofs;
122  if (iNumDofs > 0) {
123  DofOwners[iCnt].iFirstIndex = iIndex;
124  iIndex += iNumDofs;
125  } else {
126  DofOwners[iCnt].iFirstIndex = -1;
127  DEBUGCERR("warning, item " << (iCnt + 1) << " has 0 dofs" << std::endl);
128  }
129  }
130 
131  iTotDofs = iIndex;
132 
133  DEBUGLCOUT(MYDEBUG_INIT, "iTotDofs = " << iTotDofs << std::endl);
134  } else {
135  DEBUGCERR("");
136  silent_cerr("no dof owners are defined" << std::endl);
137 
139  }
140 
141 
142  /* Crea la struttura dinamica dei Dof */
143  if(iTotDofs > 0) {
144  Dofs.resize(iTotDofs);
145  integer iIndex = DofOwners[0].iFirstIndex;
146  for (DofIterator i = Dofs.begin(); i != Dofs.end(); ++i) {
147  i->iIndex = iIndex++;
148  i->Order = DofOrder::DIFFERENTIAL;
149  }
150  } else {
151  DEBUGCERR("");
152  silent_cerr("no dofs are defined" << std::endl);
153 
155  }
156 }
integer iTotDofOwners
Definition: dataman.h:795
DofVecType::iterator DofIterator
Definition: dataman.h:803
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
DofVecType Dofs
Definition: dataman.h:813
#define DEBUGCERR(msg)
Definition: myassert.h:235
std::vector< DofOwner > DofOwners
Definition: dataman.h:796
integer iTotDofs
Definition: dataman.h:809
long int integer
Definition: colamd.c:51
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
void DataManager::DofManager ( void  )

Definition at line 40 of file dofman.cc.

References DofData, DummyDofOwner, DofOwner::iFirstIndex, DofOwner::iNumDofs, and DofOwner::LASTDOFTYPE.

Referenced by DataManager().

41 {
44 
45  /* Resetta la struttura statica */
46  for(int i = 0; i < DofOwner::LASTDOFTYPE; i++) {
47  DofData[i].pFirstDofOwner = NULL;
48  DofData[i].iNum = 0;
49  DofData[i].iSize = 0;
50  DofData[i].dDefScale = 1.;
51  }
52 }
unsigned int iNumDofs
Definition: dofown.h:95
DofOwner DummyDofOwner
Definition: dataman.h:815
integer iFirstIndex
Definition: dofown.h:94
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
void DataManager::DofManagerDestructor ( void  )

Definition at line 56 of file dofman.cc.

References DEBUGCOUTFNAME.

Referenced by ~DataManager().

57 {
58  DEBUGCOUTFNAME("DataManager::DofManagerDestructor");
59 
60  // TODO: remove?
61 }
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
void DataManager::DofOwnerInit ( void  )
protected

Definition at line 182 of file dataman2.cc.

References ASSERT, begin(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DEBUG_LEVEL_MATCH, DEBUGCOUTFNAME, DEBUGLCOUT, Elem::DescribeDof(), Elem::DescribeEq(), Dofs, OutputHandler::DOFSTATS, OutputHandler::DofStats(), StructNode::DUMMY, ElemIter, Elem::GetConnectedNodes(), Elem::GetDofType(), Elem::GetElemType(), SimulationEntity::GetEqType(), WithLabel::GetLabel(), Node::GetNode(), Node::GetNodeType(), StructDispNode::GetStructDispNodeType(), StructNode::GetStructNodeType(), DofOwnerOwner::iGetFirstIndex(), StructDispNode::iGetFirstMomentumIndex(), StructDispNode::iGetFirstPositionIndex(), Elem::iGetNumDof(), Node::LASTNODETYPE, OutputHandler::Log(), MYDEBUG_ASSEMBLY, MYDEBUG_INIT, DataManager::NodeDataStructure::NodeContainer, NodeData, Nodes, OutputHandler::Open(), OutHdl, PRINT_DOF_DESCRIPTION, PRINT_DOF_STATS, PRINT_EL_CONNECTION, PRINT_EQ_DESCRIPTION, PRINT_NODE_CONNECTION, PRINT_TO_FILE, psElemNames, psNodeNames, StructDispNode::STATIC, StructNode::STATIC, Node::STRUCTURAL, and uPrintFlags.

Referenced by DataManager().

183 {
184  DEBUGCOUTFNAME("DataManager::DofOwnerInit");
185  ASSERT(!Dofs.empty());
186  ASSERT(!Nodes.empty());
187 
188  if ( uPrintFlags & PRINT_TO_FILE ) {
190  }
191 
192  std::ostream& out_ds = (uPrintFlags & PRINT_TO_FILE)
193  ? OutHdl.DofStats()
194  : std::cout;
195 
196  bool pds =
197 #ifdef DEBUG
199 #endif /* DEBUG */
200  (!silent_output && (uPrintFlags & PRINT_DOF_STATS));
201 
202  /* NOTE: further direct use of std::cout instead
203  * of silent_cout() macro because silent_cout is
204  * tested in "pds".
205  */
206  if (pds) {
207  out_ds << "Regular steps dof stats" << std::endl;
208  }
209 
210  /* per ogni nodo strutturale */
211  if (!NodeData[Node::STRUCTURAL].NodeContainer.empty()) {
212 
213  /*
214  * used by POD stuff: if any, output
215  * the list of the first dof (minus 1)
216  * of each structural node, so it's easy
217  * to get the struct node values
218  * in MATLAB: given a vector "X" with all
219  * the states, and a vector
220  * "v" with the first dof of each
221  * structural node, then the x coordinate
222  * is X(v+1) and so forth
223  */
224 
225  OutHdl.Log() << "struct node dofs:";
226  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
227  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
228  {
229  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
230  if (pNode) {
231  if (pNode->GetStructNodeType() == StructNode::DUMMY) {
232  continue;
233  }
234  OutHdl.Log() << " " << pNode->iGetFirstPositionIndex();
235  }
236  }
237  OutHdl.Log() << std::endl;
238 
239  OutHdl.Log() << "struct node eqs:";
240  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
241  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
242  {
243  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
244  if (pNode) {
245  if (pNode->GetStructNodeType() == StructNode::DUMMY) {
246  continue;
247  }
248  OutHdl.Log() << " " << pNode->iGetFirstMomentumIndex();
249  }
250  }
251  OutHdl.Log() << std::endl;
252 
253  OutHdl.Log() << "struct node momentum dofs:";
254  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
255  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
256  {
257  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
258  if (pNode) {
259  switch (pNode->GetStructNodeType()) {
260  case StructNode::STATIC:
261  case StructNode::DUMMY:
262  continue;
263 
264  default:
265  break;
266  }
267  OutHdl.Log() << " " << pNode->iGetFirstMomentumIndex();
268  }
269  }
270  OutHdl.Log() << std::endl;
271 
272  OutHdl.Log() << "struct node momentum eqs:";
273  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
274  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
275  {
276  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
277  if (pNode) {
278  switch (pNode->GetStructNodeType()) {
279  case StructNode::STATIC:
280  case StructNode::DUMMY:
281  continue;
282 
283  default:
284  break;
285  }
286  OutHdl.Log() << " " << pNode->iGetFirstIndex();
287  }
288  }
289  OutHdl.Log() << std::endl;
290 
291  OutHdl.Log() << "struct displacement node dofs:";
292  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
293  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
294  {
295  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
296  if (pDispNode) {
297  const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
298  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
299  continue;
300  }
301  OutHdl.Log() << " " << pDispNode->iGetFirstPositionIndex();
302  }
303  }
304  OutHdl.Log() << std::endl;
305 
306  OutHdl.Log() << "struct displacement node eqs:";
307  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
308  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
309  {
310  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
311  if (pDispNode) {
312  const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
313  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
314  continue;
315  }
316  OutHdl.Log() << " " << pDispNode->iGetFirstMomentumIndex();
317  }
318  }
319  OutHdl.Log() << std::endl;
320 
321  OutHdl.Log() << "struct displacement node momentum dofs:";
322  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
323  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
324  {
325  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
326  if (pDispNode) {
327  const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
328  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
329  continue;
330  }
331  switch (pDispNode->GetStructDispNodeType()) {
333  continue;
334 
335  default:
336  break;
337  }
338  OutHdl.Log() << " " << pDispNode->iGetFirstMomentumIndex();
339  }
340  }
341  OutHdl.Log() << std::endl;
342 
343  OutHdl.Log() << "struct displacement node momentum eqs:";
344  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
345  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
346  {
347  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
348  if (pDispNode) {
349  const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
350  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
351  continue;
352  }
353  switch (pDispNode->GetStructDispNodeType()) {
354  case StructNode::STATIC:
355  continue;
356 
357  default:
358  break;
359  }
360  OutHdl.Log() << " " << pDispNode->iGetFirstIndex();
361  }
362  }
363  OutHdl.Log() << std::endl;
364 
365  OutHdl.Log() << "struct node labels:";
366  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
367  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
368  {
369  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
370  if (pNode) {
371  if (pNode->GetStructNodeType() == StructNode::DUMMY) {
372  continue;
373  }
374  OutHdl.Log() << " " << pNode->GetLabel();
375  }
376  }
377  OutHdl.Log() << std::endl;
378 
379  OutHdl.Log() << "struct displacement node labels:";
380  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
381  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
382  {
383  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
384  if (pDispNode) {
385  const StructNode* pNode = dynamic_cast<const StructNode*>(pDispNode);
386  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
387  continue;
388  }
389  OutHdl.Log() << " " << pDispNode->GetLabel();
390  }
391  }
392  OutHdl.Log() << std::endl;
393  }
394 
395  /* per ogni nodo */
396  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
398  psNodeNames[(*i)->GetNodeType()]
399  << "(" << (*i)->GetLabel() << ")"
400  << std::endl);
401 
402  /* chiede al nodo quanti dof possiede */
403  unsigned int iNumDof = (*i)->iGetNumDof();
404  if (iNumDof > 0) {
405  ASSERT((*i)->iGetFirstIndex() >= 0);
406 
407  /* si fa passare il primo Dof */
408  Dof* pDf = &Dofs[(*i)->iGetFirstIndex()];
409 
410 #ifdef DEBUG
412  psNodeNames[(*i)->GetNodeType()]
413  << "(" << (*i)->GetLabel() << "): "
414  "first dof = " << pDf->iIndex + 1
415  << std::endl);
416 #endif /* DEBUG */
417 
418  if (pds) {
419  unsigned int nd = (*i)->iGetNumDof();
420  integer fd = pDf->iIndex;
421 
422  out_ds << psNodeNames[(*i)->GetNodeType()]
423  << "(" << (*i)->GetLabel() << "): "
424  << nd << " " << fd + 1;
425  if (nd > 1) {
426  out_ds << "->" << fd + nd;
427  }
428  out_ds << std::endl;
430  (*i)->DescribeDof(out_ds,
431  " ");
432  }
433 
435  (*i)->DescribeEq(out_ds,
436  " ");
437  }
438  }
439 
440  /* per ogni Dof, chiede al nodo di che tipo e' e lo
441  * setta nel DofOwner */
442  std::vector<std::string> DofDesc;
443  (*i)->DescribeDof(DofDesc);
444  if (DofDesc.size() == iNumDof) {
445  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
446  pDf[iCnt].Description = DofDesc[iCnt];
447  }
448 
449  } else {
450  std::ostringstream os;
451  os << psNodeNames[(*i)->GetNodeType()]
452  << "(" << (*i)->GetLabel() << ")";
453  std::string name(os.str());
454 
455  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
456  os.str(name);
457  os.seekp(0, std::ios_base::end);
458  os << ": dof(" << iCnt + 1 << ")";
459  pDf[iCnt].Description = os.str();
460  }
461  }
462 
463  std::vector<std::string> EqDesc;
464  (*i)->DescribeEq(EqDesc);
465  if (EqDesc.size() == iNumDof) {
466  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
467  pDf[iCnt].EqDescription = EqDesc[iCnt];
468  }
469 
470  } else {
471  std::ostringstream os;
472  os << psNodeNames[(*i)->GetNodeType()]
473  << "(" << (*i)->GetLabel() << ")";
474  std::string name(os.str());
475 
476  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
477  os.str(name);
478  os.seekp(0, std::ios_base::end);
479  os << ": equation(" << iCnt + 1 << ")";
480  pDf[iCnt].EqDescription = os.str();
481  }
482  }
483 
484  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
485  pDf[iCnt].Order = (*i)->GetDofType(iCnt);
486  pDf[iCnt].EqOrder = (*i)->GetEqType(iCnt);
487  }
488  }
489  }
490 
491  /* per ogni elemento */
492  Elem* pEl = NULL;
493  if (ElemIter.bGetFirst(pEl)) {
494  do {
495  ASSERT(pEl != NULL);
497  "Elem type " << pEl->GetElemType()
498  << " (" << psElemNames[pEl->GetElemType()]
499  << "(" << pEl->GetLabel() << "))" << std::endl);
500 
501  /* chiede all'elemento quanti dof possiede */
502  unsigned int iNumDof = pEl->iGetNumDof();
503  if (iNumDof > 0) {
504  ElemWithDofs* pEWD = Cast<ElemWithDofs>(pEl);
505 
506  ASSERT(pEWD->iGetFirstIndex() >= 0);
507 
508  /* si fa passare il DofOwner */
509  Dof* pDf = &Dofs[pEWD->iGetFirstIndex()];
510 
511 #ifdef DEBUG
513  psElemNames[pEl->GetElemType()]
514  << "(" << pEWD->GetLabel() << "): "
515  "first dof = " << pDf->iIndex + 1
516  << std::endl);
517 #endif /* DEBUG */
518 
519  if (pds) {
520  unsigned int nd = pEWD->iGetNumDof();
521  integer fd = pDf->iIndex;
522 
523  out_ds << psElemNames[pEWD->GetElemType()]
524  << "(" << pEWD->GetLabel() << "): "
525  << nd << " " << fd + 1;
526  if (nd > 1) {
527  out_ds << "->" << fd + nd;
528  }
529  out_ds << std::endl;
530  if (uPrintFlags & PRINT_DOF_DESCRIPTION) {
531  pEWD->DescribeDof(out_ds,
532  " ");
533  }
534 
535  if (uPrintFlags & PRINT_EQ_DESCRIPTION) {
536  pEWD->DescribeEq(out_ds,
537  " ");
538  }
539  }
540 
541 
542  /* per ogni Dof, chiede all'elemento
543  * di che tipo e' e lo setta
544  * nel DofOwner */
545  std::vector<std::string> DofDesc;
546  pEWD->DescribeDof(DofDesc);
547  if (DofDesc.size() == iNumDof) {
548  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
549  pDf[iCnt].Description = DofDesc[iCnt];
550  }
551 
552  } else {
553  std::ostringstream os;
554  os << psElemNames[pEWD->GetElemType()]
555  << "(" << pEWD->GetLabel() << ")";
556  std::string name(os.str());
557 
558  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
559  os.str(name);
560  os.seekp(0, std::ios_base::end);
561  os << ": dof(" << iCnt + 1 << ")";
562  pDf[iCnt].Description = os.str();
563  }
564  }
565 
566  std::vector<std::string> EqDesc;
567  pEWD->DescribeEq(EqDesc);
568  if (EqDesc.size() == iNumDof) {
569  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
570  pDf[iCnt].EqDescription = EqDesc[iCnt];
571  }
572 
573  } else {
574  std::ostringstream os;
575  os << psElemNames[pEWD->GetElemType()]
576  << "(" << pEWD->GetLabel() << ")";
577  std::string name(os.str());
578 
579  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
580  os.str(name);
581  os.seekp(0, std::ios_base::end);
582  os << ": equation(" << iCnt + 1 << ")";
583  pDf[iCnt].EqDescription = os.str();
584  }
585  }
586 
587  for (unsigned int iCnt = 0; iCnt < iNumDof; iCnt++) {
588  pDf[iCnt].Order = pEWD->GetDofType(iCnt);
589  pDf[iCnt].EqOrder = pEWD->GetEqType(iCnt);
590  }
591  }
592  } while (ElemIter.bGetNext(pEl));
593  }
594 
595  /* FIXME: this should rather go before initial assembly */
596  /* NOTE: we run code anyway, but only print if requested/allowed
597  * for consistency checking purposes */
598 
599  /* per ogni elemento */
600  if (ElemIter.bGetFirst(pEl)) {
601  /* create node connection structure */
602  typedef std::set<const Elem *> elmap;
603  typedef std::map<const Node *, elmap *> nodemap;
604  std::vector<nodemap> connectedElems(Node::LASTNODETYPE);
605 
606  /* element connections get populated directly by elements */
607  std::vector<const Node *> connectedNodes;
608 
610  out_ds << "Element connections" << std::endl;
611  }
612 
613  do {
614  pEl->GetConnectedNodes(connectedNodes);
615 
616  if (connectedNodes.size() > 0) {
617  if (uPrintFlags & PRINT_EL_CONNECTION) {
618  out_ds << psElemNames[pEl->GetElemType()]
619  << "(" << pEl->GetLabel() << ") connecting" << std::endl;
620  }
621  for (std::vector<const Node *>::const_iterator i = connectedNodes.begin();
622  i != connectedNodes.end(); ++i)
623  {
624  const Node *real_i = (*i)->GetNode();
625  if (uPrintFlags & PRINT_EL_CONNECTION) {
626  out_ds << " "
627  << psNodeNames[real_i->GetNodeType()]
628  << "(" << real_i->GetLabel() << ")" << std::endl;
629  }
630 
631  nodemap::iterator n = connectedElems[real_i->GetNodeType()].find(real_i);
632  if (n == connectedElems[real_i->GetNodeType()].end()) {
633  connectedElems[real_i->GetNodeType()][real_i] = new elmap;
634  }
635  connectedElems[real_i->GetNodeType()][real_i]->insert(pEl);
636  }
637 
638  } else {
639  if (uPrintFlags & PRINT_EL_CONNECTION) {
640  out_ds << psElemNames[pEl->GetElemType()]
641  << "(" << pEl->GetLabel() << ") not connected" << std::endl;
642  }
643  }
644 
645  } while (ElemIter.bGetNext(pEl));
646 
647 
649  out_ds << "Node connections" << std::endl;
650  }
651  for (unsigned t = 0; t < Node::LASTNODETYPE; t++) {
652  for (nodemap::iterator n = connectedElems[t].begin();
653  n != connectedElems[t].end(); ++n)
654  {
655  if (uPrintFlags & PRINT_NODE_CONNECTION) {
656  out_ds << psNodeNames[n->first->GetNodeType()]
657  << "(" << n->first->GetLabel() << ") connected to" << std::endl;
658  }
659  for (elmap::const_iterator e = n->second->begin();
660  e != n->second->end(); ++e)
661  {
662  if (uPrintFlags & PRINT_NODE_CONNECTION) {
663  out_ds << " "
664  << psElemNames[(*e)->GetElemType()]
665  << "(" << (*e)->GetLabel() << ")" << std::endl;
666  }
667  }
668 
669  delete n->second;
670  n->second = 0;
671  }
672  }
673  }
674 } /* End of DataManager::DofOwnerInit() */
virtual DofOrder::Order GetEqType(unsigned int i) const
Definition: simentity.h:138
#define DEBUG_LEVEL_MATCH(level)
Definition: myassert.h:241
virtual StructDispNode::Type GetStructDispNodeType(void) const =0
std::ostream & DofStats(void) const
Definition: output.h:594
Definition: node.h:67
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
DofVecType Dofs
Definition: dataman.h:813
NodeVecType Nodes
Definition: dataman.h:743
OutputHandler OutHdl
Definition: dataman.h:105
virtual Elem::Type GetElemType(void) const =0
NodeContainerType NodeContainer
Definition: dataman.h:731
bool Open(const OutputHandler::OutFiles out)
Definition: output.cc:298
virtual StructNode::Type GetStructNodeType(void) const =0
DataManager::ElemContainerType::const_iterator begin(Elem::Type t) const
Definition: dataman.cc:902
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:137
virtual integer iGetFirstMomentumIndex(void) const =0
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: elem.h:243
const char * psNodeNames[]
Definition: enums.cc:372
Definition: elem.h:75
virtual Node::Type GetNodeType(void) const =0
const char * psElemNames[]
Definition: enums.cc:39
virtual DofOrder::Order GetDofType(unsigned int) const
Definition: elem.cc:150
std::ostream & Log(void) const
Definition: output.h:541
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
Definition: dofown.h:59
const Node * GetNode(void) const
Definition: node.h:111
unsigned int GetLabel(void) const
Definition: withlab.cc:62
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
unsigned uPrintFlags
Definition: dataman.h:156
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:124

Here is the call graph for this function:

void DataManager::DofOwnerSet ( void  )
protected

Definition at line 1368 of file dataman2.cc.

References DEBUGCOUTFNAME, DEBUGLCOUT, DataManager::ElemDataStructure::DofOwnerType, DataManager::ElemDataStructure::ElemContainer, ElemData, Elem::GetElemType(), WithLabel::GetLabel(), Elem::iGetNumDof(), DofOwner::iNumDofs, Elem::LASTELEMTYPE, MYDEBUG_INIT, Nodes, DofOwnerOwner::pGetDofOwner(), psElemNames, and DofOwner::UNKNOWN.

Referenced by DataManager().

1369 {
1370  DEBUGCOUTFNAME("DataManager::DofOwnerSet");
1371 
1372  /* Setta i DofOwner dei nodi */
1373  for (NodeVecType::iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
1374  DofOwner* pDO = const_cast<DofOwner *>((*i)->pGetDofOwner());
1375  pDO->iNumDofs = (*i)->iGetNumDof();
1376  }
1377 
1378  /* Setta i DofOwner degli elementi (chi li possiede) */
1379  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1381  if (DT != DofOwner::UNKNOWN) {
1382  DEBUGLCOUT(MYDEBUG_INIT, "Elem type " << iCnt
1383  << " (" << psElemNames[iCnt] << ")"
1384  << std::endl);
1385 
1386  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1387  p != ElemData[iCnt].ElemContainer.end(); ++p)
1388  {
1389  ElemWithDofs* pEWD = Cast<ElemWithDofs>(p->second);
1390 
1392  << "(" << pEWD->GetLabel() << ")" << std::endl);
1393 
1394  DofOwner* pDO = const_cast<DofOwner *>(pEWD->pGetDofOwner());
1395  pDO->iNumDofs = pEWD->iGetNumDof();
1396  DEBUGLCOUT(MYDEBUG_INIT, " num dofs: " << pDO->iNumDofs << std::endl);
1397  }
1398  }
1399  }
1400 } /* end of DofOwnerSet() */
ElemContainerType ElemContainer
Definition: dataman.h:591
DofOwner::Type DofOwnerType
Definition: dataman.h:565
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
unsigned int iNumDofs
Definition: dofown.h:95
NodeVecType Nodes
Definition: dataman.h:743
virtual Elem::Type GetElemType(void) const =0
virtual const DofOwner * pGetDofOwner(void) const
Definition: dofown.h:113
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
const char * psElemNames[]
Definition: enums.cc:39
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

doublereal DataManager::dReadScale ( MBDynParser HP,
enum DofOwner::Type  t 
) const

Definition at line 1491 of file dataman3.cc.

References dGetDefaultScale(), HighParser::GetReal(), and HighParser::IsKeyWord().

Referenced by ReadNodes(), and ReadStructNode().

1492 {
1494 
1495  if (!HP.IsKeyWord("scale")) {
1496  return d;
1497  }
1498 
1499  if (!HP.IsKeyWord("default")) {
1500  d = HP.GetReal(d);
1501  }
1502 
1503  return d;
1504 }
doublereal dGetDefaultScale(DofOwner::Type t) const
Definition: dofman.cc:64
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
double doublereal
Definition: colamd.c:52
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

void DataManager::DriveOutput ( OutputHandler OH) const

Definition at line 2429 of file dataman2.cc.

References OutputHandler::DRIVECALLERS, MBDynParser::GetDriveCallerContainer(), OutputHandler::IsOpen(), and MBPar.

Referenced by Output().

2430 {
2432  return;
2433  }
2434 
2436 
2437  for (MBDynParser::DCType::const_iterator i = DC.begin(); i != DC.end(); ++i) {
2438  i->second->Output(OH);
2439  }
2440 }
const DCType & GetDriveCallerContainer(void) const
Definition: mbpar.cc:854
std::map< unsigned, const DriveCaller * > DCType
Definition: mbpar.h:207
bool IsOpen(int out) const
Definition: output.cc:395
MBDynParser & MBPar
Definition: dataman.h:97

Here is the call graph for this function:

void DataManager::DriveTrace ( OutputHandler OH) const

Definition at line 2415 of file dataman2.cc.

References MBDynParser::GetDriveCallerContainer(), OutputHandler::IsOpen(), MBPar, and OutputHandler::TRACES.

Referenced by Output().

2416 {
2417  if (!OH.IsOpen(OutputHandler::TRACES)) {
2418  return;
2419  }
2420 
2422 
2423  for (MBDynParser::DCType::const_iterator i = DC.begin(); i != DC.end(); ++i) {
2424  i->second->Trace(OH);
2425  }
2426 }
const DCType & GetDriveCallerContainer(void) const
Definition: mbpar.cc:854
std::map< unsigned, const DriveCaller * > DCType
Definition: mbpar.h:207
bool IsOpen(int out) const
Definition: output.cc:395
MBDynParser & MBPar
Definition: dataman.h:97

Here is the call graph for this function:

void DataManager::ElemAssInit ( void  )

Definition at line 318 of file elman.cc.

References ASSERT, VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DEBUGCOUT, DEBUGLCOUT, ElemIter, iMaxWorkNumColsJac, iMaxWorkNumItemsJac, iMaxWorkNumRowsJac, iMaxWorkNumRowsRes, MYDEBUG_INIT, pWorkMat, pWorkMatA, pWorkMatB, pWorkVec, SAFENEWWITHCONSTRUCTOR, and Elem::WorkSpaceDim().

Referenced by DataManager().

319 {
320  Elem* pE = 0;
321  if (ElemIter.bGetFirst(pE)) {
322  do {
323  /* Aggiorna le dimensioni massime degli spazi di lavoro */
324  integer iNumRows = 0;
325  integer iNumCols = 0;
326 
327  pE->WorkSpaceDim(&iNumRows, &iNumCols);
328 
329  if (iNumRows >= 0) {
330  // Assume a full Jacobian matrix
331  if (iNumRows > iMaxWorkNumRowsJac) {
332  iMaxWorkNumRowsJac = iNumRows;
333  DEBUGLCOUT(MYDEBUG_INIT, "Current max work rows number: "
334  << iMaxWorkNumRowsJac << std::endl);
335  }
336 
337  if (iNumCols > iMaxWorkNumColsJac) {
338  iMaxWorkNumColsJac = iNumCols;
339  DEBUGLCOUT(MYDEBUG_INIT, "Current max work cols number: "
340  << iMaxWorkNumColsJac << std::endl);
341  }
342  } else {
343  // Assume a sparse Jacobian matrix
344  iNumRows = std::abs(iNumRows);
345  }
346 
347  const integer iNumItems = iNumRows * iNumCols;
348 
349  if (iNumItems > iMaxWorkNumItemsJac) {
350  iMaxWorkNumItemsJac = iNumItems;
351  }
352 
353  if (iNumRows > iMaxWorkNumRowsRes) {
354  iMaxWorkNumRowsRes = iNumRows;
355  }
356 
357  } while (ElemIter.bGetNext(pE));
358  }
359 
364 
365  /* SubMatrixHandlers */
371 
377 
379 
383 
384  DEBUGCOUT("Creating working matrices:" << iMaxWorkNumRowsJac
385  << " x " << iMaxWorkNumColsJac << std::endl);
386 }
integer iMaxWorkNumItemsJac
Definition: dataman.h:628
VariableSubMatrixHandler * pWorkMatA
Definition: dataman.h:630
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
integer iMaxWorkNumRowsRes
Definition: dataman.h:625
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
VariableSubMatrixHandler * pWorkMatB
Definition: dataman.h:631
integer iMaxWorkNumRowsJac
Definition: dataman.h:626
#define DEBUGCOUT(msg)
Definition: myassert.h:232
integer iMaxWorkNumColsJac
Definition: dataman.h:627
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
Definition: elem.h:75
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const =0
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
long int integer
Definition: colamd.c:51
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
VariableSubMatrixHandler * pWorkMat
Definition: dataman.h:632

Here is the call graph for this function:

void DataManager::ElemDataInit ( void  )

Definition at line 248 of file elman.cc.

References VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DEBUGCERR, DEBUGCOUT, DriveData, ElemData, ElemIter, Elems, DataManager::ElemDataStructure::iExpectedNum, VecIter< T >::Init(), iTotDrive, Drive::LASTDRIVETYPE, Elem::LASTELEMTYPE, ppDrive, and SAFENEWARR.

Referenced by DataManager().

249 {
250  unsigned iTotElem = 0;
251 
252  /* struttura degli elementi */
253  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
254  iTotElem += ElemData[iCnt].iExpectedNum;
255  }
256 
257  DEBUGCOUT("iTotElem = " << iTotElem << std::endl);
258 
259  /* FIXME: reverse this:
260  * - read and populate ElemData[iCnt].ElemContainer first
261  * - then create Elems and fill it with Elem*
262  */
263  if (iTotElem > 0) {
264  Elems.resize(iTotElem);
265 
266  /* Inizializza l'iteratore degli elementi usato all'interno
267  * dell'ElemManager */
268  ElemIter.Init(&Elems[0], iTotElem);
269 
270  for (unsigned iCnt = 0; iCnt < iTotElem; iCnt++) {
271  Elems[iCnt] = 0;
272  }
273 
274  } else {
275  silent_cerr("warning, no elements are defined" << std::endl);
276  }
277 
278  /* struttura dei drivers */
279  for (int iCnt = 0; iCnt < Drive::LASTDRIVETYPE; iCnt++) {
280  iTotDrive += DriveData[iCnt].iNum;
281  }
282 
283  DEBUGCOUT("iTotDrive = " << iTotDrive << std::endl);
284 
285  if (iTotDrive > 0) {
287 
288  /* Puo' essere sostituito con un opportuno iteratore: */
289 #if 0
290  VecIter<Drive*> DriveIter(ppDrive, iTotDrive);
291  Drive* pTmp = NULL;
292  if (DriveIter.bGetFirst(pTmp)) {
293  do {
294  pTmp = NULL;
295  } while (DriveIter.bGetNext(pTmp));
296  }
297 #endif
298 
299  Drive** ppTmp = ppDrive;
300  while (ppTmp < ppDrive + iTotDrive) {
301  *ppTmp++ = NULL;
302  }
303 
304  DriveData[0].ppFirstDrive = ppDrive;
305  for (int iCnt = 0; iCnt < Drive::LASTDRIVETYPE-1; iCnt++) {
306  DriveData[iCnt+1].ppFirstDrive =
307  DriveData[iCnt].ppFirstDrive +
308  DriveData[iCnt].iNum;
309  }
310 
311  } else {
312  DEBUGCERR("warning, no drivers are defined" << std::endl);
313  }
314 }
ElemVecType Elems
Definition: dataman.h:609
Definition: drive.h:89
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
#define DEBUGCERR(msg)
Definition: myassert.h:235
unsigned int iTotDrive
Definition: dataman.h:622
#define DEBUGCOUT(msg)
Definition: myassert.h:232
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Drive ** ppDrive
Definition: dataman.h:621
void Init(const T *p, unsigned i)
Definition: veciter.h:79
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]

Here is the call graph for this function:

void DataManager::ElemManager ( void  )

Definition at line 51 of file elman.cc.

References OutputHandler::AERODYNAMIC, DofOwner::AERODYNAMIC, Elem::AERODYNAMIC, DofOwner::AEROMODAL, Elem::AEROMODAL, OutputHandler::AEROMODALS, Elem::AIRPROPERTIES, AIRPROPOWNER, OutputHandler::AIRPROPS, Elem::AUTOMATICSTRUCTURAL, Elem::BEAM, OutputHandler::BEAMS, Elem::BODY, Elem::BULK, DataManager::ElemDataStructure::DefaultOut(), DataManager::ElemDataStructure::Desc, DOFOWNER, DataManager::ElemDataStructure::DofOwnerType, DriveData, Elem::DRIVEN, DofOwner::ELECTRIC, Elem::ELECTRIC, DofOwner::ELECTRICBULK, Elem::ELECTRICBULK, ELEM, ElemData, EULER_123, Elem::EXTERNAL, OutputHandler::EXTERNALS, fDefaultOut, Elem::FORCE, OutputHandler::FORCES, DofOwner::GENEL, Elem::GENEL, OutputHandler::GENELS, DataManager::ElemDataStructure::GeneratesInertiaForces(), OutputHandler::GRAVITY, Elem::GRAVITY, GRAVITYOWNER, OutputHandler::HYDRAULIC, DofOwner::HYDRAULIC, Elem::HYDRAULIC, DataManager::ElemDataStructure::iDerivation, DataManager::ElemDataStructure::iExpectedNum, DofOwner::INDUCEDVELOCITY, Elem::INDUCEDVELOCITY, OutputHandler::INERTIA, Elem::INERTIA, INITIALASSEMBLY, DataManager::ElemDataStructure::IsUnique(), DofOwner::JOINT, Elem::JOINT, Elem::JOINT_REGULARIZATION, OutputHandler::JOINTS, Drive::LASTDRIVETYPE, Elem::LASTELEMTYPE, OutputHandler::LOADABLE, DofOwner::LOADABLE, Elem::LOADABLE, DataManager::ElemDataStructure::od, DataManager::ElemDataStructure::OutFile, AerodynamicOutput::OUTPUT_DEFAULT, Beam::OUTPUT_DEFAULT, DofOwner::PLATE, Elem::PLATE, OutputHandler::PLATES, OutputHandler::ROTORS, DataManager::ElemDataStructure::ShortDesc, DofOwner::THERMAL, Elem::THERMAL, OutputHandler::THERMALELEMENTS, DataManager::ElemDataStructure::ToBeUsedInAssembly(), DataManager::ElemDataStructure::uFlags, OutputHandler::UNKNOWN, DofOwner::UNKNOWN, DataManager::ElemDataStructure::uOutputFlags, and DataManager::ElemDataStructure::UsesAirProperties().

Referenced by DataManager().

52 {
53  /* Reset della struttura ElemData */
54  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
55  ElemData[i].iExpectedNum = 0;
57  ElemData[i].uFlags = 0U;
58  ElemData[i].DefaultOut(::fDefaultOut == 1); /* Da "output.h" */
59  ElemData[i].OutFile = OutputHandler::UNKNOWN; /* "output.h" */
60  ElemData[i].uOutputFlags = 0U;
61  ElemData[i].od = EULER_123;
62  }
63 
64  /* Add dof type */
76 
77  /* Add file type */
79  ElemData[Elem::AUTOMATICSTRUCTURAL].Desc = "AutomaticStructural";
81 
83  ElemData[Elem::JOINT].Desc = "Joint";
84  ElemData[Elem::JOINT].ShortDesc = "joint";
85 
87  ElemData[Elem::FORCE].Desc = "Force";
88  ElemData[Elem::FORCE].ShortDesc = "force";
89 
91  ElemData[Elem::BEAM].Desc = "Beam";
92  ElemData[Elem::BEAM].ShortDesc = "beam";
94 
96  ElemData[Elem::PLATE].Desc = "Plate";
97  ElemData[Elem::PLATE].ShortDesc = "plate";
98 
100  ElemData[Elem::AIRPROPERTIES].Desc = "AirProperties";
101  ElemData[Elem::AIRPROPERTIES].ShortDesc = "airprops";
102 
104  ElemData[Elem::GRAVITY].Desc = "Gravity";
105  ElemData[Elem::GRAVITY].ShortDesc = "gravity";
107 
109  ElemData[Elem::INDUCEDVELOCITY].Desc = "InducedVelocity";
111 
113  ElemData[Elem::AEROMODAL].Desc = "AerodynamicModal";
114  ElemData[Elem::AEROMODAL].ShortDesc = "aeromodal";
115 
117  ElemData[Elem::AERODYNAMIC].Desc = "Aerodynamic";
120 
122  ElemData[Elem::HYDRAULIC].Desc = "Hydraulic";
124 
126  ElemData[Elem::LOADABLE].Desc = "Loadable";
127  ElemData[Elem::LOADABLE].ShortDesc = "loadable";
128 
130  ElemData[Elem::GENEL].Desc = "Genel";
131  ElemData[Elem::GENEL].ShortDesc = "genel";
132 
134  ElemData[Elem::EXTERNAL].Desc = "External";
136 
138  ElemData[Elem::THERMAL].Desc = "Thermal";
139  ElemData[Elem::THERMAL].ShortDesc = "thermal";
140 
141  /* Inheritance scheme */
161 
162  /* Types that must be unique */
165 
166  /* Types that are used by default in initial assembly */
171 
172  /* Aggiungere qui se un tipo genera forze d'inerzia e quindi
173  * deve essere collegato all'elemento accelerazione di gravita' */
178 
179  /* Aggiungere qui se un tipo usa le proprieta' dell'aria e quindi
180  * deve essere collegato all'elemento proprieta' dell'aria */
186 
187  /* Reset della struttura DriveData */
188  for (int i = 0; i < Drive::LASTDRIVETYPE; i++) {
189  DriveData[i].ppFirstDrive = NULL;
190  DriveData[i].iNum = 0;
191  }
192 }
const flag fDefaultOut
Definition: output.h:639
DofOwner::Type DofOwnerType
Definition: dataman.h:565
OrientationDescription od
Definition: dataman.h:573
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
OutputHandler::OutFiles OutFile
Definition: dataman.h:568
void ToBeUsedInAssembly(bool b)
Definition: dataman.h:578
void GeneratesInertiaForces(bool b)
Definition: dataman.h:579
void UsesAirProperties(bool b)
Definition: dataman.h:580
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]

Here is the call graph for this function:

void DataManager::ElemManagerDestructor ( void  )

Definition at line 196 of file elman.cc.

References DEBUGCOUT, Elems, iTotDrive, ppDrive, psDriveNames, psElemNames, pWorkMatA, pWorkMatB, pWorkVec, SAFEDELETE, and SAFEDELETEARR.

Referenced by ~DataManager().

197 {
198  DEBUGCOUT("Entering DataManager::ElemManagerDestructor()" << std::endl);
199 
200  /* Distruzione matrici di lavoro per assemblaggio */
201  if (pWorkMatB != NULL) {
202  DEBUGCOUT("deleting assembly structure, SubMatrix B" << std::endl);
204  }
205 
206  if (pWorkMatA != NULL) {
207  DEBUGCOUT("deleting assembly structure, SubMatrix A" << std::endl);
209  }
210 
211  if (pWorkVec != NULL) {
212  DEBUGCOUT("deleting assembly structure, SubVector" << std::endl);
214  }
215 
216  for (ElemVecType::iterator p = Elems.begin(); p != Elems.end(); ++p) {
217  DEBUGCOUT("deleting element "
218  << psElemNames[(*p)->GetElemType()]
219  << "(" << (*p)->GetLabel() << ")"
220  << std::endl);
221  SAFEDELETE(*p);
222  }
223 
224  /* Distruzione drivers */
225  if (ppDrive != NULL) {
226  Drive** pp = ppDrive;
227  while (pp < ppDrive+iTotDrive) {
228  if (*pp != NULL) {
229  DEBUGCOUT("deleting driver "
230  << (*pp)->GetLabel()
231  << ", type "
232  << psDriveNames[(*pp)->GetDriveType()]
233  << std::endl);
234  SAFEDELETE(*pp);
235  }
236  pp++;
237  }
238 
239  DEBUGCOUT("deleting drivers structure" << std::endl);
241  }
242 }
ElemVecType Elems
Definition: dataman.h:609
VariableSubMatrixHandler * pWorkMatA
Definition: dataman.h:630
Definition: drive.h:89
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
MySubVectorHandler * pWorkVec
Definition: dataman.h:633
VariableSubMatrixHandler * pWorkMatB
Definition: dataman.h:631
unsigned int iTotDrive
Definition: dataman.h:622
#define DEBUGCOUT(msg)
Definition: myassert.h:232
Drive ** ppDrive
Definition: dataman.h:621
const char * psElemNames[]
Definition: enums.cc:39
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710
const char * psDriveNames[]
Definition: enums.cc:351
void DataManager::ElemOutput ( OutputHandler OH) const

Definition at line 583 of file elman.cc.

References VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), ElemIter, and ToBeOutput::Output().

Referenced by Output().

584 {
585  Elem* pTmpEl = NULL;
586 
587  if (ElemIter.bGetFirst(pTmpEl)) {
588  do {
589  pTmpEl->Output(OH);
590  } while (ElemIter.bGetNext(pTmpEl));
591  }
592 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Definition: elem.h:75
virtual void Output(OutputHandler &OH) const
Definition: output.cc:870
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88

Here is the call graph for this function:

void DataManager::ElemOutput ( OutputHandler OH,
const VectorHandler X,
const VectorHandler XP 
) const

Definition at line 595 of file elman.cc.

References VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), ElemIter, and ToBeOutput::Output().

597 {
598  Elem* pTmpEl = NULL;
599 
600  if (ElemIter.bGetFirst(pTmpEl)) {
601  do {
602  pTmpEl->Output(OH, X, XP);
603  } while (ElemIter.bGetNext(pTmpEl));
604  }
605 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Definition: elem.h:75
virtual void Output(OutputHandler &OH) const
Definition: output.cc:870
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88

Here is the call graph for this function:

void DataManager::ElemOutputPrepare ( OutputHandler OH)

Definition at line 545 of file elman.cc.

References ASSERT, VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DataManager::ElemDataStructure::ElemContainer, ElemData, ElemIter, OutputHandler::IsOpen(), Elem::LASTELEMTYPE, OutputHandler::NETCDF, ToBeOutput::OutputPrepare(), NcVar::put(), NcVar::set_cur(), and OutputHandler::UseNetCDF().

Referenced by OutputPrepare().

546 {
547 #ifdef USE_NETCDF
548  for (unsigned et = 0; et < Elem::LASTELEMTYPE; et++) {
549  if (ElemData[et].ElemContainer.size() && OH.UseNetCDF(ElemData[et].OutFile)) {
551  ASSERT(ElemData[et].Desc != 0);
552  ASSERT(ElemData[et].ShortDesc != 0);
553 
554  integer iNumElems = ElemData[et].ElemContainer.size();
555 
556  OutputHandler::AttrValVec attrs(1);
557  attrs[0] = OutputHandler::AttrVal("description", std::string(ElemData[et].Desc) + " elements labels");
558 
559  OutputHandler::NcDimVec dim(1);
560  dim[0] = OH.CreateDim(std::string(ElemData[et].ShortDesc) + "_elem_labels_dim", iNumElems);
561 
562  NcVar *VarLabels = OH.CreateVar(std::string("elem.") + ElemData[et].ShortDesc, ncInt, attrs, dim);
563 
564  ElemContainerType::const_iterator p = ElemData[et].ElemContainer.begin();
565  for (unsigned i = 0; i < unsigned(iNumElems); i++, p++) {
566  VarLabels->set_cur(i);
567  const long l = p->second->GetLabel();
568  VarLabels->put(&l, 1);
569  }
570  }
571  }
572 #endif // USE_NETCDF
573 
574  Elem* pTmpEl = 0;
575  if (ElemIter.bGetFirst(pTmpEl)) {
576  do {
577  pTmpEl->OutputPrepare(OH);
578  } while (ElemIter.bGetNext(pTmpEl));
579  }
580 }
ElemContainerType ElemContainer
Definition: dataman.h:591
NcBool set_cur(long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1)
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
bool UseNetCDF(int out) const
Definition: output.cc:491
bool IsOpen(int out) const
Definition: output.cc:395
virtual void OutputPrepare(OutputHandler &OH)
Definition: output.cc:863
#define ASSERT(expression)
Definition: colamd.c:977
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Definition: elem.h:75
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
long int integer
Definition: colamd.c:51
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
NcBool put(const ncbyte *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0)

Here is the call graph for this function:

DataManager::ElemContainerType::const_iterator DataManager::end ( Elem::Type  t) const

Definition at line 908 of file dataman.cc.

References DataManager::ElemDataStructure::ElemContainer, and ElemData.

Referenced by LoadIncNorm::LoadIncNorm(), and TimeStep::TimeStep().

909 {
910  return ElemData[t].ElemContainer.end();
911 }
ElemContainerType ElemContainer
Definition: dataman.h:591
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
DataManager::NodeContainerType::const_iterator DataManager::end ( Node::Type  t) const

Definition at line 896 of file dataman.cc.

References DataManager::NodeDataStructure::NodeContainer, and NodeData.

897 {
898  return NodeData[t].NodeContainer.end();
899 }
NodeContainerType NodeContainer
Definition: dataman.h:731
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
bool DataManager::EndOfSimulation ( void  ) const

Definition at line 2706 of file dataman2.cc.

References Converged::END_OF_SIMULATION, and m_IsConverged.

Referenced by Solver::Advance().

2707 {
2708  for (Converged_t::const_iterator i = m_IsConverged.begin();
2709  i != m_IsConverged.end(); ++i)
2710  {
2711  if (*i == Converged::END_OF_SIMULATION) {
2712  return true;
2713  }
2714  }
2715 
2716  return false;
2717 }
Converged_t m_IsConverged
Definition: dataman.h:399
flag DataManager::fGetDefaultOutputFlag ( const Elem::Type t) const
protected

Definition at line 727 of file elman.cc.

References DataManager::ElemDataStructure::bDefaultOut(), and ElemData.

Referenced by fReadOutput().

728 {
729  return ElemData[t].bDefaultOut();
730 }
bool bDefaultOut(void) const
Definition: dataman.h:587
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]

Here is the call graph for this function:

flag DataManager::fGetDefaultOutputFlag ( const Node::Type t) const
protected

Definition at line 171 of file nodeman.cc.

References DataManager::NodeDataStructure::bDefaultOut(), and NodeData.

172 {
173  return NodeData[t].bDefaultOut();
174 }
bool bDefaultOut(void) const
Definition: dataman.h:725
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]

Here is the call graph for this function:

template<class T >
flag DataManager::fReadOutput ( MBDynParser HP,
const T &  t 
) const

Definition at line 1064 of file dataman.h.

References fGetDefaultOutputFlag(), HighParser::GetBool(), and HighParser::IsKeyWord().

Referenced by asynchronous_machine::asynchronous_machine(), LoadableElem::BindCalls(), CyclocopterNoInflow::CyclocopterNoInflow(), CyclocopterPolimi::CyclocopterPolimi(), CyclocopterUniform1D::CyclocopterUniform1D(), CyclocopterUniform2D::CyclocopterUniform2D(), HydrodynamicPlainBearing::HydrodynamicPlainBearing(), InlineFriction::InlineFriction(), LoadIncForce::LoadIncForce(), LoadIncNorm::LoadIncNorm(), ModuleFMU::ModuleFMU(), ModuleIMU::ModuleIMU(), ModuleIMUConstraint::ModuleIMUConstraint(), ModuleMDS::ModuleMDS(), ModuleNonsmoothNode::ModuleNonsmoothNode(), ReadAerodynamicBeam(), ReadAerodynamicBeam2(), ReadAerodynamicBody(), ReadAerodynamicModal(), ReadAircraftInstruments(), ReadAirProperties(), ReadBeam(), ReadBeam2(), ReadBody(), ReadBulk(), ReadElectric(), ReadElems(), ReadForce(), ReadGenel(), ReadGenericAerodynamicForce(), ReadGravity(), ReadHBeam(), ReadHydraulicElem(), ReadJoint(), ReadMembrane4EAS(), ReadModal(), ReadModalExtForce(), ReadModalForce(), ReadModalMappingExtForce(), ReadNodes(), ReadOneElem(), ReadRotor(), ReadShell4EAS(), ReadShell4EASANS(), ReadStructExtForce(), ReadStructMappingExtForce(), ReadStructNode(), ReadStructuralForce(), ReadThermal(), ReadVariableBody(), Wheel2::Wheel2(), and Wheel4::Wheel4().

1065 {
1066  flag fDef = fGetDefaultOutputFlag(t);
1067  if (!HP.IsKeyWord("output")) {
1068  return fDef;
1069  }
1070 
1071  if (HP.IsKeyWord("no")) {
1072  return flag(0);
1073  }
1074 
1075  if (HP.IsKeyWord("yes")) {
1076  return flag(1);
1077  }
1078 
1079  if (HP.IsKeyWord("default")) {
1080  return fDef;
1081  }
1082 
1083  return HP.GetBool(fDef);
1084 }
long int flag
Definition: mbdyn.h:43
flag fGetDefaultOutputFlag(const Elem::Type &t) const
Definition: elman.cc:727
virtual bool GetBool(bool bDefval=false)
Definition: parser.cc:1010
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910

Here is the call graph for this function:

std::vector< doublereal > & DataManager::GetBufIn ( unsigned  uL)

Definition at line 2720 of file dataman2.cc.

References Drive::FILEDRIVE, BufferStreamDrive::GetBuf(), MBDYN_EXCEPT_ARGS, and pFindDrive().

2721 {
2722  Drive* pD = pFindDrive(Drive::FILEDRIVE, uL);
2723  if (pD == 0) {
2724  silent_cerr("unable to find FileDrive(" << uL << ")" << std::endl);
2726  }
2727 
2728  BufferStreamDrive *pBSD = dynamic_cast<BufferStreamDrive *>(pD);
2729  if (pBSD == 0) {
2730  silent_cerr("FileDrive(" << uL << ") is not a BufferStreamDrive" << std::endl);
2732  }
2733 
2734  return pBSD->GetBuf();
2735 }
Drive * pFindDrive(Drive::Type Typ, unsigned int uL) const
Definition: elman.cc:705
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: drive.h:89
std::vector< doublereal > & GetBuf(void)

Here is the call graph for this function:

doublereal * DataManager::GetBufInRaw ( unsigned  uL)

Definition at line 2750 of file dataman2.cc.

References Drive::FILEDRIVE, BufferStreamDrive_base::GetBufRaw(), MBDYN_EXCEPT_ARGS, and pFindDrive().

2751 {
2752  Drive* pD = pFindDrive(Drive::FILEDRIVE, uL);
2753  if (pD == 0) {
2754  silent_cerr("unable to find FileDrive(" << uL << ")" << std::endl);
2756  }
2757 
2758  BufferStreamDrive_base *pBSD = dynamic_cast<BufferStreamDrive_base *>(pD);
2759  if (pBSD == 0) {
2760  silent_cerr("FileDrive(" << uL << ") is not a BufferStreamDrive_base" << std::endl);
2762  }
2763 
2764  // NOTE: this cast is needed because the input buf must be writeable.
2765  return (doublereal *)pBSD->GetBufRaw();
2766 }
Drive * pFindDrive(Drive::Type Typ, unsigned int uL) const
Definition: elman.cc:705
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: drive.h:89
virtual const doublereal * GetBufRaw(void)=0
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

const std::vector< doublereal > & DataManager::GetBufOut ( unsigned  uL) const

Definition at line 2738 of file dataman2.cc.

References BufferStreamElem::GetBuf(), and MBDYN_EXCEPT_ARGS.

2739 {
2740  BufferStreamElem *pBSE = pFindElem<BufferStreamElem, StreamOutElem, Elem::SOCKETSTREAM_OUTPUT>(uL);
2741  if (pBSE == 0) {
2742  silent_cerr("unable to find StreamOutElem(" << uL << "), or not a BufferStreamElem" << std::endl);
2744  }
2745 
2746  return pBSE->GetBuf();
2747 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
const std::vector< doublereal > & GetBuf(void) const

Here is the call graph for this function:

const doublereal * DataManager::GetBufOutRaw ( unsigned  uL) const

Definition at line 2792 of file dataman2.cc.

References BufferStreamElem_base::GetBufRaw(), and MBDYN_EXCEPT_ARGS.

2793 {
2794  BufferStreamElem_base *pBSE = pFindElem<BufferStreamElem_base, StreamOutElem, Elem::SOCKETSTREAM_OUTPUT>(uL);
2795  if (pBSE == 0) {
2796  silent_cerr("unable to find StreamOutElem(" << uL << "), or not a BufferStreamElem_base" << std::endl);
2798  }
2799 
2800  return pBSE->GetBufRaw();
2801 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual const doublereal * GetBufRaw(void) const =0

Here is the call graph for this function:

virtual clock_t DataManager::GetCPUTime ( void  ) const
inlinevirtual

Definition at line 254 of file dataman.h.

Referenced by Solver::GetCPUTime().

254  {
255  return 0;
256  };
const std::string & DataManager::GetDofDescription ( int  i) const
virtual

Definition at line 2635 of file dataman2.cc.

References ASSERT, Dofs, and iTotDofs.

Referenced by Solver::Advance(), InitialJointAssembly(), Solver::Prepare(), and Solver::Start().

2636 {
2637  ASSERT(i > 0 && i <= iTotDofs);
2638  return Dofs[i - 1].Description;
2639 }
DofVecType Dofs
Definition: dataman.h:813
integer iTotDofs
Definition: dataman.h:809
#define ASSERT(expression)
Definition: colamd.c:977
const DofVecType& DataManager::GetDofs ( void  ) const
inline

Definition at line 806 of file dataman.h.

References Dofs.

Referenced by StepIntegrator::SetDataManager().

806 { return Dofs; };
DofVecType Dofs
Definition: dataman.h:813
DofOrder::Order DataManager::GetDofType ( int  i) const
virtual

Definition at line 2649 of file dataman2.cc.

References ASSERT, Dofs, and iTotDofs.

2650 {
2651  ASSERT(i > 0 && i <= iTotDofs);
2652  return Dofs[i - 1].Order;
2653 }
DofVecType Dofs
Definition: dataman.h:813
integer iTotDofs
Definition: dataman.h:809
#define ASSERT(expression)
Definition: colamd.c:977
const DataManager::ElemDataStructure& DataManager::GetElemDataStructure ( Elem::Type  Typ) const
inline

Definition at line 661 of file dataman.h.

References ElemData.

Referenced by ModelNameSpace::FindFunc(), and ModelNameSpace::GetFunc().

661 { return ElemData[Typ]; };
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
const std::string & DataManager::GetEqDescription ( int  i) const
virtual

Definition at line 2642 of file dataman2.cc.

References ASSERT, Dofs, and iTotDofs.

2643 {
2644  ASSERT(i > 0 && i <= iTotDofs);
2645  return Dofs[i - 1].EqDescription;
2646 }
DofVecType Dofs
Definition: dataman.h:813
integer iTotDofs
Definition: dataman.h:809
#define ASSERT(expression)
Definition: colamd.c:977
DofOrder::Order DataManager::GetEqType ( int  i) const
virtual

Definition at line 2656 of file dataman2.cc.

References ASSERT, Dofs, and iTotDofs.

2657 {
2658  ASSERT(i > 0 && i <= iTotDofs);
2659  return Dofs[i - 1].EqOrder;
2660 }
DofVecType Dofs
Definition: dataman.h:813
integer iTotDofs
Definition: dataman.h:809
#define ASSERT(expression)
Definition: colamd.c:977
const LoadableCalls * DataManager::GetLoadableElemModule ( std::string  name) const

Definition at line 58 of file dataman2.cc.

References MapOfLoadableElemHandlers.

Referenced by LoadableElemRead::Read(), and SetLoadableElemModule().

59 {
60  for (int j = 0; name[j]; j++) {
61  name[j] = tolower(name[j]);
62  }
63 
64  typedef std::map<std::string,const LoadableCalls *> mleh;
65  mleh::const_iterator i = MapOfLoadableElemHandlers.find(name);
66  if (i == MapOfLoadableElemHandlers.end()) {
67  return 0;
68  }
69  return i->second;
70 }
std::map< std::string, const LoadableCalls * > MapOfLoadableElemHandlers
Definition: dataman.h:102
MathParser& DataManager::GetMathParser ( void  ) const
inline

Definition at line 341 of file dataman.h.

References MathPar.

Referenced by DriveHint::pCreateDrive(), TplDriveHint< T >::pCreateDrive(), and TplVecHint< T >::pCreateVec().

341 { return MathPar; };
MathParser & MathPar
Definition: dataman.h:98
MBDynParser& DataManager::GetMBDynParser ( void  ) const
inline

Definition at line 342 of file dataman.h.

References MBPar.

Referenced by ModelNameSpace::FindFunc(), and ModelNameSpace::GetFunc().

342 { return MBPar; };
MBDynParser & MBPar
Definition: dataman.h:97
OrientationDescription DataManager::GetOrientationDescription ( void  ) const

Definition at line 857 of file dataman.cc.

References od.

Referenced by ModuleIMUConstraint::ModuleIMUConstraint(), and ReadOptionalOrientationDescription().

858 {
859  return this->od;
860 }
OrientationDescription od
Definition: dataman.h:229
std::ostream& DataManager::GetOutFile ( void  ) const
inline

Definition at line 325 of file dataman.h.

References OutHdl, and OutputHandler::Output().

Referenced by InverseSolver::Advance(), Solver::Advance(), output_eigenvalues(), InverseSolver::Prepare(), Solver::Prepare(), and Solver::Start().

325 { return OutHdl.Output(); };
OutputHandler OutHdl
Definition: dataman.h:105
std::ostream & Output(void) const
Definition: output.h:390

Here is the call graph for this function:

void DataManager::GetOutput ( Elem::Type  t,
unsigned &  flags,
OrientationDescription od 
) const

Definition at line 871 of file dataman.cc.

References ElemData, DataManager::ElemDataStructure::od, and DataManager::ElemDataStructure::uOutputFlags.

Referenced by ReadOptionalAerodynamicCustomOutput(), and ReadOptionalBeamCustomOutput().

872 {
873  flags = ElemData[t].uOutputFlags;
874  od = ElemData[t].od;
875 }
OrientationDescription od
Definition: dataman.h:573
OrientationDescription od
Definition: dataman.h:229
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
const VectorHandler* DataManager::GetpXCurr ( void  ) const
inline

Definition at line 853 of file dataman.h.

References pXCurr.

Referenced by LineSearchSolver::LineSearch(), and LineSearchSolver::Solve().

853  {
854  return pXCurr;
855  };
VectorHandler * pXCurr
Definition: dataman.h:108
const VectorHandler* DataManager::GetpXPCurr ( void  ) const
inline

Definition at line 857 of file dataman.h.

References pXPrimeCurr.

Referenced by LineSearchSolver::LineSearch(), and LineSearchSolver::Solve().

857  {
858  return pXPrimeCurr;
859  }
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
const Solver* DataManager::GetSolver ( void  ) const
inline

Definition at line 343 of file dataman.h.

References pSolver.

Referenced by InverseDynamicsStepSolver::Advance(), ModuleFMU::ModuleFMU(), and InverseDynamicsStepSolver::Update().

343 { return pSolver; };
Solver * pSolver
Definition: dataman.h:99
void DataManager::IDAfterConvergence ( void  ) const
virtual

Definition at line 834 of file invdataman.cc.

References SimulationEntity::AfterConvergence(), VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), DEBUGCOUTFNAME, ElemIter, Nodes, pXCurr, pXPrimeCurr, and pXPrimePrimeCurr.

Referenced by InverseDynamicsStepSolver::Advance().

835 {
836  DEBUGCOUTFNAME("DataManager::IDAfterConvergence");
837 
838  // Nodes:
839  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
840  (*i)->AfterConvergence(*pXCurr, *pXPrimeCurr, *pXPrimePrimeCurr);
841  }
842 
843  Elem* pEl = NULL;
844  if (ElemIter.bGetFirst(pEl)) {
845  do {
847  } while (ElemIter.bGetNext(pEl));
848  }
849 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
NodeVecType Nodes
Definition: dataman.h:743
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Definition: elem.h:75
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: simentity.cc:120
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::IDDofInit ( void  )

Definition at line 895 of file invdataman.cc.

References ASSERT, Elem::BEAM, Elem::bIsErgonomy(), Joint::bIsPrescribedMotion(), Elem::bIsRightHandSide(), Joint::bIsTorque(), bOutputAccels, DEBUGCERR, DEBUGLCOUT, DofOrder::DIFFERENTIAL, DofData, DofOwners, Dofs, DataManager::ElemDataStructure::ElemContainer, ElemData, InverseDynamics::FULLY_ACTUATED_COLLOCATED, InverseDynamics::FULLY_ACTUATED_NON_COLLOCATED, WithLabel::GetLabel(), DofOwner::iFirstIndex, iIDJointTotNumDofs, iIDNodeTotNumDofs, DofOwner::iNumDofs, iTotDofOwners, iTotDofs, Elem::JOINT, MBDYN_EXCEPT_ARGS, MYDEBUG_INIT, DataManager::NodeDataStructure::NodeContainer, NodeData, DofOwnerOwner::pGetDofOwner(), pSolver, Node::STRUCTURAL, DofOwner::STRUCTURALNODE, InverseDynamics::UNDERDETERMINED_FULLY_ACTUATED, and InverseDynamics::UNDERDETERMINED_UNDERACTUATED_COLLOCATED.

Referenced by DataManager().

896 {
897  if (iTotDofOwners == 0) {
898  silent_cerr("DataManager::IDDofInit: no dof owners are defined" << std::endl);
899 
901  }
902 
903  /* Di ogni DofOwner setta il primo indice
904  * e calcola il numero totale di Dof:
905  * poichè per il problema inverso non si
906  * possono aggiungere incognite diverse
907  * da posizione (velocità e accelerazione)
908  * dei nodi e reazioni vincolari, viene
909  * controllato che gli elementi che aggiungono
910  * dof siano solo nodi e vincoli.
911  *
912  * Per problemi mal posti (DoF nodi != Dof vincoli):
913  * iTotDofs = (DoF nodi) + (Dof vincoli), altrimenti
914  *
915  * Per problemi ben posti:
916  * iTotDofs = DoF nodi (= DoF vincoli)
917  */
918 
919  integer iRealTotDofs = 0;
920 
921  /* Mette gli indici ai DofOwner dei nodi strutturali: */
922  /* contatore dei Dof dei nodi */
923  integer iNodeIndex = 0;
924 
925  NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
926  for (int iDOm1 = 0; iDOm1 < DofData[DofOwner::STRUCTURALNODE].iNum;
927  ++iDOm1, ++i)
928  {
929  DofOwner *pDO = const_cast<DofOwner *>(i->second->pGetDofOwner());
930  unsigned iNumDofs = pDO->iNumDofs = i->second->iGetNumDof();
931  if (iNumDofs > 0) {
932  pDO->iFirstIndex = iNodeIndex;
933  iNodeIndex += iNumDofs;
934  iRealTotDofs += iNumDofs;
935 
936  } else {
937  // note: this could only be possible for dummy nodes?
938  pDO->iFirstIndex = -1;
939  DEBUGCERR("warning, Structural(" << i->second->GetLabel() << ") "
940  "(DofOwner #" << (iDOm1 + 1) << ") has 0 dofs" << std::endl);
941  }
942  }
943 
944  ASSERT(iNodeIndex == iIDNodeTotNumDofs);
945 
946  /* Gli indici dei nodi sono ok */
947 
948  if (bOutputAccels) {
949  for (NodeContainerType::iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
950  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
951  {
952  dynamic_cast<StructNode *>(n->second)->OutputAccelerations(true);
953  }
954  }
955 
956  /* Se il problema è ben posto, gli indici delle equazioni di vincolo
957  * hanno numerazione indipendente dai nodi. Altrimenti la numerazione
958  * è a partire dagli indici dei nodi (per fare spazio alla matrice
959  * peso nello jacobiano) */
960 
961  /* contatore dei Dof dei joint */
962  integer iJointIndex;
963  integer iPrescribedMotionJointIndex;
964  integer iTorqueJointIndex;
965  switch (dynamic_cast<InverseSolver *>(pSolver)->GetProblemType()) {
968  silent_cerr("DataManager::IDDofInit: nodeDoFs=" << iIDNodeTotNumDofs
969  << " jointDoFs=" << iIDJointTotNumDofs << std::endl);
971  }
972 
974  iJointIndex = 0;
975  iPrescribedMotionJointIndex = 0;
976  iTorqueJointIndex = 0;
977  break;
978 
981  iJointIndex = iNodeIndex;
982  iPrescribedMotionJointIndex = iNodeIndex;
983  iTorqueJointIndex = iNodeIndex;
984  break;
985 
986  default:
987  ASSERT(0);
989  }
990 
991  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
992  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
993  {
994  Joint *pJ = Cast<Joint>(j->second);
995  ASSERT(pJ != 0);
996 
997  DofOwner *pDO = const_cast<DofOwner *>(pJ->pGetDofOwner());
998  ASSERT(pDO != 0);
999 
1000  unsigned iNumDofs = pDO->iNumDofs;
1001  if (iNumDofs > 0) {
1002  pDO->iFirstIndex = iJointIndex;
1003  iRealTotDofs += iNumDofs;
1004  iJointIndex += iNumDofs;
1005  if (pJ->bIsPrescribedMotion()) {
1006  iPrescribedMotionJointIndex += iNumDofs;
1007  }
1008  if (pJ->bIsTorque()) {
1009  iTorqueJointIndex += iNumDofs;
1010  }
1011 
1012  } else {
1013  pDO->iFirstIndex = -1;
1014  DEBUGCERR("warning, Joint(" << j->second->GetLabel() << ") "
1015  "has 0 dofs" << std::endl);
1016  }
1017 
1018  const char *sTorque = pJ->bIsTorque() ? "T" : "_";
1019  const char *sPrescribedMotion = pJ->bIsPrescribedMotion() ? "P" : "_";
1020  const char *sErgonomy = pJ->bIsErgonomy() ? "E" : "_";
1021  const char *sRightHandSide = pJ->bIsRightHandSide() ? "R" : "_";
1022 
1023  silent_cout("Joint(" << pJ->GetLabel() << "): " << sTorque << sPrescribedMotion << sErgonomy << sRightHandSide << std::endl);
1024  }
1025 
1026  for (ElemContainerType::iterator j = ElemData[Elem::BEAM].ElemContainer.begin();
1027  j != ElemData[Elem::BEAM].ElemContainer.end(); ++j)
1028  {
1029  Beam2 *pB = Cast<Beam2>(j->second);
1030  ASSERT(pB != 0);
1031 
1032  const char *sTorque = "_";
1033  const char *sPrescribedMotion = "_";
1034  const char *sErgonomy = pB->bIsErgonomy() ? "E" : "_";
1035  const char *sRightHandSide = pB->bIsRightHandSide() ? "R" : "_";
1036 
1037  silent_cout("Beam2(" << pB->GetLabel() << "): " << sTorque << sPrescribedMotion << sErgonomy << sRightHandSide << std::endl);
1038  }
1039 
1040  switch (dynamic_cast<InverseSolver *>(pSolver)->GetProblemType()) {
1043  // fall thru
1044 
1046  iTotDofs = iNodeIndex;
1047  break;
1048 
1051  iTotDofs = iTorqueJointIndex;
1052  break;
1053 
1054  default:
1055  break;
1056  }
1057 
1058  iTotDofs = iJointIndex;
1059 
1060  DEBUGLCOUT(MYDEBUG_INIT, "iTotDofs = " << iTotDofs << std::endl);
1061 
1062 
1063  /* Crea la struttura dinamica dei Dof */
1064  if (iTotDofs == 0) {
1065  silent_cerr("DataManager::IDDofInit: no dofs defined" << std::endl);
1067  }
1068 
1069  Dofs.resize(iRealTotDofs); /* Inizializza l'iteratore sui Dof */
1070 
1071  /* Inizializza la struttura dinamica dei Dof */
1072  integer iIndex = DofOwners[0].iFirstIndex;
1073  for (integer idx = 0; idx < iRealTotDofs; idx++) {
1074  Dofs[idx].iIndex = iIndex++;
1075  Dofs[idx].Order = DofOrder::DIFFERENTIAL;
1076  }
1077 }
integer iTotDofOwners
Definition: dataman.h:795
ElemContainerType ElemContainer
Definition: dataman.h:591
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
unsigned int iNumDofs
Definition: dofown.h:95
DofVecType Dofs
Definition: dataman.h:813
int iIDNodeTotNumDofs
Definition: dataman.h:134
bool bIsErgonomy(void) const
Definition: elem.cc:83
Definition: beam2.h:50
bool bIsRightHandSide(void) const
Definition: elem.cc:89
#define DEBUGCERR(msg)
Definition: myassert.h:235
int iIDJointTotNumDofs
Definition: dataman.h:135
integer iFirstIndex
Definition: dofown.h:94
std::vector< DofOwner > DofOwners
Definition: dataman.h:796
NodeContainerType NodeContainer
Definition: dataman.h:731
integer iTotDofs
Definition: dataman.h:809
bool bIsPrescribedMotion(void) const
Definition: joint.cc:170
virtual const DofOwner * pGetDofOwner(void) const
Definition: dofown.h:113
Solver * pSolver
Definition: dataman.h:99
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
#define ASSERT(expression)
Definition: colamd.c:977
bool bIsTorque(void) const
Definition: joint.cc:176
Definition: joint.h:50
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
bool bOutputAccels
Definition: dataman.h:119

Here is the call graph for this function:

void DataManager::IDDofOwnerSet ( void  )
protected

Definition at line 852 of file invdataman.cc.

References DEBUGCOUTFNAME, DEBUGLCOUT, DataManager::ElemDataStructure::DofOwnerType, DataManager::ElemDataStructure::ElemContainer, ElemData, Elem::GetElemType(), WithLabel::GetLabel(), Elem::iGetNumDof(), iIDJointTotNumDofs, iIDNodeTotNumDofs, DofOwner::iNumDofs, Elem::JOINT, Elem::LASTELEMTYPE, MYDEBUG_INIT, Nodes, DofOwnerOwner::pGetDofOwner(), psElemNames, and DofOwner::UNKNOWN.

Referenced by DataManager().

853 {
854  DEBUGCOUTFNAME("DataManager::IDDofOwnerSet");
855 
856  /* Setta i DofOwner dei nodi */
857  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
858  DofOwner* pDO = const_cast<DofOwner *>((*i)->pGetDofOwner());
859  pDO->iNumDofs = (*i)->iGetNumDof();
860  iIDNodeTotNumDofs += pDO->iNumDofs;
861  }
862 
863  for (ElemContainerType::iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
864  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
865  {
866  ElemWithDofs* pEWD = Cast<ElemWithDofs>(j->second);
867  iIDJointTotNumDofs += pEWD->iGetNumDof();
868  }
869 
870  /* Setta i DofOwner degli elementi (chi li possiede) */
871  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
873  if (DT != DofOwner::UNKNOWN) {
874  DEBUGLCOUT(MYDEBUG_INIT, "Elem type " << iCnt
875  << " (" << psElemNames[iCnt] << ")"
876  << std::endl);
877 
878  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
879  p != ElemData[iCnt].ElemContainer.end(); ++p)
880  {
881  ElemWithDofs* pEWD = Cast<ElemWithDofs>(p->second);
882 
884  << "(" << pEWD->GetLabel() << ")" << std::endl);
885 
886  DofOwner* pDO = const_cast<DofOwner *>(pEWD->pGetDofOwner());
887  pDO->iNumDofs = pEWD->iGetNumDof();
888  DEBUGLCOUT(MYDEBUG_INIT, " num dofs: " << pDO->iNumDofs << std::endl);
889  }
890  }
891  }
892 }
ElemContainerType ElemContainer
Definition: dataman.h:591
DofOwner::Type DofOwnerType
Definition: dataman.h:565
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
unsigned int iNumDofs
Definition: dofown.h:95
int iIDNodeTotNumDofs
Definition: dataman.h:134
NodeVecType Nodes
Definition: dataman.h:743
virtual Elem::Type GetElemType(void) const =0
int iIDJointTotNumDofs
Definition: dataman.h:135
virtual const DofOwner * pGetDofOwner(void) const
Definition: dofown.h:113
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
const char * psElemNames[]
Definition: enums.cc:39
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

void DataManager::IDSetTest ( NonlinearSolverTestRange pResTest,
NonlinearSolverTestRange pSolTest,
bool  bFullResTest 
)
virtual

Definition at line 1111 of file invdataman.cc.

References Joint::bIsPrescribedMotion(), Joint::bIsTorque(), DataManager::ElemDataStructure::ElemContainer, ElemData, DofOwnerOwner::iGetFirstIndex(), Elem::iGetNumDof(), Elem::JOINT, Nodes, and NonlinearSolverTestRange::SetRange().

Referenced by InverseSolver::Prepare().

1112 {
1113  integer iFirstIndex = std::numeric_limits<integer>::max();
1114  integer iLastIndex = -1;
1115 
1116  for (NodeVecType::const_iterator n = Nodes.begin(); n != Nodes.end(); ++n) {
1117  integer iIndex = (*n)->iGetFirstIndex();
1118  integer iNumDofs = (*n)->iGetNumDof();
1119 
1120  if (iFirstIndex > iIndex) {
1121  iFirstIndex = iIndex;
1122  }
1123 
1124  if (iLastIndex < iIndex + iNumDofs) {
1125  iLastIndex = iIndex + iNumDofs;
1126  }
1127  }
1128 
1129  silent_cout("DataManager::IDSetTest(): SolTest range=[" << iFirstIndex + 1 << ":" << iLastIndex << "]" << std::endl);
1130 
1131  pSolTest->SetRange(iFirstIndex + 1, iLastIndex);
1132 
1133  iFirstIndex = std::numeric_limits<integer>::max();
1134  iLastIndex = -1;
1135 
1136  for (ElemContainerType::const_iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
1137  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
1138  {
1139  const Joint *pJ = Cast<Joint>(j->second);
1140  if (!pJ->bIsTorque() && !pJ->bIsPrescribedMotion()) {
1141  continue;
1142  }
1143 
1144  const ElemWithDofs* pEWD = Cast<ElemWithDofs>(j->second);
1145  integer iNumDofs = pEWD->iGetNumDof();
1146  if (iNumDofs > 0) {
1147  integer iIndex = pEWD->iGetFirstIndex();
1148 
1149  if (iFirstIndex > iIndex) {
1150  iFirstIndex = iIndex;
1151  }
1152 
1153  if (iLastIndex < iIndex + iNumDofs) {
1154  iLastIndex = iIndex + iNumDofs;
1155  }
1156  }
1157  }
1158 
1159  if (bFullResTest) {
1160  // NOTE: assumes *ALL* residual elements need to be evaluated! Use with care...
1161  iFirstIndex = 0;
1162  }
1163 
1164  silent_cout("DataManager::IDSetTest(): ResTest range=[" << iFirstIndex + 1 << ":" << iLastIndex << "]" << std::endl);
1165 
1166  pResTest->SetRange(iFirstIndex + 1, iLastIndex);
1167 }
ElemContainerType ElemContainer
Definition: dataman.h:591
NodeVecType Nodes
Definition: dataman.h:743
bool bIsPrescribedMotion(void) const
Definition: joint.cc:170
void SetRange(integer iFirstIndex, integer iLastIndex)
Definition: nonlin.cc:406
virtual unsigned int iGetNumDof(void) const
Definition: elem.cc:118
bool bIsTorque(void) const
Definition: joint.cc:176
Definition: joint.h:50
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]

Here is the call graph for this function:

int DataManager::iIDGetJointTotNumDofs ( void  ) const

Definition at line 1086 of file invdataman.cc.

References iIDJointTotNumDofs.

1087 {
1088  return iIDJointTotNumDofs;
1089 }
int iIDJointTotNumDofs
Definition: dataman.h:135
int DataManager::iIDGetNodeTotNumDofs ( void  ) const

Definition at line 1080 of file invdataman.cc.

References iIDNodeTotNumDofs.

1081 {
1082  return iIDNodeTotNumDofs;
1083 }
int iIDNodeTotNumDofs
Definition: dataman.h:134
int DataManager::iIDGetTotNumDofs ( void  ) const

Definition at line 1092 of file invdataman.cc.

References ASSERT, InverseDynamics::FULLY_ACTUATED_COLLOCATED, InverseDynamics::FULLY_ACTUATED_NON_COLLOCATED, iIDJointTotNumDofs, iIDNodeTotNumDofs, MBDYN_EXCEPT_ARGS, pSolver, InverseDynamics::UNDERDETERMINED_FULLY_ACTUATED, and InverseDynamics::UNDERDETERMINED_UNDERACTUATED_COLLOCATED.

1093 {
1094  switch (dynamic_cast<InverseSolver *>(pSolver)->GetProblemType()) {
1098  return iIDNodeTotNumDofs;
1099 
1103 
1104  default:
1105  ASSERT(0);
1107  }
1108 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
int iIDNodeTotNumDofs
Definition: dataman.h:134
int iIDJointTotNumDofs
Definition: dataman.h:135
Solver * pSolver
Definition: dataman.h:99
#define ASSERT(expression)
Definition: colamd.c:977
void DataManager::IncElemCount ( Elem::Type  type)

Definition at line 129 of file dataman2.cc.

References ElemData, and DataManager::ElemDataStructure::iExpectedNum.

Referenced by ReadStructNode().

130 {
131  /* FIXME: assert the data structure has not been allocated yet */
132  ElemData[type].iExpectedNum++;
133 }
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
void DataManager::InitialJointAssembly ( void  )
protected

Definition at line 679 of file dataman2.cc.

References VectorHandler::Add(), ASSERT, ASSERTMSG, SolutionManager::bGetConditionNumber(), StructNode::bOmegaRotates(), CurrSolver, DEBUG_LEVEL_MATCH, DEBUGLCOUT, defaultMemoryManager, dEpsilon, Elem::DescribeDof(), StructDispNode::DescribeDof(), Elem::DescribeEq(), StructDispNode::DescribeEq(), StructDispNode::dGetPositionStiffness(), StructDispNode::dGetVelocityStiffness(), dInitialAssemblyTol, DofData, DataManager::ElemDataStructure::DofOwnerType, Dofs, OutputHandler::DOFSTATS, OutputHandler::DofStats(), VectorHandler::Dot(), MyVectorHandler::Dot(), StructNode::DUMMY, DataManager::ElemDataStructure::ElemContainer, ElemData, GetDofDescription(), Elem::GetElemType(), InitialAssemblyIterator::GetFirst(), WithLabel::GetLabel(), InitialAssemblyIterator::GetNext(), StructDispNode::GetNodeType(), StructNode::GetRCurr(), StructNode::GetRPrev(), LinSol::GetSolutionManager(), StructNode::GetStructNodeType(), StructDispNode::GetVCurr(), StructDispNode::GetVPrev(), StructNode::GetWCurr(), StructNode::GetWPrev(), StructDispNode::GetXCurr(), StructDispNode::GetXPrev(), LinearSolver::ErrFactor::iCol, DofOwner::iFirstIndex, StructDispNode::iGetFirstPositionIndex(), StructDispNode::iGetInitialNumDof(), SubjectToInitialAssembly::iGetInitialNumDof(), iMaxInitialIterations, SubjectToInitialAssembly::InitialAssJac(), SubjectToInitialAssembly::InitialAssRes(), SubjectToInitialAssembly::InitialWorkSpaceDim(), iNum, DofOwner::iNumDofs, iTotDofs, DofOwner::JOINT, Elem::LASTELEMTYPE, LinkToSolution(), SolutionManager::MatrInitialize(), MBDYN_EXCEPT_ARGS, Mat3x3::MulMT(), Mat3x3::MulTV(), MYDEBUG_ASSEMBLY, MYDEBUG_INIT, MYDEBUG_JAC, MYDEBUG_MEM, MYDEBUG_RESIDUAL, DataManager::NodeDataStructure::NodeContainer, NodeData, OutputHandler::Open(), OutHdl, SolverDiagnostics::outputIters(), SolverDiagnostics::outputJac(), SolverDiagnostics::outputRes(), SolverDiagnostics::outputSol(), SolverDiagnostics::outputSolverConditionNumber(), CGR_Rot::Param, DofOwnerOwner::pGetDofOwner(), SolutionManager::pMatHdl(), SolutionManager::pResHdl(), PRINT_DOF_DESCRIPTION, PRINT_DOF_STATS, PRINT_EQ_DESCRIPTION, PRINT_TO_FILE, PrintResidual(), PrintSolution(), psElemNames, psNodeNames, SolutionManager::pSolHdl(), MatrixHandler::PutCoef(), R, VectorHandler::Reset(), MyVectorHandler::Reset(), SAFEDELETE, DofOwnerOwner::SetInitialValue(), SolutionManager::Solve(), grad::sqrt(), Node::STRUCTURAL, DofOwner::STRUCTURALNODE, DofOwner::UNKNOWN, and uPrintFlags.

Referenced by DataManager().

680 {
681  if ( uPrintFlags & PRINT_TO_FILE ) {
683  }
684 
685  std::ostream& out_ds = (uPrintFlags & PRINT_TO_FILE)
686  ? OutHdl.DofStats()
687  : std::cout;
688 
689  /* Costruisce la struttura temporanea dei Dof */
690 
692  "Warning, no joints are defined; "
693  "You shouldn't have reached this point");
695 
696  /* Nodi strutturali: mette gli indici ai DofOwner */
697  bool pds =
698 #ifdef DEBUG
700 #endif /* DEBUG */
701  (!silent_output && (uPrintFlags & PRINT_DOF_STATS));
702 
703  if (pds) {
704  out_ds << "Initial assembly dof stats" << std::endl;
705  }
706 
707  /* Numero totale di Dof durante l'assemblaggio iniziale */
708  integer iInitialNumDofs = 0;
709  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
710  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
711  {
712  iInitialNumDofs += dynamic_cast<const StructDispNode*>(i->second)->iGetInitialNumDof();
713  }
714 
715  /* Elementi: mette gli indici agli eventuali DofOwner */
716  for (int iCnt1 = 0; iCnt1 < Elem::LASTELEMTYPE; iCnt1++) {
717  /* Per ogni tipo di elemento */
718  if (ElemData[iCnt1].bToBeUsedInAssembly() && !ElemData[iCnt1].ElemContainer.empty()) {
719  /* Se deve essere usato nell'assemblaggio e ne sono definiti */
720 
721  /* Tipo di dof dell'elemento corrente */
722  DofOwner::Type CurrDofType =
723  ElemData[iCnt1].DofOwnerType;
724 
725  if (CurrDofType != DofOwner::UNKNOWN) {
726  ASSERT((unsigned)DofData[CurrDofType].iNum == ElemData[iCnt1].ElemContainer.size());
727 
728  /* Iterazione sugli Elem */
729  for (ElemContainerType::const_iterator e = ElemData[iCnt1].ElemContainer.begin();
730  e != ElemData[iCnt1].ElemContainer.end(); ++e)
731  {
732  InitialAssemblyElem *pEl = dynamic_cast<InitialAssemblyElem *>(e->second);
733  if (pEl == 0) {
734  /* Ignore elements
735  * not subjected
736  * to initial assembly */
737  continue;
738  }
739 
740  ElemWithDofs *pDOEl = dynamic_cast<ElemWithDofs *>(e->second);
741  if (pDOEl == 0) {
742  /* Ignore elements subjected
743  * to initial assembly
744  * but without dofs */
745  continue;
746  }
747 
748  iInitialNumDofs += pEl->iGetInitialNumDof();
749  }
750  }
751  }
752  }
753 
754  /*
755  * Alla fine, i DofOwner di nodi e joint contengono gli indici giusti per
756  * l'assemblaggio iniziale. Corrispondono a:
757  * - per ogni nodo:
758  * - posizione x
759  * - parametri di rotazione g
760  * - velocita' xP
761  * - velocita' angolare omega
762  * - per ogni joint:
763  * - se vincolo in posizione, reazione e sua derivata
764  * - se vincolo in velocita', reazione.
765  * - per vincoli misti si hanno reazioni ed eventualmente loro derivate
766  * in base al tipo
767  */
768 
769  /* Creazione e costruzione array Dof */
770  Dofs.resize(iInitialNumDofs);
771 
772  // just to make sure nothing strange occurs...
773  iTotDofs = iInitialNumDofs;
774 
775  integer iIndex; /* Indice dei gradi di liberta' */
776  for (iIndex = 0; iIndex < iInitialNumDofs; iIndex++) {
777  Dofs[iIndex].iIndex = iIndex;
778  }
779 
780  /* mette a posto i dof */
781  iIndex = 0;
782  for (NodeContainerType::const_iterator n = NodeData[Node::STRUCTURAL].NodeContainer.begin();
783  n != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++n)
784  {
785  // numero di dof di un owner
786  const StructDispNode *pNode = dynamic_cast<const StructDispNode *>(n->second);
787  unsigned int iNumDofs = pNode->iGetInitialNumDof();
788  if (iNumDofs > 0) {
789  DofOwner* pFDO = const_cast<DofOwner *>(pNode->pGetDofOwner());
790  pFDO->iNumDofs = iNumDofs;
791  pFDO->iFirstIndex = iIndex;
792  if (pds) {
793  unsigned int nd = iNumDofs;
794  integer fd = iIndex;
795 
796  out_ds << psNodeNames[pNode->GetNodeType()]
797  << "(" << pNode->GetLabel()
798  << "): " << nd << " " << fd + 1;
799  if (nd > 1) {
800  out_ds << "->" << fd + nd;
801  }
802  out_ds << std::endl;
804  pNode->DescribeDof(out_ds,
805  " ", true);
806  }
807 
809  pNode->DescribeEq(out_ds,
810  " ", true);
811  }
812  }
813 
814  std::vector<std::string> DofDesc;
815  pNode->DescribeDof(DofDesc, true);
816  if (DofDesc.size() == iNumDofs) {
817  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
818  Dofs[iIndex + iCnt].Description = DofDesc[iCnt];
819  }
820 
821  } else {
822  std::ostringstream os;
823  os << psNodeNames[pNode->GetNodeType()]
824  << "(" << pNode->GetLabel() << ")";
825  std::string name(os.str());
826 
827  for (unsigned int iCnt = 0; iCnt < iNumDofs; iCnt++) {
828  os.str(name);
829  os.seekp(0, std::ios_base::end);
830  os << ": dof(" << iCnt + 1 << ")";
831  Dofs[iIndex + iCnt].Description = os.str();
832  }
833  }
834 
835  std::vector<std::string> EqDesc;
836  pNode->DescribeEq(EqDesc, true);
837  if (EqDesc.size() == iNumDofs) {
838  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
839  Dofs[iIndex + iCnt].EqDescription = EqDesc[iCnt];
840  }
841 
842  } else {
843  std::ostringstream os;
844  os << psNodeNames[pNode->GetNodeType()]
845  << "(" << pNode->GetLabel() << ")";
846  std::string name(os.str());
847 
848  for (unsigned int iCnt = 0; iCnt < iNumDofs; iCnt++) {
849  os.str(name);
850  os.seekp(0, std::ios_base::end);
851  os << ": equation(" << iCnt + 1 << ")";
852  Dofs[iIndex + iCnt].EqDescription = os.str();
853  }
854  }
855 
856  iIndex += iNumDofs;
857 
858  } else {
859  pedantic_cerr(psNodeNames[pNode->GetNodeType()]
860  << "(" << n->second->GetLabel() << ") has 0 dofs"
861  << std::endl);
862  }
863  }
864 
865  /* Elementi: mette gli indici agli eventuali DofOwner */
866  for (int iCnt1 = 0; iCnt1 < Elem::LASTELEMTYPE; iCnt1++) {
867  /* Pre ogni tipo di elemento */
868  if (ElemData[iCnt1].bToBeUsedInAssembly() && !ElemData[iCnt1].ElemContainer.empty()) {
869  /* Se deve essere usato nell'assemblaggio e ne sono definiti */
870 
871  /* Tipo di dof dell'elemento corrente */
872  DofOwner::Type CurrDofType =
873  ElemData[iCnt1].DofOwnerType;
874 
875  if (CurrDofType != DofOwner::UNKNOWN) {
876  ASSERT((unsigned)DofData[CurrDofType].iNum == ElemData[iCnt1].ElemContainer.size());
877 
878  /* Iterazione sugli Elem */
879  for (ElemContainerType::const_iterator p = ElemData[iCnt1].ElemContainer.begin();
880  p != ElemData[iCnt1].ElemContainer.end();
881  ++p)
882  {
883  InitialAssemblyElem *pEl = dynamic_cast<InitialAssemblyElem *>(p->second);
884  if (pEl == 0) {
885  /* Ignore elements
886  * not subjected
887  * to initial assembly */
888  continue;
889  }
890 
891  ElemWithDofs *pDOEl = dynamic_cast<ElemWithDofs *>(p->second);
892  if (pDOEl == 0) {
893  /* Ignore elements subjected
894  * to initial assembly
895  * but without dofs */
896  continue;
897  }
898 
899  DofOwner *pDO = const_cast<DofOwner *>(pDOEl->pGetDofOwner());
900  ASSERT(pDO != 0);
901  // numero di dof di un owner
902  unsigned int iNumDofs = pEl->iGetInitialNumDof();
903  pDO->iNumDofs = iNumDofs;
904  if (iNumDofs > 0) {
905  pDO->iFirstIndex = iIndex;
906  if (pds) {
907  unsigned int nd = iNumDofs;
908  integer fd = iIndex;
909  ElemWithDofs* pEWD = Cast<ElemWithDofs>(p->second);
910 
911  out_ds << psElemNames[pEl->GetElemType()]
912  << "(" << pEl->GetLabel()
913  << "): " << nd << " " << fd + 1;
914  if (nd > 1) {
915  out_ds << "->" << fd + nd;
916  }
917  out_ds << std::endl;
918  if (uPrintFlags & PRINT_DOF_DESCRIPTION) {
919  pEWD->DescribeDof(out_ds,
920  " ", true);
921  }
922 
923  if (uPrintFlags & PRINT_EQ_DESCRIPTION) {
924  pEWD->DescribeEq(out_ds,
925  " ", true);
926  }
927  }
928 
929  std::vector<std::string> DofDesc;
930  pEl->DescribeDof(DofDesc, true);
931  if (DofDesc.size() == iNumDofs) {
932  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
933  Dofs[iIndex + iCnt].Description = DofDesc[iCnt];
934  }
935 
936  } else {
937  std::ostringstream os;
938  os << psElemNames[pEl->GetElemType()]
939  << "(" << pEl->GetLabel() << ")";
940  std::string name(os.str());
941 
942  for (unsigned int iCnt = 0; iCnt < iNumDofs; iCnt++) {
943  os.str(name);
944  os.seekp(0, std::ios_base::end);
945  os << ": dof(" << iCnt + 1 << ")";
946  Dofs[iIndex + iCnt].Description = os.str();
947  }
948  }
949 
950  std::vector<std::string> EqDesc;
951  pEl->DescribeEq(EqDesc, true);
952  if (EqDesc.size() == iNumDofs) {
953  for (unsigned iCnt = 0; iCnt < iNumDofs; iCnt++) {
954  Dofs[iIndex + iCnt].EqDescription = EqDesc[iCnt];
955  }
956 
957  } else {
958  std::ostringstream os;
959  os << psElemNames[pEl->GetElemType()]
960  << "(" << pEl->GetLabel() << ")";
961  std::string name(os.str());
962 
963  for (unsigned int iCnt = 0; iCnt < iNumDofs; iCnt++) {
964  os.str(name);
965  os.seekp(0, std::ios_base::end);
966  os << ": equation(" << iCnt + 1 << ")";
967  Dofs[iIndex + iCnt].EqDescription = os.str();
968  }
969  }
970 
971  iIndex += iNumDofs;
972 
973  } else {
974  pedantic_cerr(psElemNames[iCnt1]
975  << "(" << pEl->GetLabel() << ") "
976  "has 0 dofs" << std::endl);
977  }
978  }
979  }
980  }
981  }
982 
983  ASSERT(iIndex == iInitialNumDofs);
984 
985  /* Trova le massime dimensioni del workspace
986  * per l'assemblaggio iniziale */
987  integer iMaxRowsRes = 0;
988  integer iMaxRowsJac = 0;
989  integer iMaxColsJac = 0;
990  integer iMaxItemsJac = 0;
991 
993  InitialAssemblyElem* pEl = IAIter.GetFirst();
994  while (pEl != NULL) {
995  integer iCurrRows = 0;
996  integer iCurrCols = 0;
997  pEl->InitialWorkSpaceDim(&iCurrRows, &iCurrCols);
998 
999  if (iCurrRows >= 0) {
1000  // Assume a full Jacobian matrix
1001  iMaxRowsJac = std::max(iMaxRowsJac, iCurrRows);
1002  iMaxColsJac = std::max(iMaxColsJac, iCurrCols);
1003  } else {
1004  // Assume a sparse Jacobian matrix
1005  iCurrRows = std::abs(iCurrRows);
1006  }
1007 
1008  iMaxRowsRes = std::max(iMaxRowsRes, iCurrRows);
1009  iMaxItemsJac = std::max(iMaxItemsJac, iCurrRows * iCurrCols);
1010 
1011  pEl = IAIter.GetNext();
1012  }
1013 
1014  /* Ciclo di iterazioni fino a convergenza */
1015 
1016  /* Crea il solutore lineare, tenendo conto dei tipi
1017  * supportati, di quanto scelto nel file di configurazione
1018  * e di eventuali paraametri extra */
1019  SolutionManager* pSM = CurrSolver.GetSolutionManager(iInitialNumDofs);
1020 
1021 #ifdef DEBUG_MEMMANAGER
1023  "After initialisation in InitialJointAssembly" << std::endl
1024  << defaultMemoryManager << std::endl);
1025 #endif /* DEBUG_MEMMANAGER */
1026 
1027  MyVectorHandler X(iInitialNumDofs);
1028  X.Reset();
1029 
1030  /* Linka il DriveHandler al vettore soluzione */
1031  LinkToSolution(X, X);
1032 
1033  /* Setta i valori iniziali dei gradi di liberta' dei nodi strutturali
1034  * durante l'assemblaggio iniziale */
1035  for (NodeContainerType::iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
1036  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
1037  {
1038  dynamic_cast<StructDispNode *>(i->second)->SetInitialValue(X);
1039  }
1040 
1041  /* Setta i valori iniziali dei gradi di liberta' dei vincoli
1042  * durante l'assemblaggio iniziale */
1043  for (int iCnt1 = 0; iCnt1 < Elem::LASTELEMTYPE; iCnt1++) {
1044  /* Pre ogni tipo di elemento */
1045  if (ElemData[iCnt1].DofOwnerType != DofOwner::UNKNOWN &&
1046  ElemData[iCnt1].bToBeUsedInAssembly() &&
1047  !ElemData[iCnt1].ElemContainer.empty())
1048  {
1049  for (ElemContainerType::const_iterator p = ElemData[iCnt1].ElemContainer.begin();
1050  p != ElemData[iCnt1].ElemContainer.end(); ++p)
1051  {
1052  ElemWithDofs *pEWD = Cast<ElemWithDofs>(p->second);
1053  pEWD->SetInitialValue(X);
1054  }
1055  }
1056  }
1057 
1058  /* Vettore di lavoro */
1059  VectorHandler* pResHdl = pSM->pResHdl();
1060  MySubVectorHandler WorkVec(iMaxRowsRes);
1061 
1062  /* Matrice di lavoro */
1063  MatrixHandler* pMatHdl = pSM->pMatHdl();
1064  VariableSubMatrixHandler WorkMat(iMaxRowsJac, iMaxColsJac, iMaxItemsJac);
1065 
1066  /* Soluzione */
1067  VectorHandler* pSolHdl = pSM->pSolHdl();
1068 
1069  if (
1070 #ifdef DEBUG
1072 #endif /* DEBUG */
1073  outputIters())
1074  {
1075  silent_cout("Assembly Tol=" << dInitialAssemblyTol << std::endl);
1076  }
1077 
1078  /* Ciclo di assemblaggio */
1079  for (integer iNumIter = 0; ; iNumIter++) {
1080  /* Assemblo il residuo */
1081  pResHdl->Reset();
1082 
1083  /* Contributo dei nodi */
1084  for (NodeContainerType::iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
1085  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
1086  {
1087  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
1088  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
1089  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
1090  continue;
1091  }
1092 
1093  int iOffset = 3;
1094  if (pNode) {
1095  iOffset = 6;
1096  }
1097 
1098  integer iFirstIndex = pDispNode->iGetFirstPositionIndex();
1099 
1100  /* Nuova feature: ogni nodo ha la sua stiffness */
1101  doublereal dPosStiff = pDispNode->dGetPositionStiffness();
1102  doublereal dVelStiff = pDispNode->dGetVelocityStiffness();
1103 
1104  Vec3 TmpVec;
1105 
1106  /* Posizione: k*Delta_x = k(x_0-x) + F */
1107  TmpVec = pDispNode->GetXPrev() - pDispNode->GetXCurr();
1108  pResHdl->Add(iFirstIndex + 1, TmpVec*dPosStiff);
1109 
1110  if (pNode) {
1111  /* Rotazione: k*Delta_g = -k*g(R_Delta) + M */
1112  Mat3x3 RDelta = pNode->GetRPrev().MulMT(pNode->GetRCurr());
1113  TmpVec = Vec3(CGR_Rot::Param, RDelta);
1114  pResHdl->Add(iFirstIndex + 4, TmpVec*dPosStiff);
1115 
1116  /* Velocita' angolare: k*(Delta_w+(R_Delta*w0)/\Delta_g) =
1117  * k*(R_Delta*w0-w) + M */
1118  const Vec3& wPrev(pNode->GetWPrev());
1119  const Vec3& wCurr(pNode->GetWCurr());
1120 
1121  if (pNode->bOmegaRotates()) {
1122  /* con questa la velocita' angolare e' solidale
1123  * con il nodo */
1124  TmpVec = RDelta*wPrev - wCurr;
1125  } else {
1126  /* con questa la velocita' angolare e' solidale
1127  * col riferimento assoluto */
1128  TmpVec = wPrev - wCurr;
1129  }
1130 
1131  pResHdl->Add(iFirstIndex + iOffset + 4, TmpVec*dVelStiff);
1132  }
1133 
1134  /* Velocita': k*Delta_v = k*(v0-Delta_v) + F */
1135  TmpVec = pDispNode->GetVPrev() - pDispNode->GetVCurr();
1136  pResHdl->Add(iFirstIndex + iOffset + 1, TmpVec*dVelStiff);
1137 
1138  }
1139 
1140  /* Elementi (con iteratore): */
1141  pEl = IAIter.GetFirst();
1142  while (pEl != NULL) {
1143  try {
1144  *pResHdl += pEl->InitialAssRes(WorkVec, X);
1145  }
1147  // do nothing: Jacobian matrix
1148  // is always recomputed anyway...
1149  }
1150  pEl = IAIter.GetNext();
1151  }
1152 
1153  if (
1154 #ifdef DEBUG
1156 #endif /* DEBUG */
1157  outputRes())
1158  {
1159  /* Output del residuo */
1160  PrintResidual(*pResHdl, iNumIter);
1161  }
1162 
1163  /* Eseguo il test di convergenza; se e' positivo, esco */
1164  /* FIXME: why /(1.+X.Dot()) ??? */
1165  doublereal dTest = pResHdl->Dot()/(1. + X.Dot());
1166  if (!std::isfinite(dTest)) {
1167  silent_cerr("Assembly diverged; aborting..." << std::endl);
1169  }
1170  dTest = sqrt(dTest);
1171 
1172  if ((dTest <= dInitialAssemblyTol ||
1173  iNumIter >= iMaxInitialIterations) && (
1174 #ifdef DEBUG
1176 #endif /* DEBUG */
1177  outputIters()))
1178  {
1179  silent_cout("\tIteration(" << iNumIter << ") "
1180  "" << dTest << std::endl);
1181  }
1182 
1183  /* Se la tolleranza e' raggiunta, esce dal ciclo */
1184  if (dTest <= dInitialAssemblyTol) {
1185  DEBUGLCOUT(MYDEBUG_ASSEMBLY, "Initial assembly "
1186  "performed successfully in "
1187  << iNumIter << " iterations"
1188  << std::endl);
1189  goto endofcycle;
1190  }
1191 
1192  /* Se ho raggiunto il numero massimo di iterazioni */
1193  if (iNumIter >= iMaxInitialIterations) {
1194  silent_cerr("Initial assembly iterations "
1195  "reached maximum number "
1196  << iMaxInitialIterations << "; aborting..."
1197  << std::endl);
1199  }
1200 
1201  /* Assemblo lo jacobiano e risolvo */
1202  pSM->MatrInitialize();
1203 
1204  /* Contributo dei nodi */
1205  for (NodeContainerType::iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
1206  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
1207  {
1208  const StructDispNode *pDispNode = dynamic_cast<const StructDispNode *>(i->second);
1209  const StructNode *pNode = dynamic_cast<const StructNode *>(i->second);
1210  if (pNode && pNode->GetStructNodeType() == StructNode::DUMMY) {
1211  continue;
1212  }
1213 
1214  int iOffset = 3;
1215  if (pNode) {
1216  iOffset = 6;
1217  }
1218 
1219  integer iFirstIndex = pDispNode->iGetFirstPositionIndex();
1220 
1221  /* Nuova feature: ogni nodo ha la sua stiffness */
1222  doublereal dPosStiff = pDispNode->dGetPositionStiffness();
1223  doublereal dVelStiff = pDispNode->dGetVelocityStiffness();
1224 
1225  /* NOTE: iOffset equal to number of position/velocity equations */
1226  for (int iCnt = 1; iCnt <= iOffset; iCnt++) {
1227  /* Posizione, rotazione */
1228  integer iTmp = iFirstIndex + iCnt;
1229  pMatHdl->PutCoef(iTmp, iTmp, dPosStiff);
1230 
1231  /* Velocita', velocita' angolare */
1232  iTmp += iOffset;
1233  pMatHdl->PutCoef(iTmp, iTmp, dVelStiff);
1234  }
1235 
1236  if (pNode && pNode->bOmegaRotates()) {
1237  /* con questi la velocita' angolare e' solidale con il nodo */
1238 
1239  /* Velocita' angolare - termine di rotazione: R_Delta*w0/\ */
1240  const Mat3x3& R0 = pNode->GetRPrev();
1241  const Mat3x3& R = pNode->GetRCurr();
1242  const Vec3& W0 = pNode->GetWPrev();
1243  Vec3 TmpVec = R*(R0.MulTV(W0*dVelStiff));
1244 
1245  /* W1 in m(3, 2), -W1 in m(2, 3) */
1246  doublereal d = TmpVec(1);
1247  pMatHdl->PutCoef(iFirstIndex + iOffset + 6, iFirstIndex + 5, d);
1248  pMatHdl->PutCoef(iFirstIndex + iOffset + 5, iFirstIndex + 6, -d);
1249 
1250  /* W2 in m(1, 3), -W2 in m(3, 1) */
1251  d = TmpVec(2);
1252  pMatHdl->PutCoef(iFirstIndex + iOffset + 4, iFirstIndex + 6, d);
1253  pMatHdl->PutCoef(iFirstIndex + iOffset + 6, iFirstIndex + 4, -d);
1254 
1255  /* W3 in m(2, 1), -W3 in m(1, 2) */
1256  d = TmpVec(3);
1257  pMatHdl->PutCoef(iFirstIndex + iOffset + 5, iFirstIndex + 4, d);
1258  pMatHdl->PutCoef(iFirstIndex + iOffset + 4, iFirstIndex + 5, -d);
1259  } /* altrimenti la velocita' angolare e' solidale con il nodo */
1260  }
1261 
1262  /* Contributo degli elementi */
1263  pEl = IAIter.GetFirst();
1264  while (pEl != NULL) {
1265  *pMatHdl += pEl->InitialAssJac(WorkMat, X);
1266  pEl = IAIter.GetNext();
1267  }
1268 
1269  if (
1270 #ifdef DEBUG
1272 #endif /* DEBUG */
1273  outputJac())
1274  {
1275  silent_cout("Jacobian:" << std::endl
1276  << *pMatHdl);
1277  }
1278 
1279  /* Fattorizza e risolve con jacobiano e residuo appena calcolati */
1280  try {
1281  pSM->Solve();
1282  }
1283  catch (LinearSolver::ErrFactor& err) {
1284  silent_cerr("Initial assembly failed because no pivot element "
1285  "could be found for column " << err.iCol
1286  << " (" << GetDofDescription(err.iCol) << "); "
1287  "aborting..." << std::endl);
1289  }
1290 
1291  if (
1292 #ifdef DEBUG
1294 #endif /* DEBUG */
1295  outputSol())
1296  {
1297  /* Output della soluzione */
1298  PrintSolution(*pSolHdl, iNumIter);
1299  }
1300 
1302  if (outputIters()) {
1303  silent_cout("\tIteration(" << iNumIter << ") " << std::setw(12) << dTest << " J");
1304  }
1305 
1307  silent_cout(" cond=");
1308  doublereal dCond;
1309  if (pSM->bGetConditionNumber(dCond)) {
1310  silent_cout(dCond);
1311  } else {
1312  silent_cout("NA");
1313  }
1314  }
1315 
1316  silent_cout(std::endl);
1317  }
1318 
1319  /* Aggiorno la soluzione */
1320  if (dEpsilon != 1.) {
1321  *pSolHdl *= dEpsilon;
1322  }
1323  X += *pSolHdl;
1324 
1325  /* Correggo i nodi */
1326  for (NodeContainerType::iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
1327  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
1328  {
1329  dynamic_cast<StructDispNode *>(i->second)->InitialUpdate(X);
1330  }
1331  }
1332 
1333 endofcycle:
1334  /* Resetta e distrugge la struttura temporanea dei Dof */
1335 
1336  /* Elementi: rimette a posto il numero di Dof propri dei vincoli */
1337  for (int iCnt1 = 0; iCnt1 < Elem::LASTELEMTYPE; iCnt1++) {
1338  /* Per ogni tipo di elemento */
1339  if (ElemData[iCnt1].DofOwnerType != DofOwner::UNKNOWN &&
1340  ElemData[iCnt1].bToBeUsedInAssembly() &&
1341  !ElemData[iCnt1].ElemContainer.empty())
1342  {
1343  /* Se possiede dofs, se deve essere usato nell'assemblaggio
1344  * e se ne sono presenti */
1345  for (ElemContainerType::const_iterator p = ElemData[iCnt1].ElemContainer.begin();
1346  p != ElemData[iCnt1].ElemContainer.end();
1347  ++p)
1348  {
1349  ElemWithDofs *pEWD = Cast<ElemWithDofs>(p->second);
1350  DofOwner *pDO = const_cast<DofOwner *>(pEWD->pGetDofOwner());
1351  pDO->iNumDofs = p->second->iGetNumDof();
1352  }
1353  }
1354  }
1355 
1356  /* Dealloca il vettore dei Dof */
1357  ASSERT(!Dofs.empty());
1358 
1359  // restore
1360  iTotDofs = 0;
1361 
1362  SAFEDELETE(pSM);
1363 } /* End of InitialJointAssembly */
virtual const Vec3 & GetWPrev(void) const
Definition: strnode.h:1018
virtual void Reset(void)=0
virtual VectorHandler * pResHdl(void) const =0
#define DEBUG_LEVEL_MATCH(level)
Definition: myassert.h:241
ElemContainerType ElemContainer
Definition: dataman.h:591
const Param_Manip Param
Definition: matvec3.cc:644
bool outputIters(void) const
doublereal dEpsilon
Definition: dataman.h:126
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual unsigned int iGetInitialNumDof(void) const =0
Definition: matvec3.h:98
std::ostream & DofStats(void) const
Definition: output.h:594
DofOwner::Type DofOwnerType
Definition: dataman.h:565
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: strnode.cc:200
unsigned int iNumDofs
Definition: dofown.h:95
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
virtual Node::Type GetNodeType(void) const
Definition: strnode.cc:145
DofVecType Dofs
Definition: dataman.h:813
virtual const Vec3 & GetXPrev(void) const
Definition: strnode.h:304
OutputHandler OutHdl
Definition: dataman.h:105
virtual const std::string & GetDofDescription(int i) const
Definition: dataman2.cc:2635
SolutionManager *const GetSolutionManager(integer iNLD, integer iLWS=0) const
Definition: linsol.cc:455
virtual void SetInitialValue(VectorHandler &X)
Definition: dofown.cc:56
#define ASSERTMSG(expr, msg)
Definition: myassert.h:219
bool outputRes(void) const
bool outputJac(void) const
virtual const doublereal & dGetVelocityStiffness(void) const
Definition: strnode.h:427
integer iMaxInitialIterations
Definition: dataman.h:125
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const =0
virtual Elem::Type GetElemType(void) const =0
integer iFirstIndex
Definition: dofown.h:94
virtual doublereal Dot(void) const
Definition: vh.cc:244
virtual bool bOmegaRotates(void) const
Definition: strnode.h:1236
bool outputSolverConditionNumber(void) const
NodeContainerType NodeContainer
Definition: dataman.h:731
integer iTotDofs
Definition: dataman.h:809
bool Open(const OutputHandler::OutFiles out)
Definition: output.cc:298
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
virtual const DofOwner * pGetDofOwner(void) const
Definition: dofown.h:113
bool outputSol(void) const
virtual void PrintSolution(const VectorHandler &Sol, integer iIterCnt) const
Definition: dataman2.cc:2619
void LinkToSolution(VectorHandler &XCurr, VectorHandler &XPrimeCurr)
Definition: dataman2.cc:172
virtual StructNode::Type GetStructNodeType(void) const =0
virtual MatrixHandler * pMatHdl(void) const =0
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)=0
virtual const Mat3x3 & GetRPrev(void) const
Definition: strnode.h:1000
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
integer iCol
Definition: ls.h:60
virtual const Vec3 & GetVPrev(void) const
Definition: strnode.h:316
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)=0
virtual const doublereal & dGetPositionStiffness(void) const
Definition: strnode.h:421
virtual void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: mh.cc:384
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:137
virtual integer iGetFirstPositionIndex(void) const
Definition: strnode.h:452
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
virtual void Solve(void)=0
doublereal dInitialAssemblyTol
Definition: dataman.h:124
virtual unsigned int iGetInitialNumDof(void) const
Definition: strnode.h:298
#define ASSERT(expression)
Definition: colamd.c:977
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
virtual void MatrInitialize(void)
Definition: solman.cc:72
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
virtual void Add(integer iRow, const Vec3 &v)
Definition: vh.cc:63
#define defaultMemoryManager
Definition: mynewmem.h:691
unsigned int iNum
Definition: dataman.h:618
virtual void PrintResidual(const VectorHandler &Res, integer iIterCnt) const
Definition: dataman2.cc:2603
const char * psNodeNames[]
Definition: enums.cc:372
const char * psElemNames[]
Definition: enums.cc:39
bool bGetConditionNumber(doublereal &dCond) const
Definition: solman.cc:107
LinSol CurrSolver
Definition: dataman.h:127
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
virtual VectorHandler * pSolHdl(void) const =0
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
unsigned uPrintFlags
Definition: dataman.h:156
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: elem.cc:124
Mat3x3 R
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
Definition: strnode.cc:259
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710
Elem** DataManager::InsertElem ( ElemDataStructure eldata,
unsigned int  uLabel,
Elem pE 
)
inlineprotected

Definition at line 595 of file dataman.h.

References DataManager::ElemDataStructure::ElemContainer, and DataManager::ElemDataStructure::ElemMapToList.

Referenced by ReadElems(), and ReadOneElem().

595  {
596  eldata.ElemContainer.push_back(ElemContainerType::value_type(uLabel, pE));
597  eldata.ElemMapToList[uLabel] = --eldata.ElemContainer.end();
598  return &eldata.ElemContainer.back().second;
599  };
Node** DataManager::InsertNode ( NodeDataStructure nodedata,
unsigned int  uLabel,
Node pN 
)
inlineprotected

Definition at line 735 of file dataman.h.

References DataManager::NodeDataStructure::NodeContainer, and DataManager::NodeDataStructure::NodeMapToList.

Referenced by ReadNodes().

735  {
736  nodedata.NodeContainer.push_back(NodeContainerType::value_type(uLabel, pN));
737  nodedata.NodeMapToList[uLabel] = --nodedata.NodeContainer.end();
738  return &nodedata.NodeContainer.back().second;
739  };
NamedValue * DataManager::InsertSym ( const char *const  s,
const Real v,
int  redefine = 0 
)

Definition at line 838 of file dataman.cc.

References MathParser::InsertSym(), and MathPar.

839 {
840  return MathPar.InsertSym(s, v, redefine);
841 }
MathParser & MathPar
Definition: dataman.h:98
NamedValue * InsertSym(const char *const s, const Real &v, int redefine=0)
Definition: mathp.cc:4315

Here is the call graph for this function:

NamedValue * DataManager::InsertSym ( const char *const  s,
const Int v,
int  redefine = 0 
)

Definition at line 844 of file dataman.cc.

References MathParser::InsertSym(), and MathPar.

845 {
846  return MathPar.InsertSym(s, v, redefine);
847 }
MathParser & MathPar
Definition: dataman.h:98
NamedValue * InsertSym(const char *const s, const Real &v, int redefine=0)
Definition: mathp.cc:4315

Here is the call graph for this function:

bool DataManager::IsConverged ( void  ) const

Definition at line 2692 of file dataman2.cc.

References m_IsConverged, and Converged::NOT_CONVERGED.

Referenced by NonlinearSolver::MakeResTest(), and NonlinearSolver::MakeSolTest().

2693 {
2694  for (Converged_t::const_iterator i = m_IsConverged.begin();
2695  i != m_IsConverged.end(); ++i)
2696  {
2697  if (*i == Converged::NOT_CONVERGED) {
2698  return false;
2699  }
2700  }
2701 
2702  return true;
2703 }
Converged_t m_IsConverged
Definition: dataman.h:399
void DataManager::LinkToSolution ( VectorHandler XCurr,
VectorHandler XPrimeCurr 
)
virtual

Implements SolutionDataManager.

Definition at line 172 of file dataman2.cc.

References DrvHdl, DriveHandler::LinkToSolution(), pXCurr, and pXPrimeCurr.

Referenced by ThirdOrderIntegrator::Advance(), DerivativeSolver::Advance(), Step1Integrator::Advance(), Step2Integrator::Advance(), InverseDynamicsStepSolver::Advance(), InitialJointAssembly(), ThirdOrderIntegrator::Jacobian(), ThirdOrderIntegrator::Predict(), InverseSolver::Prepare(), Solver::Prepare(), and ThirdOrderIntegrator::Residual().

174 {
175  pXCurr = &XCurr;
176  pXPrimeCurr = &XPrimeCurr;
177  DrvHdl.LinkToSolution(XCurr, XPrimeCurr);
178 }
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
void LinkToSolution(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: drive.cc:260
DriveHandler DrvHdl
Definition: dataman.h:104
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::LinkToSolution ( VectorHandler XCurr,
VectorHandler XPrimeCurr,
VectorHandler XPrimePrimeCurr,
VectorHandler LambdaCurr 
)

Definition at line 81 of file invdataman.cc.

References DrvHdl, DriveHandler::LinkToSolution(), pLambdaCurr, pXCurr, pXPrimeCurr, and pXPrimePrimeCurr.

85 {
86  pXCurr = &XCurr;
87  pXPrimeCurr = &XPrimeCurr;
88  pXPrimePrimeCurr = &XPrimePrimeCurr;
89  pLambdaCurr = &LambdaCurr;
90 
91  DrvHdl.LinkToSolution(XCurr, XPrimeCurr);
92 }
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
VectorHandler * pLambdaCurr
Definition: dataman.h:113
void LinkToSolution(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: drive.cc:260
DriveHandler DrvHdl
Definition: dataman.h:104
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::MakeRestart ( void  )
virtual

Definition at line 699 of file dataman.cc.

References OutputHandler::Close(), dInitialAssemblyTol, dInitialPositionStiffness, dInitialVelocityStiffness, DriveData, DataManager::ElemDataStructure::ElemContainer, ElemData, Elems, VectorHandler::iGetSize(), iMaxInitialIterations, iNum, iTotDrive, Drive::LASTDRIVETYPE, Elem::LASTELEMTYPE, Node::LASTNODETYPE, DataManager::NodeDataStructure::NodeContainer, NodeData, Nodes, OutHdl, Node::PARAMETER, VectorHandler::pdGetVec(), ppDrive, pSolver, psReadControlDrivers, psReadControlElems, psReadControlNodes, pXCurr, pXPrimeCurr, OutputHandler::RESTART, OutputHandler::Restart(), Solver::Restart(), RestartEvery, OutputHandler::RestartOpen(), OutputHandler::RESTARTXSOL, OutputHandler::RestartXSol(), saveXSol, and sSimulationTitle.

Referenced by AfterConvergence(), and ~DataManager().

700 {
701  silent_cout("Making restart file ..." << std::endl);
703  /* Inizializzazione del file di restart */
704  time_t tCurrTime(time(0));
705  OutHdl.Restart() << "# Restart file prepared by Mbdyn, "
706  << ctime(&tCurrTime) << std::endl << std::endl;
707  /* Dati iniziali */
708  OutHdl.Restart() << "begin: data;" << std::endl
709  << "# uncomment this line to use the default integrator" << std::endl
710  << " integrator: multistep;" << std::endl
711  << "end: data;" << std::endl << std::endl
712  << "# the following block contains data for the multistep integrator"
713  << std::endl;
715 
716  /* Dati di controllo */
717  OutHdl.Restart() << "begin: control data;" << std::endl;
718 
719  /* Nodi */
720  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
721  if (!NodeData[iCnt].NodeContainer.empty()) {
722  OutHdl.Restart() << " " << psReadControlNodes[iCnt] << ": "
723  << NodeData[iCnt].NodeContainer.size() << ';' << std::endl;
724  }
725  }
726 
727  /* Drivers */
728  for (int iCnt = 0; iCnt < Drive::LASTDRIVETYPE; iCnt++) {
729  if (DriveData[iCnt].iNum > 0) {
730  OutHdl.Restart() << " "
731  << psReadControlDrivers[iCnt] << ": "
732  << DriveData[iCnt].iNum << ';' << std::endl;
733  }
734  }
735 
736  /* Elementi */
737  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
738  if (!ElemData[iCnt].ElemContainer.empty()) {
739  if (ElemData[iCnt].bIsUnique()) {
740  OutHdl.Restart() << " " << psReadControlElems[iCnt]
741  << ';' << std::endl;
742  } else {
743  OutHdl.Restart() << " " << psReadControlElems[iCnt] << ": "
744  << ElemData[iCnt].ElemContainer.size() << ';' << std::endl;
745  }
746  }
747  }
748 
749  if (sSimulationTitle != 0) {
750  OutHdl.Restart() << " title: \""
751  << sSimulationTitle << "\";" << std::endl;
752  }
753 
754  OutHdl.Restart() << std::endl
755  << "# comment this line if the model is to be modified!" << std::endl
756  << " skip initial joint assembly;" << std::endl
757  << "# uncomment the following lines to improve the satisfaction of constraints"
758  << std::endl
759  << " # initial stiffness: " << dInitialPositionStiffness << ", "
760  << dInitialVelocityStiffness << ';' << std::endl
761  << " # initial tolerance: " << dInitialAssemblyTol << ';' << std::endl
762  << " # max initial iterations: " << iMaxInitialIterations
763  << ';' << std::endl;
764  OutHdl.Restart() << "# uncomment this line if restart file is to be made again"
765  << std::endl
766  << " # make restart file;" << std::endl
767  << "# remember: it will replace the present file if you don't change its name"
768  << std::endl
769  << " default output: none";
770  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
771  if (NodeData[iCnt].bDefaultOut()) {
772  OutHdl.Restart() << ", " << psReadControlNodes[iCnt];
773  }
774  }
775  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
776  if (ElemData[iCnt].bDefaultOut()) {
777  OutHdl.Restart() << ", " << psReadControlElems[iCnt];
778  }
779  }
780  OutHdl.Restart() << "; " << std::endl;
781  if (saveXSol) {
782  OutHdl.Restart() << " read solution array;" << std::endl;
783  }
784  OutHdl.Restart() << "end: control data;" << std::endl << std::endl;
785 
786  /* Dati dei nodi */
787  OutHdl.Restart() << "begin: nodes;" << std::endl;
788  for (NodeVecType::const_iterator n = Nodes.begin(); n != Nodes.end(); ++n) {
789  (*n)->Restart(OutHdl.Restart());
790  }
791  OutHdl.Restart() << "end: nodes;" << std::endl << std::endl;
792 
793  /* Dati dei driver */
794  if (iTotDrive > 0) {
795  OutHdl.Restart() << "begin: drivers;" << std::endl;
796  for (Drive** ppTmpDrv = ppDrive;
797  ppTmpDrv < ppDrive+iTotDrive;
798  ppTmpDrv++)
799  {
800  (*ppTmpDrv)->Restart(OutHdl.Restart());
801 #if 0
802  OutHdl.Restart()
803  << " # file driver " << (*ppTmpDrv)->GetLabel()
804  << " is required" << std::endl;
805 #endif
806  }
807  OutHdl.Restart() << "end: drivers;" << std::endl << std::endl;
808  }
809 
810  /* Dati degli elementi */
811  OutHdl.Restart() << "begin: elements;" << std::endl;
812  for (ElemVecType::const_iterator e = Elems.begin();
813  e != Elems.end(); ++e)
814  {
815  (*e)->Restart(OutHdl.Restart());
816  }
817 
818  for (NodeContainerType::const_iterator n = NodeData[Node::PARAMETER].NodeContainer.begin();
819  n != NodeData[Node::PARAMETER].NodeContainer.end(); ++n)
820  {
821  dynamic_cast<const Elem2Param *>(n->second)->RestartBind(OutHdl.Restart());
822  }
823 
824  OutHdl.Restart() << "end: elements;" << std::endl;
825 
826  if (saveXSol) {
827  OutHdl.RestartXSol().write((char*)(pXCurr->pdGetVec()),
828  (pXCurr->iGetSize())*sizeof(double));
829  OutHdl.RestartXSol().write((char*)(pXPrimeCurr->pdGetVec()),
830  (pXPrimeCurr->iGetSize())*sizeof(double));
832  }
833 
835 }
eRestart RestartEvery
Definition: dataman.h:164
ElemVecType Elems
Definition: dataman.h:609
ElemContainerType ElemContainer
Definition: dataman.h:591
char * sSimulationTitle
Definition: dataman.h:158
virtual doublereal * pdGetVec(void) const =0
Definition: drive.h:89
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
NodeVecType Nodes
Definition: dataman.h:743
doublereal dInitialPositionStiffness
Definition: dataman.h:121
OutputHandler OutHdl
Definition: dataman.h:105
bool Close(const OutputHandler::OutFiles out)
Definition: output.cc:536
unsigned int iTotDrive
Definition: dataman.h:622
integer iMaxInitialIterations
Definition: dataman.h:125
virtual integer iGetSize(void) const =0
std::ostream & Restart(std::ostream &out, DataManager::eRestart type) const
Definition: solver.cc:1717
const char * psReadControlDrivers[]
Definition: enums.cc:357
NodeContainerType NodeContainer
Definition: dataman.h:731
bool saveXSol
Definition: dataman.h:175
Solver * pSolver
Definition: dataman.h:99
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
doublereal dInitialAssemblyTol
Definition: dataman.h:124
std::ostream & RestartXSol(void) const
Definition: output.h:478
const char * psReadControlNodes[]
Definition: enums.cc:387
doublereal dInitialVelocityStiffness
Definition: dataman.h:122
unsigned int iNum
Definition: dataman.h:618
std::ostream & Restart(void) const
Definition: output.h:471
Drive ** ppDrive
Definition: dataman.h:621
Definition: j2p.h:40
const char * psReadControlElems[]
Definition: enums.cc:122
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
bool RestartOpen(bool openResXSol=false)
Definition: output.cc:563
VectorHandler * pXCurr
Definition: dataman.h:108

Here is the call graph for this function:

void DataManager::NodeDataInit ( void  )

Definition at line 98 of file nodeman.cc.

References DEBUGCOUT, DataManager::NodeDataStructure::iExpectedNum, iTotNodes, Node::LASTNODETYPE, NodeData, and Nodes.

Referenced by DataManager().

99 {
100  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
102  }
103 
104  DEBUGCOUT("iTotNodes = " << iTotNodes << std::endl);
105 
106  if (iTotNodes > 0) {
107  Nodes.resize(iTotNodes);
108 
109  for (NodeVecType::iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
110  *i = 0;
111  }
112 
113  } else {
114  silent_cerr("warning, no nodes are defined" << std::endl);
115  }
116 }
NodeVecType Nodes
Definition: dataman.h:743
unsigned int iTotNodes
Definition: dataman.h:748
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
#define DEBUGCOUT(msg)
Definition: myassert.h:232
void DataManager::NodeManager ( void  )

Definition at line 44 of file nodeman.cc.

References OutputHandler::ABSTRACT, Node::ABSTRACT, DataManager::NodeDataStructure::DefaultOut(), DataManager::NodeDataStructure::Desc, OutputHandler::ELECTRIC, Node::ELECTRIC, fDefaultOut, Node::HYDRAULIC, DataManager::NodeDataStructure::iExpectedNum, Node::LASTNODETYPE, NodeData, DataManager::NodeDataStructure::OutFile, Node::PARAMETER, OutputHandler::PARAMETERS, OutputHandler::PRESNODES, DataManager::NodeDataStructure::ShortDesc, OutputHandler::STRNODES, Node::STRUCTURAL, Node::THERMAL, OutputHandler::THERMALNODES, DataManager::NodeDataStructure::uFlags, and OutputHandler::UNKNOWN.

Referenced by DataManager().

45 {
46  for (int i = 0; i < Node::LASTNODETYPE; i++) {
47 #if 0
48  NodeData[i].ppFirstNode = NULL;
49  NodeData[i].iNum = 0;
50 #endif
51  NodeData[i].iExpectedNum = 0;
52  NodeData[i].uFlags = 0U;
53  NodeData[i].DefaultOut(::fDefaultOut == 1); /* Da "output.h" */
54  NodeData[i].OutFile = OutputHandler::UNKNOWN; /* Da "output.h" */
55  }
56 
57  /* Se un tipo scrive su un file di output, aggiungere qui il tipo di file */
59  NodeData[Node::ABSTRACT].Desc = "Abstract";
61 
63  NodeData[Node::STRUCTURAL].Desc = "Structural";
65 
67  NodeData[Node::ELECTRIC].Desc = "Electric";
69 
71  NodeData[Node::THERMAL].Desc = "Thermal";
72  NodeData[Node::THERMAL].ShortDesc = "thermal";
73 
75  NodeData[Node::HYDRAULIC].Desc = "Pressure";
77 
79  NodeData[Node::PARAMETER].Desc = "Parameter";
81 }
const flag fDefaultOut
Definition: output.h:639
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
OutputHandler::OutFiles OutFile
Definition: dataman.h:725

Here is the call graph for this function:

void DataManager::NodeManagerDestructor ( void  )

Definition at line 84 of file nodeman.cc.

References DEBUGCOUT, Nodes, psNodeNames, and SAFEDELETE.

Referenced by ~DataManager().

85 {
86  DEBUGCOUT("Entering DataManager::NodeManagerDestructor()" << std::endl);
87 
88  for (NodeVecType::iterator p = Nodes.begin(); p != Nodes.end(); ++p) {
89  DEBUGCOUT("deleting node "
90  << psNodeNames[(*p)->GetNodeType()]
91  << "(" << (*p)->GetLabel() << ")"
92  << std::endl);
93  SAFEDELETE(*p);
94  }
95 }
NodeVecType Nodes
Definition: dataman.h:743
#define DEBUGCOUT(msg)
Definition: myassert.h:232
const char * psNodeNames[]
Definition: enums.cc:372
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710
void DataManager::NodeOutput ( OutputHandler OH) const

Definition at line 152 of file nodeman.cc.

References Nodes.

Referenced by Output().

153 {
154  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
155  (*i)->Output(OH);
156  }
157 }
NodeVecType Nodes
Definition: dataman.h:743
void DataManager::NodeOutput ( OutputHandler OH,
const VectorHandler X,
const VectorHandler XP 
) const

Definition at line 160 of file nodeman.cc.

References Nodes.

164 {
165  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
166  (*i)->Output(OH, X, XP);
167  }
168 }
NodeVecType Nodes
Definition: dataman.h:743
void DataManager::NodeOutputPrepare ( OutputHandler OH)

Definition at line 119 of file nodeman.cc.

References ASSERT, OutputHandler::IsOpen(), Node::LASTNODETYPE, OutputHandler::NETCDF, DataManager::NodeDataStructure::NodeContainer, NodeData, Nodes, NcVar::put(), NcVar::set_cur(), and OutputHandler::UseNetCDF().

Referenced by OutputPrepare().

120 {
121 #ifdef USE_NETCDF
122  for (unsigned nt = 0; nt < Node::LASTNODETYPE; nt++) {
123  if (!NodeData[nt].NodeContainer.empty() && OH.UseNetCDF(NodeData[nt].OutFile)) {
125 
126  integer iNumNodes = NodeData[nt].NodeContainer.size();
127 
128  OutputHandler::AttrValVec attrs(1);
129  attrs[0] = OutputHandler::AttrVal("description", std::string(NodeData[nt].Desc) + " nodes labels");
130 
131  OutputHandler::NcDimVec dim(1);
132  dim[0] = OH.CreateDim(std::string(NodeData[nt].ShortDesc) + "_node_labels_dim", iNumNodes);
133 
134  NcVar *VarLabels = OH.CreateVar(std::string("node.") + NodeData[nt].ShortDesc, ncInt, attrs, dim);
135 
136  NodeContainerType::const_iterator p = NodeData[nt].NodeContainer.begin();
137  for (unsigned i = 0; i < unsigned(iNumNodes); i++, p++) {
138  VarLabels->set_cur(i);
139  const long l = p->second->GetLabel();
140  VarLabels->put(&l, 1);
141  }
142  }
143  }
144 #endif // USE_NETCDF
145 
146  for (NodeVecType::iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
147  (*i)->OutputPrepare(OH);
148  }
149 }
NcBool set_cur(long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1)
bool UseNetCDF(int out) const
Definition: output.cc:491
NodeVecType Nodes
Definition: dataman.h:743
NodeContainerType NodeContainer
Definition: dataman.h:731
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
bool IsOpen(int out) const
Definition: output.cc:395
#define ASSERT(expression)
Definition: colamd.c:977
long int integer
Definition: colamd.c:51
NcBool put(const ncbyte *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0)

Here is the call graph for this function:

bool DataManager::Output ( long  lStep,
const doublereal dTime,
const doublereal dTimeStep,
bool  force = false 
) const
virtual

Definition at line 2355 of file dataman2.cc.

References DriveCaller::dGet(), DriveOutput(), DriveTrace(), ElemOutput(), OutputHandler::GetCurrentStep(), OutputHandler::IncCurrentStep(), OutputHandler::NETCDF, NodeOutput(), OutHdl, pOutputMeter, and OutputHandler::UseNetCDF().

Referenced by InverseSolver::Advance(), Solver::Advance(), Solver::Prepare(), and Solver::Start().

2359 {
2360  /* Nota: il casting di OutHdl e' necessario in quanto la funzione propria
2361  * <void DataManager::Output(void) const> e' dichiarata, appunto, <const>.
2362  * Questo fa si' che un oggetto proprio della classe DataManager sia
2363  * implicitamente definito come <const> agli occhi della funzione.
2364  * Dal momento che le funzioni
2365  * <void NodeManager::Output(OutputHandler&) const> e
2366  * <void ElemManager::Output(OutputHandler&) const> ricevono come argomento
2367  * un oggetto di tipo <OutputHandler&> che non e' <const> in quanto su di
2368  * esso si scrive, il casting e' necessario per spiegare alla funzione
2369  * <void DataManager::Output(void) const> che le funzioni invocate
2370  * modificano si' l'<OutputHandler> passato loro, ma solo nel modo
2371  * consentito e quindi la sua dichiarazione come funzione <const> e'
2372  * dovuta al fatto che i dati propri non vengono modificati in modo
2373  * incontrollabile */
2374 
2375  DriveTrace(OutHdl); // trace output will be written for every time step
2376 
2377  /* output only when allowed by the output meter */
2378  if (!force && !pOutputMeter->dGet()) {
2379  return false;
2380  }
2381 
2382  /*
2383  * Write general simulation data to binary NetCDF file
2384  * the current time step index
2385  * the current simulatin time
2386  * the current integration time step
2387  */
2388 #ifdef USE_NETCDF
2390  Var_Step->put_rec(&lStep, OutHdl.GetCurrentStep());
2391  Var_Time->put_rec(&dTime, OutHdl.GetCurrentStep());
2392  Var_TimeStep->put_rec(&dTimeStep, OutHdl.GetCurrentStep());
2393  }
2394 #endif /* USE_NETCDF */
2395 
2396  /* Dati dei nodi */
2397  NodeOutput(OutHdl);
2398 
2399  /* Dati degli elementi */
2400  ElemOutput(OutHdl);
2401 
2403 
2405 #ifdef USE_NETCDF
2406  if (bNetCDFsync) {
2407  OutHdl.pGetBinFile()->sync();
2408  }
2409 #endif /* USE_NETCDF */
2410 
2411  return true;
2412 }
void NodeOutput(OutputHandler &OH) const
Definition: nodeman.cc:152
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
void DriveTrace(OutputHandler &OH) const
Definition: dataman2.cc:2415
void ElemOutput(OutputHandler &OH) const
Definition: elman.cc:583
DriveCaller * pOutputMeter
Definition: dataman.h:179
void IncCurrentStep(void)
Definition: output.h:113
long GetCurrentStep(void) const
Definition: output.h:116
virtual doublereal dGet(const doublereal &dVar) const =0
void DriveOutput(OutputHandler &OH) const
Definition: dataman2.cc:2429

Here is the call graph for this function:

void DataManager::Output ( const VectorHandler X,
const VectorHandler XP 
) const
virtual

Definition at line 2444 of file dataman2.cc.

References ElemOutput(), NodeOutput(), and OutHdl.

2445 {
2446  /* Dati dei nodi */
2447  NodeOutput(OutHdl, X, XP);
2448 
2449  /* Dati degli elementi */
2450  ElemOutput(OutHdl, X, XP);
2451 }
void NodeOutput(OutputHandler &OH) const
Definition: nodeman.cc:152
OutputHandler OutHdl
Definition: dataman.h:105
void ElemOutput(OutputHandler &OH) const
Definition: elman.cc:583

Here is the call graph for this function:

bool DataManager::OutputEigClose ( void  )

Definition at line 2348 of file dataman2.cc.

References OutputHandler::Close(), OutputHandler::EIGENANALYSIS, and OutHdl.

Referenced by Solver::Eig().

2349 {
2351 }
OutputHandler OutHdl
Definition: dataman.h:105
bool Close(const OutputHandler::OutFiles out)
Definition: output.cc:536

Here is the call graph for this function:

void DataManager::OutputEigenvectors ( const VectorHandler pBeta,
const VectorHandler R,
const VectorHandler I,
const doublereal dShiftR,
const MatrixHandler pVL,
const MatrixHandler VR,
const std::vector< bool > &  vOut,
const unsigned  uCurrEigSol,
const int  iResultsPrecision 
)

Definition at line 1999 of file dataman2.cc.

References ASSERT, ASSERTMSG, c, count, OutputHandler::EIGENANALYSIS, OutputHandler::Eigenanalysis(), MatrixHandler::iGetNumCols(), MatrixHandler::iGetNumRows(), iSize, OutputHandler::NETCDF, OutHdl, Vec3::pGetVec(), R, OutputHandler::UseNetCDF(), and OutputHandler::UseText().

2006 {
2007  const char signs[] = {'-', '+'};
2008  int iSign;
2009 
2010  integer iSize = VR.iGetNumRows();
2011  integer iNVec = VR.iGetNumCols();
2012 
2013  integer iEigenValues = 0;
2014 
2015  for (integer r = 1; r <= iNVec; r++) {
2016  if (!vOut[r - 1]) {
2017  continue;
2018  }
2019  ++iEigenValues;
2020  }
2021 
2022  if (iEigenValues == 0)
2023  return; // this allows to load the .m file into Matlab/Octave even
2024  // if no eigenvalues have converged
2025 
2026  // alphar, alphai, beta
2028  std::ostream& out = OutHdl.Eigenanalysis();
2029 
2030  if (iResultsPrecision) {
2031  // 7 = number of characters requested by scientific notation
2032  int iNewWidth = iResultsPrecision + 7;
2033  out.width(iNewWidth);
2034  out.precision(iResultsPrecision);
2035  }
2036 
2037  out
2038  << "% alphar, alphai, beta" << std::endl
2039  << "alpha = [";
2040 
2041  for (integer r = 1; r <= iNVec; r++) {
2042  if (!vOut[r - 1]) {
2043  continue;
2044  }
2045 
2046  out
2047  << R(r) + dShiftR << ' '
2048  << I(r) << ' '
2049  << (pBeta ? (*pBeta)(r) : 1.)
2050  << ";" << std::endl;
2051  }
2052 
2053  out << "];" << std::endl;
2054 
2055  if (pVL) {
2056  // VL
2057  out
2058  << "% left eigenvectors" << std::endl
2059  << "VL = [" << std::endl;
2060  for (integer r = 1; r <= iSize; r++) {
2061  for (integer c = 1; c <= iNVec; c++) {
2062  if (!vOut[c - 1]) {
2063  continue;
2064  }
2065 
2066  if (I(c) != 0.) {
2067  ASSERTMSG(c < iNVec, "partial eigenanalysis output: complex eigenvalue with real part of left eigenvector only");
2068  ASSERT(I(c) > 0.);
2069 
2070  doublereal re = (*pVL)(r, c);
2071  // NOTE: we cannot assume that if c == iNVec
2072  // it corresponds to a real-valued eigenvalue;
2073  // "im" will be wrong, but at least we no not sigsegv
2074  doublereal im = (c < iNVec) ? (*pVL)(r, c + 1) : 0.;
2075  if (im < 0) {
2076  iSign = 0;
2077  im = -im;
2078  } else {
2079  iSign = 1;
2080  }
2081 
2082  out
2083  << re << signs[iSign] << "i*" << im << ' ';
2084  if (vOut[c]) {
2085  out
2086  << re << signs[1 - iSign] << "i*" << im << ' ';
2087  }
2088  c++;
2089  } else {
2090  out
2091  << (*pVL)(r, c) << ' ';
2092  }
2093  }
2094 
2095  if (r < iSize) {
2096  out << ";" << std::endl;
2097  } else {
2098  out << "];" << std::endl;
2099  }
2100  }
2101  }
2102 
2103  // VR
2104  out
2105  << "% right eigenvectors" << std::endl
2106  << "VR = [" << std::endl;
2107  for (integer r = 1; r <= iSize; r++) {
2108  for (integer c = 1; c <= iNVec; c++) {
2109  if (!vOut[c - 1]) {
2110  continue;
2111  }
2112 
2113  if(I(c) != 0.) {
2114  ASSERTMSG(c < iNVec, "partial eigenanalysis output: complex eigenvalue with real part of right eigenvector only");
2115  ASSERT(I(c) > 0.);
2116 
2117  doublereal re = VR(r, c);
2118  // NOTE: we cannote assume that if c == iNVec
2119  // it corresponds to a real-valued eigenvalue;
2120  // "im" will be wrong, but at least we do not sigsev
2121  doublereal im = (c < iNVec) ? VR(r, c + 1) : 0.;
2122  if (im < 0.) {
2123  iSign = 0;
2124  im = -im;
2125  } else {
2126  iSign = 1;
2127  }
2128  out
2129  << re << signs[iSign] << "i*" << im << ' ';
2130  if (vOut[c]) {
2131  out
2132  << re << signs[1 - iSign] << "i*" << im << ' ';
2133  }
2134  c++;
2135  } else {
2136  out
2137  << VR(r, c) << ' ';
2138  }
2139  }
2140 
2141  if (r < iSize) {
2142  out << ";" << std::endl;
2143  } else {
2144  out << "];" << std::endl;
2145  }
2146  }
2147  }
2148 
2149 #ifdef USE_NETCDF
2151  OutputHandler::NcDimVec dim_alpha(2);
2152 
2153  std::stringstream dimname_ss;
2154  dimname_ss << "eig_" << uCurrEigSol << "_iNVec_out";
2155 
2156  integer iNVecOut = 0;
2157  for (integer r = 1; r <= iNVec; r++)
2158  {
2159  if(vOut[r -1]){
2160  iNVecOut++;
2161  }
2162  }
2163 
2164  dim_alpha[0] = OutHdl.CreateDim(dimname_ss.str(), iNVecOut);
2165  dim_alpha[1] = OutHdl.DimV3();
2166 
2167  OutputHandler::AttrValVec attrs3(3);
2168  attrs3[0] = OutputHandler::AttrVal("units", "-");
2169  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
2170  attrs3[2] = OutputHandler::AttrVal("description", "alpha matrix");
2171 
2172  std::stringstream varname_ss;
2173  varname_ss << "eig." << uCurrEigSol << ".alpha";
2174  Var_Eig_dAlpha = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim_alpha);
2175 
2176  Vec3 v;
2177  unsigned uNRec = 0;
2178  for (integer r = 1; r <= iNVec; r++) {
2179  if (!vOut[r - 1]) {
2180  continue;
2181  }
2182 
2183  v(1) = R(r) + dShiftR;
2184  v(2) = I(r);
2185  v(3) = (pBeta ? (*pBeta)(r) : 1.);
2186  Var_Eig_dAlpha->put_rec(v.pGetVec(), uNRec);
2187  uNRec++;
2188  }
2189 
2190  OutputHandler::NcDimVec dim_v(3);
2191  dim_v[0] = m_Dim_Eig_iComplex;
2192  dim_v[1] = dim_alpha[0];
2193  dim_v[2] = m_Dim_Eig_iSize;
2194 
2195  /* start corner and count vector for NetCDF matrix output.
2196  * Since we are writing a matrix element-by-element, count will
2197  * always be (1, 1, 1) and start will move to the desired place in the
2198  * matrix */
2199  std::vector<long> start (3, 0);
2200  const std::vector<long> count (3, 1);
2201 
2202  if (pVL) {
2203  // VL
2204  OutputHandler::AttrValVec attrs3(3);
2205  attrs3[0] = OutputHandler::AttrVal("units", "-");
2206  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
2207  attrs3[2] = OutputHandler::AttrVal("description", "VL - Left eigenvectors matrix");
2208 
2209  std::stringstream varname_ss;
2210  varname_ss << "eig." << uCurrEigSol << ".VL";
2211  Var_Eig_dVL = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim_v);
2212 
2213  doublereal re;
2214  doublereal im;
2215 
2216 
2217  for (integer r = 1; r <= iSize; r++) {
2218  start[1] = 0;
2219  for (integer c = 1; c <= iNVec; c++) {
2220  if (!vOut[c - 1]) {
2221  continue;
2222  }
2223 
2224  start[2] = r - 1;
2225  if (I(c) != 0.) {
2226  ASSERTMSG(c < iNVec, "partial eigenanalysis output: complex eigenvalue with real part of left eigenvector only");
2227  ASSERT(I(c) > 0.);
2228 
2229  re = (*pVL)(r, c); // see above comment
2230  im = (c < iNVec) ? (*pVL)(r, c + 1) : 0.;
2231 
2232  // NetCDF indexing is zero-based!
2233  start[0] = 0; // real part in first "page" of VL
2234  Var_Eig_dVL->set_cur(&start[0]);
2235  Var_Eig_dVL->put(&re, &count[0]);
2236 
2237  start[0] = 1; // imaginary part in second "page"
2238  Var_Eig_dVL->set_cur(&start[0]);
2239  Var_Eig_dVL->put(&im, &count[0]);
2240 
2241  start[1]++;
2242 
2243  if (vOut[c]) {
2244  im = -im;
2245 
2246  start[0] = 0;
2247  Var_Eig_dVL->set_cur(&start[0]);
2248  Var_Eig_dVL->put(&re, &count[0]);
2249 
2250  start[0] = 1;
2251  Var_Eig_dVL->set_cur(&start[0]);
2252  Var_Eig_dVL->put(&im, &count[0]);
2253 
2254  start[1]++;
2255  }
2256  c++;
2257  } else {
2258  re = (*pVL)(r, c);
2259  im = 0.;
2260 
2261  start[0] = 0;
2262  Var_Eig_dVL->set_cur(&start[0]);
2263  Var_Eig_dVL->put(&re, &count[0]);
2264 
2265  start[0] = 1;
2266  Var_Eig_dVL->set_cur(&start[0]);
2267  Var_Eig_dVL->put(&im, &count[0]);
2268 
2269  start[1]++;
2270  }
2271  }
2272  }
2273  }
2274 
2275  // VR
2276  attrs3[0] = OutputHandler::AttrVal("units", "-");
2277  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
2278  attrs3[2] = OutputHandler::AttrVal("description", "VR - Left eigenvectors matrix");
2279 
2280  varname_ss.str("");
2281  varname_ss.clear();
2282  varname_ss << "eig." << uCurrEigSol << ".VR";
2283  Var_Eig_dVR = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim_v);
2284 
2285  doublereal re;
2286  doublereal im;
2287  for (integer r = 1; r <= iSize; r++) {
2288  start[1] = 0;
2289  for (integer c = 1; c <= iNVec; c++) {
2290  if (!vOut[c - 1]) {
2291  continue;
2292  }
2293 
2294  start[2] = r - 1;
2295  if (I(c) != 0.) {
2296  ASSERTMSG(c < iNVec, "partial eigenanalysis output: complex eigenvalue with real part of right eigenvector only");
2297  ASSERT(I(c) > 0.);
2298 
2299  re = VR(r, c); // see above comments
2300  im = (c < iNVec) ? VR(r, c + 1) : 0.;
2301 
2302  // NetCDF indexing is zero-based!
2303  start[0] = 0; // real part in first "page" of VL
2304  Var_Eig_dVR->set_cur(&start[0]);
2305  Var_Eig_dVR->put(&re, &count[0]);
2306 
2307  start[0] = 1; // imaginary part in second "page"
2308  Var_Eig_dVR->set_cur(&start[0]);
2309  Var_Eig_dVR->put(&im, &count[0]);
2310 
2311  start[1]++;
2312 
2313  if (vOut[c]) {
2314  im = -im;
2315 
2316  start[0] = 0;
2317  Var_Eig_dVR->set_cur(&start[0]);
2318  Var_Eig_dVR->put(&re, &count[0]);
2319 
2320  start[0] = 1;
2321  Var_Eig_dVR->set_cur(&start[0]);
2322  Var_Eig_dVR->put(&im, &count[0]);
2323  start[1]++;
2324  }
2325  c++;
2326  } else {
2327  re = VR(r, c);
2328  im = 0.;
2329 
2330  start[0] = 0;
2331  Var_Eig_dVR->set_cur(&start[0]);
2332  Var_Eig_dVR->put(&re, &count[0]);
2333 
2334  start[0] = 1;
2335  Var_Eig_dVR->set_cur(&start[0]);
2336  Var_Eig_dVR->put(&im, &count[0]);
2337 
2338  start[1]++;
2339  }
2340  }
2341  }
2342 
2343  }
2344 #endif /* USE_NETCDF */
2345 }
virtual integer iGetNumCols(void) const =0
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
#define ASSERTMSG(expr, msg)
Definition: myassert.h:219
static int count
Definition: modules.cc:41
#define ASSERT(expression)
Definition: colamd.c:977
integer iSize
Definition: dataman.h:788
static std::stack< cleanup * > c
Definition: cleanup.cc:59
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
double doublereal
Definition: colamd.c:52
std::ostream & Eigenanalysis(void) const
Definition: output.h:615
long int integer
Definition: colamd.c:51
virtual integer iGetNumRows(void) const =0
Mat3x3 R
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void DataManager::OutputEigFullMatrices ( const MatrixHandler pmMatA,
const MatrixHandler pmMatB,
const unsigned  uCurrEigSol,
const int  iMatrixPrecision 
)

Definition at line 1565 of file dataman2.cc.

References c, OutputHandler::EIGENANALYSIS, OutputHandler::Eigenanalysis(), FullMatrixHandler::iGetNumCols(), FullMatrixHandler::iGetNumRows(), OutputHandler::NETCDF, OutHdl, FullMatrixHandler::pdGetMat(), OutputHandler::UseNetCDF(), and OutputHandler::UseText().

Referenced by Solver::Eig().

1569 {
1570  const FullMatrixHandler& MatB = dynamic_cast<const FullMatrixHandler &>(*pMatB);
1571  const FullMatrixHandler& MatA = dynamic_cast<const FullMatrixHandler &>(*pMatA);
1572  integer nrows = MatB.iGetNumRows();
1573  integer ncols = MatB.iGetNumCols();
1574 
1575 #ifdef USE_NETCDF
1577  OutputHandler::NcDimVec dim2(2);
1578  dim2[0] = m_Dim_Eig_iSize;
1579  dim2[1] = m_Dim_Eig_iSize;
1580 
1581  OutputHandler::AttrValVec attrs3(3);
1582  attrs3[0] = OutputHandler::AttrVal("units", "-");
1583  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
1584  attrs3[2] = OutputHandler::AttrVal("description", "F/xPrime + dCoef * F/x");
1585 
1586  std::stringstream varname_ss;
1587  varname_ss << "eig." << uCurrEigSol << ".Aplus";
1588  Var_Eig_dAplus = OutHdl.CreateVar(varname_ss.str(),ncDouble, attrs3, dim2);
1589  attrs3[2] = OutputHandler::AttrVal("description", "F/xPrime - dCoef * F/x");
1590 
1591  varname_ss.str("");
1592  varname_ss.clear();
1593  varname_ss << "eig." << uCurrEigSol << ".Aminus";
1594  Var_Eig_dAminus = OutHdl.CreateVar(varname_ss.str(),ncDouble, attrs3, dim2);
1595 
1596  Var_Eig_dAplus->put(MatB.pdGetMat(), nrows, ncols);
1597  Var_Eig_dAminus->put(MatA.pdGetMat(), nrows, ncols);
1598 
1599  }
1600 #endif /* USE_NETCDF */
1601 
1603  std::ostream& out = OutHdl.Eigenanalysis();
1604 
1605  if (iMatrixPrecision) {
1606  // 7 = number of characters requested by scientific notation
1607  int iNewWidth = iMatrixPrecision + 7;
1608  out.width(iNewWidth);
1609  out.precision(iMatrixPrecision);
1610  }
1611 
1612  out
1613  << "% F/xPrime + dCoef * F/x" << std::endl
1614  << "Aplus" << " = [";
1615 
1616 
1617  for (integer r = 1; r <= nrows; r++) {
1618  for (integer c = 1; c <= ncols; c++) {
1619  out << MatB(r, c) << ' ';
1620  }
1621 
1622  if (r == nrows) {
1623  out << "];" << std::endl;
1624 
1625  } else {
1626  out << ";" << std::endl;
1627  }
1628  }
1629 
1630  out
1631  << "% F/xPrime - dCoef * F/x" << std::endl
1632  << "Aminus" << " = [";
1633 
1634  for (integer r = 1; r <= nrows; r++) {
1635  for (integer c = 1; c <= ncols; c++) {
1636  out << MatA(r, c) << ' ';
1637  }
1638 
1639  if (r == nrows) {
1640  out << "];" << std::endl;
1641 
1642  } else {
1643  out << ";" << std::endl;
1644  }
1645  }
1646 
1647  }
1648 }
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
virtual integer iGetNumCols(void) const
Definition: fullmh.h:229
static std::stack< cleanup * > c
Definition: cleanup.cc:59
const doublereal * pdGetMat(void) const
Definition: fullmh.h:144
std::ostream & Eigenanalysis(void) const
Definition: output.h:615
long int integer
Definition: colamd.c:51
virtual integer iGetNumRows(void) const
Definition: fullmh.h:225
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void DataManager::OutputEigGeometry ( const unsigned  uCurrSol,
const int  iResultsPrecision 
)

Definition at line 1880 of file dataman2.cc.

References ASSERT, count, StructNode::DUMMY, OutputHandler::EIGENANALYSIS, OutputHandler::Eigenanalysis(), WithLabel::GetLabel(), StructNode::GetR(), StructNode::GetStructNodeType(), StructDispNode::GetX(), DofOwnerOwner::iGetFirstIndex(), mb_zero< Vec3 >(), OutputHandler::NETCDF, DataManager::NodeDataStructure::NodeContainer, NodeData, OutHdl, Node::STRUCTURAL, OutputHandler::UseNetCDF(), OutputHandler::UseText(), and RotManip::VecRot().

1881 {
1882  NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
1883  NodeContainerType::const_iterator e = NodeData[Node::STRUCTURAL].NodeContainer.end();
1884 
1885  // no structural nodes!
1886  if (i == e) {
1887  return;
1888  }
1889 
1891  std::ostream& out = OutHdl.Eigenanalysis();
1892 
1893  if (iResultsPrecision) {
1894  // 7 = number of characters requested by scientific notation
1895  int iNewWidth = iResultsPrecision + 7;
1896  out.width(iNewWidth);
1897  out.precision(iResultsPrecision);
1898  }
1899 
1900  out
1901  << "% structural nodes labels" << std::endl
1902  << "labels = [" << std::endl;
1903 
1904  for (; i != e; ++i) {
1905  const StructDispNode *pN = dynamic_cast<const StructDispNode *>(i->second);
1906  const StructNode *pSN = dynamic_cast<const StructNode *>(pN);
1907  ASSERT(pN != 0);
1908 
1909  if (pSN && pSN->GetStructNodeType() == StructNode::DUMMY) {
1910  continue;
1911  }
1912 
1913  out << pN->GetLabel() << ";" << std::endl;
1914  }
1915 
1916  out << "];" << std::endl;
1917 
1918  out
1919  << "% structural nodes base index" << std::endl
1920  << "idx = [" << std::endl;
1921 
1922  for (i = NodeData[Node::STRUCTURAL].NodeContainer.begin(); i != e; ++i) {
1923  const StructDispNode *pN = dynamic_cast<const StructDispNode *>(i->second);
1924  const StructNode *pSN = dynamic_cast<const StructNode *>(pN);
1925  ASSERT(pN != 0);
1926 
1927  if (pSN && pSN->GetStructNodeType() == StructNode::DUMMY) {
1928  continue;
1929  }
1930 
1931  out << pN->iGetFirstIndex() << ";" << std::endl;
1932  }
1933 
1934  out << "];" << std::endl;
1935 
1936  out
1937  << "% structural nodes reference configuration (X, Phi)" << std::endl
1938  << "X0 = [" << std::endl;
1939 
1940  for (i = NodeData[Node::STRUCTURAL].NodeContainer.begin(); i != e; ++i) {
1941  const StructDispNode *pN = dynamic_cast<const StructDispNode *>(i->second);
1942  const StructNode *pSN = dynamic_cast<const StructNode *>(pN);
1943  ASSERT(pN != 0);
1944 
1945  if (pSN && pSN->GetStructNodeType() == StructNode::DUMMY) {
1946  continue;
1947  }
1948 
1949  const Vec3& X(pN->GetX());
1950  Vec3 Phi(mb_zero<Vec3>());
1951  if (pSN) {
1952  Phi = RotManip::VecRot(pSN->GetR());
1953  }
1954 
1955  out
1956  << X(1) << ";" << std::endl
1957  << X(2) << ";" << std::endl
1958  << X(3) << ";" << std::endl
1959  << Phi(1) << ";" << std::endl
1960  << Phi(2) << ";" << std::endl
1961  << Phi(3) << ";" << std::endl;
1962  }
1963 
1964  out << "];" << std::endl;
1965  }
1966 #ifdef USE_NETCDF
1968 
1969  /* start corner and count vector for NetCDF matrix output.
1970  * Since we are writing a matrix element-by-element, count will
1971  * always be (1, 1) and start will move to the desired place in the
1972  * matrix */
1973  std::vector<long> start (2, 0);
1974  start[0] = uCurrEigSol;
1975  std::vector<long> count (2, 1);
1976 
1977  for (i = NodeData[Node::STRUCTURAL].NodeContainer.begin(); i != e; ++i) {
1978  const StructDispNode *pN = dynamic_cast<const StructDispNode *>(i->second);
1979  const StructNode *pSN = dynamic_cast<const StructNode *>(pN);
1980  integer iNodeIndex;
1981  ASSERT(pN != 0);
1982 
1983  if (pSN && pSN->GetStructNodeType() == StructNode::DUMMY) {
1984  continue;
1985  }
1986 
1987  iNodeIndex = pSN->iGetFirstIndex();
1988 
1989  Var_Eig_Idx->set_cur(&start[0]);
1990  Var_Eig_Idx->put(&iNodeIndex, &count[0]);
1991  start[1]++;
1992  }
1993 
1994  }
1995 #endif // USE_NETCDF
1996 }
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
const Vec3 & GetX(void) const
Definition: strnode.cc:158
OutputHandler OutHdl
Definition: dataman.h:105
const Vec3 & mb_zero< Vec3 >(void)
Definition: matvec3.h:1560
NodeContainerType NodeContainer
Definition: dataman.h:731
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
virtual StructNode::Type GetStructNodeType(void) const =0
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
static int count
Definition: modules.cc:41
const Mat3x3 & GetR(void) const
Definition: strnode.cc:1481
#define ASSERT(expression)
Definition: colamd.c:977
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
std::ostream & Eigenanalysis(void) const
Definition: output.h:615
long int integer
Definition: colamd.c:51
unsigned int GetLabel(void) const
Definition: withlab.cc:62
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void DataManager::OutputEigNaiveMatrices ( const MatrixHandler pmMatA,
const MatrixHandler pmMatB,
const unsigned  uCurrEigSol,
const int  iMatrixPrecision 
)

Definition at line 1754 of file dataman2.cc.

References NaiveMatrixHandler::begin(), OutputHandler::EIGENANALYSIS, OutputHandler::Eigenanalysis(), NaiveMatrixHandler::end(), OutputHandler::NETCDF, OutHdl, Vec3::pGetVec(), OutputHandler::UseNetCDF(), and OutputHandler::UseText().

Referenced by Solver::Eig().

1758 {
1759  const NaiveMatrixHandler& MatB = dynamic_cast<const NaiveMatrixHandler &>(*pMatB);
1760  const NaiveMatrixHandler& MatA = dynamic_cast<const NaiveMatrixHandler &>(*pMatA);
1761 
1763  std::ostream& out = OutHdl.Eigenanalysis();
1764 
1765  if (iMatrixPrecision) {
1766  // 7 = number of characters requested by scientific notation
1767  int iNewWidth = iMatrixPrecision + 7;
1768  out.width(iNewWidth);
1769  out.precision(iMatrixPrecision);
1770  }
1771 
1772  out
1773  << "% F/xPrime + dCoef *F/x" << std::endl
1774  << "Aplus" << " = [";
1775 
1776  for (NaiveMatrixHandler::const_iterator i = MatB.begin();
1777  i != MatB.end(); ++i)
1778  {
1779  if (i->dCoef != 0.) {
1780  out << i->iRow + 1 << " " << i->iCol + 1 << " " << i->dCoef << ";" << std::endl;
1781  }
1782  }
1783 
1784  out << "];" << std::endl
1785  << "Aplus = spconvert(Aplus);" << std::endl;
1786 
1787  out
1788  << "% F/xPrime - dCoef *F/x" << std::endl
1789  << "Aminus" << " = [";
1790 
1791  for (NaiveMatrixHandler::const_iterator j = MatA.begin();
1792  j != MatA.end(); ++j)
1793  {
1794  if (j->dCoef != 0.) {
1795  out << j->iRow + 1 << " " << j->iCol + 1 << " " << j->dCoef << ";" << std::endl;
1796  }
1797  }
1798 
1799  out << "];" << std::endl
1800  << "Aminus = spconvert(Aminus);" << std::endl;
1801  }
1802 #ifdef USE_NETCDF
1804 
1805  OutputHandler::NcDimVec dim2(2);
1806 
1807  std::stringstream dimname_ss;
1808  dimname_ss << "eig_" << uCurrEigSol << "_Aplus_sp_iSize";
1809 
1810  // FIXME: Is there a more efficient way of doing this??
1811  integer iMatBNz = 0;
1812  for (NaiveMatrixHandler::const_iterator i = MatB.begin();
1813  i != MatB.end(); ++i)
1814  {
1815  if (i->dCoef != 0.) {
1816  iMatBNz++;
1817  }
1818  }
1819 
1820  integer iMatANz = 0;
1821  for (NaiveMatrixHandler::const_iterator j = MatA.begin();
1822  j != MatA.end(); ++j)
1823  {
1824  if(j->dCoef != 0.) {
1825  iMatANz++;
1826  }
1827  }
1828 
1829  dim2[0] = OutHdl.CreateDim(dimname_ss.str(), iMatBNz);
1830  dim2[1] = OutHdl.DimV3();
1831 
1832  OutputHandler::AttrValVec attrs3(3);
1833  attrs3[0] = OutputHandler::AttrVal("units", "-");
1834  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
1835  attrs3[2] = OutputHandler::AttrVal("description", "F/xPrime + dCoef * F/x");
1836 
1837  std::stringstream varname_ss;
1838  varname_ss << "eig." << uCurrEigSol << ".Aplus";
1839  Var_Eig_dAplus = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim2);
1840 
1841  dimname_ss.str("");
1842  dimname_ss.clear();
1843  dimname_ss << "eig_" << uCurrEigSol << "_Aminus_sp_iSize";
1844  dim2[0] = OutHdl.CreateDim(dimname_ss.str(), iMatANz);
1845 
1846  attrs3[2] = OutputHandler::AttrVal("description", "F/xPrime - dCoef * F/x");
1847 
1848  varname_ss.str("");
1849  varname_ss.clear();
1850  varname_ss << "eig." << uCurrEigSol << ".Aminus";
1851  Var_Eig_dAminus = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim2);
1852 
1853  int iCnt = 0;
1854  Vec3 v;
1855  for (NaiveMatrixHandler::const_iterator i = MatB.begin();
1856  i != MatB.end(); ++i)
1857  {
1858  if (i->dCoef != 0.) {
1859  v = Vec3(i->iRow, i->iCol, i->dCoef);
1860  Var_Eig_dAplus->put_rec(v.pGetVec(), iCnt);
1861  iCnt++;
1862  }
1863  }
1864 
1865  iCnt = 0;
1866  for (NaiveMatrixHandler::const_iterator i = MatA.begin();
1867  i != MatA.end(); ++i)
1868  {
1869  if (i->dCoef != 0.) {
1870  v = Vec3(i->iRow, i->iCol, i->dCoef);
1871  Var_Eig_dAminus->put_rec(v.pGetVec(), iCnt);
1872  }
1873  }
1874 
1875  }
1876 #endif
1877 }
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
NaiveMatrixHandler::const_iterator begin(void) const
Definition: naivemh.h:97
OutputHandler OutHdl
Definition: dataman.h:105
const NaiveMatrixHandler::const_iterator & end(void) const
Definition: naivemh.h:101
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
std::ostream & Eigenanalysis(void) const
Definition: output.h:615
long int integer
Definition: colamd.c:51
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void DataManager::OutputEigOpen ( const std::string &  postfix)

Definition at line 685 of file dataman.cc.

References ASSERT, OutputHandler::EIGENANALYSIS, OutputHandler::IsOpen(), OutputHandler::Open(), and OutHdl.

Referenced by Solver::Eig().

686 {
690  }
691 }
OutputHandler OutHdl
Definition: dataman.h:105
bool Open(const OutputHandler::OutFiles out)
Definition: output.cc:298
bool IsOpen(int out) const
Definition: output.cc:395
#define ASSERT(expression)
Definition: colamd.c:977

Here is the call graph for this function:

void DataManager::OutputEigParams ( const doublereal dTime,
const doublereal dCoef,
const unsigned  uCurrEigSol,
const int  iResultsPrecision 
)

Definition at line 1525 of file dataman2.cc.

References OutputHandler::EIGENANALYSIS, OutputHandler::Eigenanalysis(), OutputHandler::GetCurrentStep(), OutputHandler::NETCDF, OutHdl, OutputHandler::UseNetCDF(), and OutputHandler::UseText().

Referenced by Solver::Eig().

1529 {
1531  std::ostream& out = OutHdl.Eigenanalysis();
1532 
1533  if (iResultsPrecision) {
1534  // 7 = number of characters requested by scientific notation
1535  int iNewWidth = iResultsPrecision + 7;
1536  out.width(iNewWidth);
1537  out.precision(iResultsPrecision);
1538  }
1539 
1540  // header
1541  out
1542  << "% time: " << dTime << std::endl;
1543  out
1544  << "dTime = " << dTime << ';' << std::endl;
1545 
1546  // coefficient
1547  out
1548  << "% coefficient" << std::endl
1549  << "dCoef = " << dCoef << ";" << std::endl;
1550  }
1551 #ifdef USE_NETCDF
1553 
1554  long lStep = OutHdl.GetCurrentStep();
1555 
1556  Var_Eig_dTime->put_rec(&dTime, uCurrEigSol);
1557  Var_Eig_lStep->put_rec(&lStep, uCurrEigSol);
1558  Var_Eig_dCoef->put_rec(&dCoef, uCurrEigSol);
1559 
1560  }
1561 #endif /* USE_NETCDF */
1562 }
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
long GetCurrentStep(void) const
Definition: output.h:116
std::ostream & Eigenanalysis(void) const
Definition: output.h:615
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void DataManager::OutputEigPrepare ( const integer  iNumAnalyses,
const integer  iSize 
)
virtual

Definition at line 1474 of file dataman2.cc.

References OutputHandler::NETCDF, DataManager::NodeDataStructure::NodeContainer, NodeData, OutHdl, Node::STRUCTURAL, and OutputHandler::UseNetCDF().

Referenced by Solver::Prepare().

1475 {
1476 #ifdef USE_NETCDF
1477  /* Set up additional NetCDF stuff for eigenanalysis output */
1479 
1480  OutputHandler::NcDimVec dim(1);
1481  dim[0] = OutHdl.CreateDim("eigensolutions", iNumAnalyses);
1482 
1483  m_Dim_Eig_iSize = OutHdl.CreateDim("eig_iSize", iSize);
1484  m_Dim_Eig_iComplex = OutHdl.CreateDim("complex_var_dim", 2);
1485 
1486  OutputHandler::AttrValVec attrs2(2);
1487  attrs2[0] = OutputHandler::AttrVal("type", "integer");
1488  attrs2[1] = OutputHandler::AttrVal("description",
1489  "timestep index of eigensolution");
1490 
1491  Var_Eig_lStep = OutHdl.CreateVar("eig.step", ncInt, attrs2, dim);
1492 
1493  OutputHandler::AttrValVec attrs3(3);
1494  attrs3[0] = OutputHandler::AttrVal("units", "s");
1495  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
1496  attrs3[2] = OutputHandler::AttrVal("description",
1497  "simulation time at which the eigensolution was computed");
1498 
1499  Var_Eig_dTime = OutHdl.CreateVar("eig.time", ncDouble, attrs3, dim);
1500 
1501  attrs3[0] = OutputHandler::AttrVal("units", "-");
1502  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
1503  attrs3[2] = OutputHandler::AttrVal("description",
1504  "coefficient used to build Aplus and Aminus matrices");
1505 
1506  Var_Eig_dCoef = OutHdl.CreateVar("eig.dCoef", ncDouble, attrs3, dim);
1507 
1508  OutputHandler::NcDimVec dim2(2);
1509  integer iNumNodes = NodeData[Node::STRUCTURAL].NodeContainer.size();
1510 
1511  dim2[0] = dim[0];
1512  dim2[1] = OutHdl.CreateDim("eig_iIdxSize", iNumNodes);
1513 
1514  attrs2[0] = OutputHandler::AttrVal("type", "integer");
1515  attrs2[1] = OutputHandler::AttrVal("description",
1516  "structural nodes base index");
1517 
1518  Var_Eig_Idx = OutHdl.CreateVar("eig.idx", ncInt, attrs2, dim2);
1519  }
1520 #endif /* USE_NETCDF */
1521 }
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
NodeContainerType NodeContainer
Definition: dataman.h:731
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
integer iSize
Definition: dataman.h:788
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void DataManager::OutputEigSparseMatrices ( const MatrixHandler pmMatA,
const MatrixHandler pmMatB,
const unsigned  uCurrEigSol,
const int  iMatrixPrecision 
)

Definition at line 1651 of file dataman2.cc.

References SpMapMatrixHandler::begin(), OutputHandler::EIGENANALYSIS, OutputHandler::Eigenanalysis(), SpMapMatrixHandler::end(), OutputHandler::NETCDF, SparseMatrixHandler::Nz(), OutHdl, Vec3::pGetVec(), OutputHandler::UseNetCDF(), and OutputHandler::UseText().

Referenced by Solver::Eig().

1655 {
1656  const SpMapMatrixHandler& MatB = dynamic_cast<const SpMapMatrixHandler &>(*pMatB);
1657  const SpMapMatrixHandler& MatA = dynamic_cast<const SpMapMatrixHandler &>(*pMatA);
1658 
1660  std::ostream& out = OutHdl.Eigenanalysis();
1661 
1662  if (iMatrixPrecision) {
1663  // 7 = number of characters requested by scientific notation
1664  int iNewWidth = iMatrixPrecision + 7;
1665  out.width(iNewWidth);
1666  out.precision(iMatrixPrecision);
1667  }
1668 
1669  out
1670  << "% F/xPrime + dCoef *F/x" << std::endl
1671  << "Aplus" << " = [";
1672 
1673  for (SpMapMatrixHandler::const_iterator i = MatB.begin();
1674  i != MatB.end(); ++i)
1675  {
1676  if (i->dCoef != 0.) {
1677  out << i->iRow + 1 << " " << i->iCol + 1 << " " << i->dCoef << ";" << std::endl;
1678  }
1679  }
1680 
1681  out << "];" << std::endl
1682  << "Aplus = spconvert(Aplus);" << std::endl;
1683 
1684  out
1685  << "% F/xPrime - dCoef *F/x" << std::endl
1686  << "Aminus" << " = [";
1687 
1688  for (SpMapMatrixHandler::const_iterator i = MatA.begin();
1689  i != MatA.end(); ++i)
1690  {
1691  if (i->dCoef != 0.) {
1692  out << i->iRow + 1 << " " << i->iCol + 1 << " " << i->dCoef << ";" << std::endl;
1693  }
1694  }
1695 
1696  out << "];" << std::endl
1697  << "Aminus = spconvert(Aminus);" << std::endl;
1698  }
1699 #ifdef USE_NETCDF
1701  OutputHandler::NcDimVec dim2(2);
1702  std::stringstream dimname_ss;
1703  dimname_ss << "eig_" << uCurrEigSol << "_Aplus_sp_iSize";
1704  dim2[0] = OutHdl.CreateDim(dimname_ss.str(), MatB.Nz());
1705  dim2[1] = OutHdl.DimV3();
1706 
1707  OutputHandler::AttrValVec attrs3(3);
1708  attrs3[0] = OutputHandler::AttrVal("units", "-");
1709  attrs3[1] = OutputHandler::AttrVal("type", "doublereal");
1710  attrs3[2] = OutputHandler::AttrVal("description", "F/xPrime + dCoef * F/x");
1711 
1712  dimname_ss.str("");
1713  dimname_ss.clear();
1714  dimname_ss << "eig_" << uCurrEigSol << "_Aminus_sp_iSize";
1715  dim2[0] = OutHdl.CreateDim(dimname_ss.str(), MatA.Nz());
1716 
1717  std::stringstream varname_ss;
1718  varname_ss << "eig." << uCurrEigSol << ".Aplus";
1719  Var_Eig_dAplus = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim2);
1720  attrs3[2] = OutputHandler::AttrVal("description", "F/xPrime - dCoef * F/x");
1721 
1722  varname_ss.str("");
1723  varname_ss.clear();
1724  varname_ss << "eig." << uCurrEigSol << ".Aminus";
1725  Var_Eig_dAminus = OutHdl.CreateVar(varname_ss.str(), ncDouble, attrs3, dim2);
1726 
1727  int iCnt = 0;
1728  Vec3 v;
1729  for (SpMapMatrixHandler::const_iterator i = MatB.begin();
1730  i != MatB.end(); ++i)
1731  {
1732  if (i->dCoef != 0.) {
1733  v = Vec3(i->iRow, i->iCol, i->dCoef);
1734  Var_Eig_dAplus->put_rec(v.pGetVec(), iCnt);
1735  iCnt++;
1736  }
1737  }
1738 
1739  iCnt = 0;
1740  for (SpMapMatrixHandler::const_iterator j = MatA.begin();
1741  j != MatA.end(); ++j)
1742  {
1743  if (j->dCoef != 0.) {
1744  v = Vec3(j->iRow, j->iCol, j->dCoef);
1745  Var_Eig_dAminus->put_rec(v.pGetVec(), iCnt);
1746  }
1747  }
1748 
1749  }
1750 #endif
1751 }
Definition: matvec3.h:98
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
const integer Nz() const
Definition: spmh.h:104
const SpMapMatrixHandler::const_iterator & end(void) const
Definition: spmapmh.h:120
SpMapMatrixHandler::const_iterator begin(void) const
Definition: spmapmh.h:116
const doublereal * pGetVec(void) const
Definition: matvec3.h:192
std::ostream & Eigenanalysis(void) const
Definition: output.h:615
bool UseText(int out) const
Definition: output.cc:446

Here is the call graph for this function:

void DataManager::OutputOpen ( const OutputHandler::OutFiles  out)

Definition at line 677 of file dataman.cc.

References OutputHandler::IsOpen(), OutputHandler::Open(), and OutHdl.

Referenced by ReadElems(), and ReadModal().

678 {
679  if (!OutHdl.IsOpen(o)) {
680  OutHdl.Open(o);
681  }
682 }
OutputHandler OutHdl
Definition: dataman.h:105
bool Open(const OutputHandler::OutFiles out)
Definition: output.cc:298
bool IsOpen(int out) const
Definition: output.cc:395

Here is the call graph for this function:

void DataManager::OutputPrepare ( void  )
virtual

Definition at line 1451 of file dataman2.cc.

References ASSERT, ElemOutputPrepare(), OutputHandler::IsOpen(), OutputHandler::NETCDF, NodeOutputPrepare(), OutputHandler::Open(), OutHdl, and OutputHandler::UseNetCDF().

Referenced by InverseSolver::Prepare(), and Solver::Prepare().

1452 {
1453 #ifdef USE_NETCDF
1454  /* Set up NetCDF stuff if required */
1458 
1459  Var_Step = OutHdl.CreateVar<integer>("run.step", "-", "time step index");
1460  Var_Time = OutHdl.CreateVar<doublereal>("time", "s", "simulation time");
1461  Var_TimeStep = OutHdl.CreateVar<doublereal>("run.timestep", "s", "integration time step");
1462  }
1463 #endif /* USE_NETCDF */
1464 
1465  /* Dati dei nodi */
1467 
1468  /* Dati degli elementi */
1470 }
bool UseNetCDF(int out) const
Definition: output.cc:491
OutputHandler OutHdl
Definition: dataman.h:105
bool Open(const OutputHandler::OutFiles out)
Definition: output.cc:298
bool IsOpen(int out) const
Definition: output.cc:395
#define ASSERT(expression)
Definition: colamd.c:977
void ElemOutputPrepare(OutputHandler &OH)
Definition: elman.cc:545
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
void NodeOutputPrepare(OutputHandler &OH)
Definition: nodeman.cc:119

Here is the call graph for this function:

Elem * DataManager::pChooseElem ( Elem p,
unsigned int  iDeriv 
) const
protected

Definition at line 674 of file elman.cc.

References AIRPROPOWNER, ASSERT, DOFOWNER, ELEM, GRAVITYOWNER, and INITIALASSEMBLY.

Referenced by pFindElem().

675 {
676  ASSERT(p != NULL);
677 
678  switch (iDeriv) {
679  case ELEM:
680  return p;
681 
682  case DOFOWNER:
683  ASSERT(dynamic_cast<ElemWithDofs *>(p) != NULL);
684  return p;
685 
686  case GRAVITYOWNER:
687  ASSERT(dynamic_cast<ElemGravityOwner *>(p) != NULL);
688  return p;
689 
690  case AIRPROPOWNER:
691  ASSERT(dynamic_cast<AerodynamicElem *>(p) != NULL);
692  return p;
693 
694  case INITIALASSEMBLY:
695  ASSERT(dynamic_cast<InitialAssemblyElem *>(p) != NULL);
696  return p;
697  }
698 
699  /* default */
700  return NULL;
701 }
#define ASSERT(expression)
Definition: colamd.c:977
Drive * DataManager::pFindDrive ( Drive::Type  Typ,
unsigned int  uL 
) const

Definition at line 705 of file elman.cc.

References ASSERT, DriveData, iNum, pLabelSearch(), and ppFirstDrive.

Referenced by GetBufIn(), GetBufInRaw(), FileDCR::Read(), and SetBufInRaw().

706 {
707  ASSERT(uL > 0);
708 
709  if (DriveData[Typ].iNum == 0) {
710  silent_cerr("FileDrive(" << uL << "): "
711  "no file drivers defined" << std::endl);
712  return 0;
713  }
714 
715  if (DriveData[Typ].ppFirstDrive == 0) {
716  silent_cerr("FileDrive(" << uL << "): "
717  "file drivers can only be dereferenced "
718  "after the \"drivers\" block" << std::endl);
719  return 0;
720  }
721 
722  return pLabelSearch(DriveData[Typ].ppFirstDrive, DriveData[Typ].iNum, uL);
723 }
Drive ** ppFirstDrive
Definition: dataman.h:617
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
T * pLabelSearch(T **const p, int iSize, unsigned int uL)
Definition: search.h:50
#define ASSERT(expression)
Definition: colamd.c:977
unsigned int iNum
Definition: dataman.h:618

Here is the call graph for this function:

Elem * DataManager::pFindElem ( Elem::Type  Typ,
unsigned int  uElem,
unsigned int  iDeriv 
) const
protected

Definition at line 650 of file elman.cc.

References ASSERT, ELEM, ElemData, DataManager::ElemDataStructure::ElemMapToList, and pChooseElem().

Referenced by ExtForceEDGE::ExtForceEDGE(), model_elem(), pFindElem(), ElementDCR::Read(), ReadAerodynamicBeam(), ReadAerodynamicBeam2(), ReadElem(), ReadElems(), ReadGenel(), ReadInducedVelocity(), ReadJointRegularization(), ReadOneElem(), and ElemPrivPlugIn::ReadSE().

652 {
653  ASSERT(iDeriv == int(ELEM) || ElemData[Typ].iDerivation & iDeriv);
654 
655  if (ElemData[Typ].bIsUnique() && uL == (unsigned)(-1)) {
656  if (!ElemData[Typ].ElemMapToList.empty()) {
657  return pChooseElem(ElemData[Typ].ElemMapToList.begin()->second->second, iDeriv);
658  }
659  return 0;
660  }
661 
662  ASSERT(uL > 0);
663 
664  ElemMapToListType::const_iterator p = ElemData[Typ].ElemMapToList.find(uL);
665  if (p == ElemData[Typ].ElemMapToList.end()) {
666  return 0;
667  }
668 
669  return pChooseElem(p->second->second, iDeriv);
670 }
Elem * pChooseElem(Elem *p, unsigned int iDeriv) const
Definition: elman.cc:674
#define ASSERT(expression)
Definition: colamd.c:977
ElemMapToListType ElemMapToList
Definition: dataman.h:592
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]

Here is the call graph for this function:

Elem * DataManager::pFindElem ( Elem::Type  Typ,
unsigned int  uElem = unsigned(-1) 
) const

Definition at line 609 of file elman.cc.

References ElemData, and DataManager::ElemDataStructure::ElemMapToList.

610 {
611  if (ElemData[Typ].bIsUnique() && uL == (unsigned)(-1)) {
612  if (!ElemData[Typ].ElemMapToList.empty()) {
613  return ElemData[Typ].ElemMapToList.begin()->second->second;
614  }
615  return 0;
616  }
617 
618  ElemMapToListType::const_iterator p = ElemData[Typ].ElemMapToList.find(uL);
619  if (p == ElemData[Typ].ElemMapToList.end()) {
620  return 0;
621  }
622 
623  return p->second->second;
624 }
ElemMapToListType ElemMapToList
Definition: dataman.h:592
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
template<class Tbase , Elem::Type type>
Tbase * DataManager::pFindElem ( unsigned int  uElem = unsigned(-1)) const

Definition at line 953 of file dataman.h.

References WithLabel::GetLabel(), pFindElem(), and psElemNames.

954 {
955  /* verifica di esistenza dell'elemento */
956  Elem* pElem = pFindElem(type, uElem);
957  if (pElem == 0) {
958  silent_cerr("DataManager::pFindElem: " << psElemNames[type] << "(" << uElem << ") not found" << std::endl);
959  return 0;
960  }
961 
962  Tbase *pElemBase = dynamic_cast<Tbase *>(pElem);
963  if (pElemBase == 0) {
964  silent_cerr("DataManager::pFindElem: unable to cast " << psElemNames[type] << "(" << pElem->GetLabel() << ") "
965  "to \"" << mbdyn_demangle<Tbase>() << "\"" << std::endl);
966  return 0;
967  }
968 
969  return pElemBase;
970 }
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

template<class Tder , class Tbase , Elem::Type type>
Tder * DataManager::pFindElem ( unsigned int  uElem = unsigned(-1)) const

Definition at line 974 of file dataman.h.

References psElemNames.

975 {
976  Tbase *pElemBase = pFindElem<Tbase, type>(uElem);
977  if (pElemBase == 0) {
978  return 0;
979  }
980 
981  Tder *pElemDer = dynamic_cast<Tder *>(pElemBase);
982  if (pElemDer == 0) {
983  silent_cerr("DataManager::pFindElem: unable to cast " << psElemNames[type] << "(" << pElemBase->GetLabel() << ") "
984  "from \"" << mbdyn_demangle<Tbase>() << "\" "
985  "to \"" << mbdyn_demangle<Tder>() << "\"" << std::endl);
986  return 0;
987  }
988 
989  return pElemDer;
990 }
const char * psElemNames[]
Definition: enums.cc:39
Node * DataManager::pFindNode ( Node::Type  Typ,
unsigned int  uNode 
) const

Definition at line 179 of file nodeman.cc.

References NodeData, and DataManager::NodeDataStructure::NodeMapToList.

Referenced by model_node(), pFindNode(), NodeDCR::Read(), ReadModal(), DofPlugIn::ReadNode(), ReadNode(), ReadNodes(), ReadScalarAlgebraicNode(), ReadScalarDof(), and NodePrivPlugIn::ReadSE().

180 {
181  NodeMapToListType::const_iterator p = NodeData[Typ].NodeMapToList.find(uL);
182  if (p == NodeData[Typ].NodeMapToList.end()) {
183  return 0;
184  }
185 
186  return p->second->second;
187 }
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
NodeMapToListType NodeMapToList
Definition: dataman.h:732
template<class Tbase , Node::Type type>
Tbase * DataManager::pFindNode ( unsigned int  uNode) const

Definition at line 912 of file dataman.h.

References WithLabel::GetLabel(), pFindNode(), and psNodeNames.

913 {
914  /* verifica di esistenza del nodo */
915  Node* pNode = pFindNode(type, uNode);
916  if (pNode == 0) {
917  silent_cerr("DataManager::pFindNode: " << psNodeNames[type] << "(" << uNode << ") not found" << std::endl);
918  return 0;
919  }
920 
921  Tbase *pNodeBase = dynamic_cast<Tbase *>(pNode);
922  if (pNodeBase == 0) {
923  silent_cerr("DataManager::pFindNode: unable to cast " << psNodeNames[type] << "(" << pNode->GetLabel() << ") "
924  "to \"" << mbdyn_demangle<Tbase>() << "\"" << std::endl);
925  return 0;
926  }
927 
928  return pNodeBase;
929 }
Definition: node.h:67
const char * psNodeNames[]
Definition: enums.cc:372
unsigned int GetLabel(void) const
Definition: withlab.cc:62
Node * pFindNode(Node::Type Typ, unsigned int uNode) const
Definition: nodeman.cc:179

Here is the call graph for this function:

template<class Tder , class Tbase , Node::Type type>
Tder * DataManager::pFindNode ( unsigned int  uNode) const

Definition at line 933 of file dataman.h.

References psNodeNames.

934 {
935  Tbase *pNodeBase = pFindNode<Tbase, type>(uNode);
936  if (pNodeBase == 0) {
937  return 0;
938  }
939 
940  Tder *pNodeDer = dynamic_cast<Tder *>(pNodeBase);
941  if (pNodeDer == 0) {
942  silent_cerr("DataManager::pFindNode: unable to cast " << psNodeNames[type] << "(" << pNodeBase->GetLabel() << ") "
943  "from \"" << mbdyn_demangle<Tbase>() << "\" "
944  "to \"" << mbdyn_demangle<Tder>() << "\"" << std::endl);
945  return 0;
946  }
947 
948  return pNodeDer;
949 }
const char * psNodeNames[]
Definition: enums.cc:372
const OutputHandler* DataManager::pGetOutHdl ( void  ) const
inline

Definition at line 329 of file dataman.h.

References OutHdl.

329 { return &OutHdl; };
OutputHandler OutHdl
Definition: dataman.h:105
const RigidBodyKinematics* DataManager::pGetRBK ( void  ) const
inline

Definition at line 485 of file dataman.h.

References pRBK.

Referenced by ReadAirProperties(), and ReadStructNode().

485  {
486  return pRBK;
487  };
RigidBodyKinematics * pRBK
Definition: dataman.h:129
bool DataManager::PopCurrData ( const std::string &  name)

Definition at line 941 of file dataman.cc.

References MathParser::GetNameSpace(), MathPar, and ModelNameSpace::PopCurrData().

Referenced by ReadJoint().

942 {
943  ModelNameSpace *pMNS = dynamic_cast<ModelNameSpace *>(MathPar.GetNameSpace("model"));
944  if (pMNS == 0) {
945  return false;
946  }
947 
948  return pMNS->PopCurrData(name);
949 }
bool PopCurrData(const std::string &name)
Definition: modelns.cc:2944
MathParser & MathPar
Definition: dataman.h:98
NameSpace * GetNameSpace(const std::string &name) const
Definition: mathp.cc:4620

Here is the call graph for this function:

Elem ** DataManager::ppFindElem ( Elem::Type  Typ,
unsigned int  uElem 
) const
protected

Definition at line 629 of file elman.cc.

References ASSERT, ElemData, and DataManager::ElemDataStructure::ElemMapToList.

Referenced by ReadElems().

630 {
631  if (ElemData[Typ].bIsUnique() && uL == (unsigned)(-1)) {
632  if (!ElemData[Typ].ElemMapToList.empty()) {
633  return &ElemData[Typ].ElemMapToList.begin()->second->second;
634  }
635  return 0;
636  }
637 
638  ASSERT(uL > 0);
639 
640  ElemMapToListType::const_iterator p = ElemData[Typ].ElemMapToList.find(uL);
641  if (p == ElemData[Typ].ElemMapToList.end()) {
642  return 0;
643  }
644 
645  return const_cast<Elem **>(&p->second->second);
646 }
#define ASSERT(expression)
Definition: colamd.c:977
ElemMapToListType ElemMapToList
Definition: dataman.h:592
Definition: elem.h:75
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
Node** DataManager::ppFindNode ( Node::Type  Typ,
unsigned int  uNode 
) const
void DataManager::PrintResidual ( const VectorHandler Res,
integer  iIterCnt 
) const
virtual

Definition at line 2603 of file dataman2.cc.

References DriveHandler::dGetTime(), DriveHandler::dGetTimeStep(), Dofs, DrvHdl, VectorHandler::iGetSize(), DriveHandler::iGetStep(), and iSize.

Referenced by AssRes(), InitialJointAssembly(), and Solver::PrintResidual().

2604 {
2605  silent_cout("Residual(" << DrvHdl.iGetStep() << ":" << iIterCnt << ") "
2606  "t=" << DrvHdl.dGetTime()
2607  << " dt=" << DrvHdl.dGetTimeStep() << std::endl);
2608  integer iSize = Res.iGetSize();
2609  for (int iTmpCnt = 1; iTmpCnt <= iSize; iTmpCnt++) {
2610  silent_cout("Eq " << std::setw(8)
2611  << iTmpCnt << ": "
2612  << std::setw(20) << Res(iTmpCnt)
2613  << " " << Dofs[iTmpCnt - 1].EqDescription
2614  << std::endl);
2615  }
2616 }
DofVecType Dofs
Definition: dataman.h:813
virtual integer iGetSize(void) const =0
integer iGetStep(void) const
Definition: drive.h:400
doublereal dGetTimeStep(void) const
Definition: drive.h:393
integer iSize
Definition: dataman.h:788
doublereal dGetTime(void) const
Definition: drive.h:386
DriveHandler DrvHdl
Definition: dataman.h:104
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void DataManager::PrintSolution ( const VectorHandler Sol,
integer  iIterCnt 
) const
virtual

Definition at line 2619 of file dataman2.cc.

References DriveHandler::dGetTime(), DriveHandler::dGetTimeStep(), Dofs, DrvHdl, VectorHandler::iGetSize(), DriveHandler::iGetStep(), and iSize.

Referenced by InitialJointAssembly(), and Solver::PrintSolution().

2620 {
2621  silent_cout("Solution(" << DrvHdl.iGetStep() << ":" << iIterCnt << ") "
2622  "t=" << DrvHdl.dGetTime()
2623  << " dt=" << DrvHdl.dGetTimeStep() << std::endl);
2624  integer iSize = Sol.iGetSize();
2625  for (integer iTmpCnt = 1; iTmpCnt <= iSize; iTmpCnt++) {
2626  silent_cout("Dof " << std::setw(8)
2627  << iTmpCnt << ": "
2628  << std::setw(20) << Sol(iTmpCnt)
2629  << " " << Dofs[iTmpCnt - 1].Description
2630  << std::endl);
2631  }
2632 }
DofVecType Dofs
Definition: dataman.h:813
virtual integer iGetSize(void) const =0
integer iGetStep(void) const
Definition: drive.h:400
doublereal dGetTimeStep(void) const
Definition: drive.h:393
integer iSize
Definition: dataman.h:788
doublereal dGetTime(void) const
Definition: drive.h:386
DriveHandler DrvHdl
Definition: dataman.h:104
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

bool DataManager::PushCurrData ( const std::string &  name,
const TypedValue value 
)

Definition at line 930 of file dataman.cc.

References MathParser::GetNameSpace(), MathPar, and ModelNameSpace::PushCurrData().

Referenced by ReadJoint().

931 {
932  ModelNameSpace *pMNS = dynamic_cast<ModelNameSpace *>(MathPar.GetNameSpace("model"));
933  if (pMNS == 0) {
934  return false;
935  }
936 
937  return pMNS->PushCurrData(name, value);
938 }
MathParser & MathPar
Definition: dataman.h:98
NameSpace * GetNameSpace(const std::string &name) const
Definition: mathp.cc:4620
bool PushCurrData(const std::string &name, const TypedValue &value)
Definition: modelns.cc:2938

Here is the call graph for this function:

void DataManager::ReadControl ( MBDynParser HP,
const char *  sInputFileName 
)
protected

Definition at line 68 of file dataman3.cc.

References AbsRefFrame, Node::ABSTRACT, DofOwner::ABSTRACTNODE, OutputHandler::AERODYNAMIC, DofOwner::AERODYNAMIC, Elem::AERODYNAMIC, DofOwner::AEROMODAL, Elem::AEROMODAL, Elem::AIRPROPERTIES, AIRPROPERTIES, ASSERT, ATEND, Elem::AUTOMATICSTRUCTURAL, AUTOMATICSTRUCTURAL, Elem::BEAM, OutputHandler::BEAMS, bInitialJointAssemblyToBeDone, Elem::BODY, bOmegaRotates, bOutput(), bOutputAccels, bOutputDriveCaller, bOutputFrames, bSkipInitialJointAssembly, bStaticModel, Elem::BULK, OutputHandler::ClearText(), CurrSolver, dDefaultInitialAssemblyTol, dDefaultInitialStiffness, DEBUGCERR, DEBUGCOUTFNAME, DEBUGLCOUT, DataManager::ElemDataStructure::DefaultOut(), DataManager::NodeDataStructure::DefaultOut(), dEpsilon, dInitialAssemblyTol, dInitialPositionStiffness, dInitialVelocityStiffness, DofData, dRestartTime, DriveData, DrvHdl, Node::ELECTRIC, DofOwner::ELECTRIC, Elem::ELECTRIC, DofOwner::ELECTRICBULK, Elem::ELECTRICBULK, DofOwner::ELECTRICNODE, ElemData, END, Elem::EXTERNAL, Eye3, Drive::FILEDRIVE, Elem::FORCE, OutputHandler::FORCES, DofOwner::GENEL, Elem::GENEL, HighParser::GetDescription(), MBDynParser::GetDriveCaller(), IncludeParser::GetFileName(), HighParser::GetInt(), IncludeParser::GetLineData(), MBDynParser::GetPosAbs(), HighParser::GetReal(), MBDynParser::GetRotAbs(), HighParser::GetStringWithDelims(), MBDynParser::GetVecAbs(), HighParser::GetWord(), HighParser::GetYesNo(), GRAVITY, Elem::GRAVITY, Node::HYDRAULIC, DofOwner::HYDRAULIC, Elem::HYDRAULIC, DofOwner::HYDRAULICNODE, iDefaultMaxInitialIterations, DataManager::ElemDataStructure::iExpectedNum, DataManager::NodeDataStructure::iExpectedNum, MeterDriveCaller::iGetSteps(), iMaxInitialIterations, DofOwner::INDUCEDVELOCITY, Elem::INDUCEDVELOCITY, OutputHandler::INERTIA, Elem::INERTIA, INERTIA, iNumRestartTimes, iRestartIterations, HighParser::IsArg(), Mat3x3::IsExactlySame(), HighParser::IsKeyWord(), Vec3::IsNull(), ITERATIONS, DofOwner::JOINT, Elem::JOINT, Elem::JOINT_REGULARIZATION, OutputHandler::JOINTS, DofOwner::LASTDOFTYPE, Elem::LASTELEMTYPE, LASTKEYWORD, Node::LASTNODETYPE, OutputHandler::LOADABLE, DofOwner::LOADABLE, Elem::LOADABLE, OutputHandler::Log(), MBDYN_EXCEPT_ARGS, module_initialize(), MYDEBUG_INPUT, OutputHandler::NETCDF, NodeData, NONE, od, OutHdl, Node::PARAMETER, pdRestartTimes, DofOwner::PLATE, Elem::PLATE, pOutputMeter, pRBK, PRINT_CONNECTION, PRINT_DESCRIPTION, PRINT_DOF_DESCRIPTION, PRINT_DOF_STATS, PRINT_EL_CONNECTION, PRINT_EQ_DESCRIPTION, PRINT_NODE_CONNECTION, PRINT_NONE, PRINT_TO_FILE, psReadControlDrivers, psReadControlElems, psReadControlNodes, R, ReadAerodynamicCustomOutput(), ReadBeamCustomOutput(), ReadDC3D(), ReadDCVecRel(), ReadLinSol(), ReadOrientationDescription(), RES_NETCDF, ResMode, RestartEvery, SAFEDELETE, SAFEDELETEARR, SAFENEW, SAFENEWARR, SAFENEWWITHCONSTRUCTOR, SAFESTRDUP, saveXSol, MBDynParser::SetDataManager(), OutputHandler::SetNetCDF(), OutputHandler::SetPrecision(), Elem::SOCKETSTREAM_OUTPUT, solArrFileName, sSimulationTitle, OutputHandler::STRNODES, Node::STRUCTURAL, DofOwner::STRUCTURALNODE, Node::THERMAL, DofOwner::THERMAL, Elem::THERMAL, DofOwner::THERMALNODE, TIME, timeout, TIMES, DataManager::ElemDataStructure::ToBeUsedInAssembly(), uPrintFlags, Beam::VISCOELASTIC, and Zero3.

Referenced by DataManager().

70 {
71  DEBUGCOUTFNAME("DataManager::ReadControl");
72 
73  /* attach self to parser ... */
74  HP.SetDataManager(this);
75 
76  /* parole chiave del blocco di controllo */
77  const char* sKeyWords[] = {
78  "end",
79  "control" "data",
80 
83  psReadControlNodes[Node::THERMAL],
84  psReadControlNodes[Node::ABSTRACT],
85  psReadControlNodes[Node::PARAMETER],
86  psReadControlNodes[Node::HYDRAULIC],
87 
89  psReadControlElems[Elem::GRAVITY],
90  psReadControlElems[Elem::BODY],
91  psReadControlElems[Elem::JOINT],
92  psReadControlElems[Elem::JOINT_REGULARIZATION],
93  psReadControlElems[Elem::BEAM],
94  psReadControlElems[Elem::PLATE],
95  psReadControlElems[Elem::AIRPROPERTIES],
96  psReadControlElems[Elem::INDUCEDVELOCITY],
97  psReadControlElems[Elem::AEROMODAL],
98  psReadControlElems[Elem::AERODYNAMIC],
99  psReadControlElems[Elem::FORCE],
100  psReadControlElems[Elem::INERTIA],
101  psReadControlElems[Elem::GENEL],
102  psReadControlElems[Elem::ELECTRICBULK],
103  psReadControlElems[Elem::ELECTRIC],
104  psReadControlElems[Elem::THERMAL],
105  psReadControlElems[Elem::HYDRAULIC],
106  psReadControlElems[Elem::BULK],
107  psReadControlElems[Elem::LOADABLE],
108  psReadControlElems[Elem::EXTERNAL],
109  psReadControlElems[Elem::SOCKETSTREAM_OUTPUT],
110  "RTAI" "output", // deprecated
111  "rotors", // deprecated
112 
114 
115  "loadable" "path",
116 
117  "skip" "initial" "joint" "assembly",
118  "use",
119  "in" "assembly",
120  "initial" "stiffness",
121  "stiffness",
122  "omega" "rotates",
123  "initial" "tolerance",
124  "tolerance",
125  "max" "initial" "iterations",
126  "max" "iterations",
127  "epsilon",
128 
129  "solver", /* deprecated */
130  "linear" "solver",
131 
132  "print",
133 
134  "title",
135  "make" "restart" "file",
136  "output" "file" "name",
137  "output" "precision",
138  "output" "frequency", /* deprecated */
139  "output" "meter",
140  "output" "results",
141  "default" "output",
142  "all",
143  "none",
144  "reference" "frames",
145  "accelerations",
146  "drive" "callers",
147 
148  "default" "orientation",
149  "default" "beam" "output",
150  "default" "aerodynamic" "output",
151  "default" "scale",
152 
153  "finite" "difference" "jacobian" "meter",
154 
155  "read" "solution" "array",
156 
157  "select" "timeout",
158  "model",
159 
160  "rigid" "body" "kinematics",
161 
162  0
163  };
164 
165 
166  /* enum delle parole chiave */
167  enum KeyWords {
168  UNKNOWN = -1,
169  END = 0,
170  CONTROLDATA,
171  STRUCTURALNODES,
172  ELECTRICNODES,
173  THERMALNODES,
174  ABSTRACTNODES,
175  PARAMETERNODES,
176  HYDRAULICNODES,
177 
179  GRAVITY,
180  RIGIDBODIES,
181  JOINTS,
182  JOINT_REGULARIZATIONS,
183  BEAMS,
184  PLATES,
186  INDUCEDVELOCITYELEMENTS,
187  AEROMODALS,
188  AERODYNAMICELEMENTS,
189  FORCES,
190  INERTIA,
191  GENELS,
192  ELECTRICBULKELEMENTS,
193  ELECTRICELEMENTS,
194  THERMALELEMENTS,
195  HYDRAULICELEMENTS,
196  BULKELEMENTS,
197  LOADABLEELEMENTS,
198  EXTERNALELEMENTS,
199  SOCKETSTREAMOUTPUTELEMENTS,
200  RTAIOUTPUTELEMENTS, // deprecated
201  ROTORS, // deprecated
202 
203  FILEDRIVERS,
204 
205  LOADABLEPATH,
206 
207  SKIPINITIALJOINTASSEMBLY,
208  USE,
209  INASSEMBLY,
210  INITIALSTIFFNESS,
211  STIFFNESS,
212  OMEGAROTATES,
213  INITIALTOLERANCE,
214  TOLERANCE,
215  MAXINITIALITERATIONS,
216  MAXITERATIONS,
217  EPSILON,
218 
219  SOLVER, /* deprecated */
220  LINEARSOLVER,
221 
222  PRINT,
223 
224  TITLE,
225  MAKERESTARTFILE,
226  OUTPUTFILENAME,
227  OUTPUTPRECISION,
228  OUTPUTFREQUENCY,
229  OUTPUTMETER,
230 
231  OUTPUTRESULTS,
232  DEFAULTOUTPUT,
233  ALL,
234  NONE,
235  REFERENCEFRAMES,
236  ACCELERATIONS,
237  DRIVECALLERS,
238 
239  DEFAULTORIENTATION,
240  DEFAULTBEAMOUTPUT,
241  DEFAULTAERODYNAMICOUTPUT,
242  DEFAULTSCALE,
243 
244  FDJAC_METER,
245 
246  READSOLUTIONARRAY,
247 
248  SELECTTIMEOUT,
249  MODEL,
250  RIGIDBODYKINEMATICS,
251 
253  };
254 
255  /* tabella delle parole chiave */
256  KeyTable K(HP, sKeyWords);
257 
258  KeyWords CurrDesc;
259  while ((CurrDesc = KeyWords(HP.GetDescription())) != END) {
260  switch (CurrDesc) {
261 
262  /******** Nodes *********/
263 
264  /* Numero di nodi strutturali attesi */
265  case STRUCTURALNODES: {
268  DofData[DofOwner::STRUCTURALNODE].iNum = iDmy;
269  DEBUGLCOUT(MYDEBUG_INPUT, "Structural nodes: " << iDmy << std::endl);
270  } break;
271 
272  /* Numero di nodi elettrici attesi */
273  case ELECTRICNODES: {
276  DofData[DofOwner::ELECTRICNODE].iNum = iDmy;
277  DEBUGLCOUT(MYDEBUG_INPUT, "Electric nodes: " << iDmy << std::endl);
278  } break;
279 
280  /* Numero di nodi termici attesi */
281  case THERMALNODES: {
284  DofData[DofOwner::THERMALNODE].iNum = iDmy;
285  DEBUGLCOUT(MYDEBUG_INPUT, "Thermal nodes: " << iDmy << std::endl);
286  } break;
287 
288  /* Numero di nodi astratti attesi */
289  case ABSTRACTNODES: {
292  DofData[DofOwner::ABSTRACTNODE].iNum = iDmy;
293  DEBUGLCOUT(MYDEBUG_INPUT, "Abstract nodes: " << iDmy << std::endl);
294  } break;
295 
296  /* Numero di nodi astratti attesi */
297  case PARAMETERNODES: {
300  DEBUGLCOUT(MYDEBUG_INPUT, "Parameter nodes: " << iDmy << std::endl);
301  } break;
302 
303  /* Numero di nodi idraulici attesi */
304  case HYDRAULICNODES: {
307  DofData[DofOwner::HYDRAULICNODE].iNum = iDmy;
308  DEBUGLCOUT(MYDEBUG_INPUT, "Hydraulic nodes: " << iDmy << std::endl);
309  } break;
310 
311  /******** Elements *********/
312 
313  /* Numero di corpi rigidi attesi */
314  case AUTOMATICSTRUCTURAL: {
315 #ifdef DEBUG
316  int iDmy =
317 #endif // DEBUG
318  HP.GetInt();
319 #ifdef DEBUG
320 #if 0
322 #endif // 0
323  DEBUGLCOUT(MYDEBUG_INPUT, "Automatic structural elements expected: "
324  << iDmy << std::endl);
325 #endif
326  } break;
327 
328  /* Accelerazione di gravita' */
329  case GRAVITY: {
330  if (ElemData[Elem::GRAVITY].iExpectedNum > 0) {
331  silent_cerr("warning: gravity acceleration already defined;" << std::endl
332  << "only one definition will be considered" << std::endl);
333  }
335  DEBUGLCOUT(MYDEBUG_INPUT, "Gravity acceleration expected in elements data" << std::endl);
336  } break;
337 
338  /* Numero di corpi rigidi attesi */
339  case RIGIDBODIES: {
342  DEBUGLCOUT(MYDEBUG_INPUT, "Rigid bodies: " << iDmy << std::endl);
343  } break;
344 
345  /* Numero di inerzie attese */
346  case INERTIA: {
349  DEBUGLCOUT(MYDEBUG_INPUT, "Inertia: " << iDmy << std::endl);
350  } break;
351 
352  /* Numero di vincoli attesi */
353  case JOINTS: {
356  DofData[DofOwner::JOINT].iNum = iDmy;
357  DEBUGLCOUT(MYDEBUG_INPUT, "Joints: " << iDmy << std::endl);
358  if (iDmy > 0 ) {
360  }
361  } break;
362 
363  /* Numero di regolarizzazion vincoli attesi */
364  case JOINT_REGULARIZATIONS: {
367  DEBUGLCOUT(MYDEBUG_INPUT, "Joint regularizations: " << iDmy << std::endl);
368  if (iDmy > 0 ) {
370  }
371  } break;
372 
373  /* Numero di travi attese */
374  case BEAMS: {
377  DEBUGLCOUT(MYDEBUG_INPUT, "Beams: " << iDmy << std::endl);
378  if (iDmy > 0 ) {
380  }
381  } break;
382 
383  /* Numero di piastre attese */
384  case PLATES: {
387  DofData[DofOwner::PLATE].iNum = iDmy;
388  DEBUGLCOUT(MYDEBUG_INPUT, "Plates: " << iDmy << std::endl);
389  if (iDmy > 0 ) {
391  }
392  } break;
393 
394  /* Elementi aerodinamici: proprieta' dell'aria */
395  case AIRPROPERTIES: {
396  if (ElemData[Elem::AIRPROPERTIES].iExpectedNum > 0) {
397  silent_cerr("warning: air properties already defined;" << std::endl
398  << "only one definition will be considered" << std::endl);
399  }
401  DEBUGLCOUT(MYDEBUG_INPUT, "Air properties expected in elements data" << std::endl);
402  } break;
403 
404  /* Elementi aerodinamici: rotori */
405  case ROTORS:
406  silent_cerr("deprecated \"rotors\", use \"induced velocity elements\" instead at line " << HP.GetLineData() << std::endl);
407  // fallthru
408  case INDUCEDVELOCITYELEMENTS: {
411  DofData[DofOwner::INDUCEDVELOCITY].iNum = iDmy;
412  DEBUGLCOUT(MYDEBUG_INPUT, "Rotors: " << iDmy << std::endl);
413  } break;
414 
415  case AEROMODALS: {
418  DofData[DofOwner::AEROMODAL].iNum = iDmy;
419  DEBUGLCOUT(MYDEBUG_INPUT, "Aeromodals: " << iDmy << std::endl);
420  } break;
421 
422  /* Elementi aerodinamici: vari elementi aerodinamici senza dof */
423  case AERODYNAMICELEMENTS: {
426  DofData[DofOwner::AERODYNAMIC].iNum = iDmy;
427  DEBUGLCOUT(MYDEBUG_INPUT, "Aerodynamic Elements: " << iDmy << std::endl);
428  } break;
429 
430  /* Numero di forze e coppie attese */
431  case FORCES: {
434  DEBUGLCOUT(MYDEBUG_INPUT, "Forces: " << iDmy << std::endl);
435  } break;
436 
437  /* Numero di vincoli attesi */
438  case GENELS: {
441  DofData[DofOwner::GENEL].iNum = iDmy;
442  DEBUGLCOUT(MYDEBUG_INPUT, "Genels: " << iDmy << std::endl);
443  } break;
444 
445  /* Numero di elementi elettrici attesi */
446  case ELECTRICELEMENTS: {
449  DofData[DofOwner::ELECTRIC].iNum = iDmy;
450  DEBUGLCOUT(MYDEBUG_INPUT, "Electric elements: " << iDmy << std::endl);
451  } break;
452 
453  /* Numero di elementi termici attesi */
454  case THERMALELEMENTS: {
457  DofData[DofOwner::THERMAL].iNum = iDmy;
458  DEBUGLCOUT(MYDEBUG_INPUT, "Thermal elements: " << iDmy << std::endl);
459  } break;
460 
461  /* Numero di elementi idraulici attesi */
462  case HYDRAULICELEMENTS: {
465  DofData[DofOwner::HYDRAULIC].iNum = iDmy;
466  DEBUGLCOUT(MYDEBUG_INPUT, "Hydraulic elements: " << iDmy << std::endl);
467  } break;
468 
469  /* Numero di elementi elettrici attesi */
470  case BULKELEMENTS: {
473  DEBUGLCOUT(MYDEBUG_INPUT, "Bulk elements: " << iDmy << std::endl);
474  } break;
475 
476  /* Numero di elementi caricabili attesi */
477  case LOADABLEELEMENTS: {
480  DofData[DofOwner::LOADABLE].iNum = iDmy;
481  DEBUGLCOUT(MYDEBUG_INPUT, "Loadable elements: " << iDmy << std::endl);
482  } break;
483 
484  case LOADABLEPATH: {
485 #if defined(USE_RUNTIME_LOADING)
486  bool add(false);
487 
488  if (!moduleInitialized) {
490  moduleInitialized = true;
491  }
492 
493  if (HP.IsKeyWord("set")) {
494  add = false;
495  } else if (HP.IsKeyWord("add")) {
496  add = true;
497  }
498 
499  const char *s = HP.GetFileName();
500  if (s == NULL) {
501  silent_cerr("missing path "
502  "in \"loadable path\" statement "
503  "at line " << HP.GetLineData()
504  << std::endl);
506  }
507 
508  if (add) {
509  if (lt_dladdsearchdir(s) != 0) {
510  silent_cerr("unable to add path "
511  "\"" << s << "\" "
512  "in \"loadable path\" "
513  "statement at line "
514  << HP.GetLineData()
515  << std::endl);
517  }
518  } else {
519  if (lt_dlsetsearchpath(s) != 0) {
520  silent_cerr("unable to set path "
521  "\"" << s << "\" "
522  "in \"loadable path\" "
523  "statement at line "
524  << HP.GetLineData()
525  << std::endl);
527  }
528  }
529 
530 #else // ! USE_RUNTIME_LOADING
531  silent_cerr("loadable path allowed "
532  "only in presence of libltdl (ignored)"
533  << std::endl);
534  (void)HP.GetStringWithDelims();
535 #endif // ! USE_RUNTIME_LOADING
536  } break;
537 
538  case EXTERNALELEMENTS: {
539 #ifdef USE_EXTERNAL
542  DEBUGLCOUT(MYDEBUG_INPUT, "External elements: " << iDmy
543  << std::endl);
544 #else /* USE_EXTERNAL */
545  silent_cerr("cannot use external elements "
546  "when not compiled with -DUSE_EXTERNAL"
547  << std::endl);
548 #endif /* USE_EXTERNAL */
549  } break;
550 
551  case SOCKETSTREAMOUTPUTELEMENTS:
552  case RTAIOUTPUTELEMENTS: {
555  DEBUGLCOUT(MYDEBUG_INPUT, "RTAI output elements: " << iDmy
556  << std::endl);
557 #ifndef USE_RTAI
558  if (CurrDesc == RTAIOUTPUTELEMENTS) {
559  silent_cerr("cannot use "
560  "RTAI output elements "
561  "when not configured "
562  "--with-rtai; "
563  "using \"socket stream output\" "
564  "instead"
565  << std::endl);
566  }
567 #endif /* ! USE_RTAI */
568  } break;
569 
570  /* Numero di drivers attesi */
571  case FILEDRIVERS: {
573  DriveData[Drive::FILEDRIVE].iNum = iDmy;
574  DEBUGLCOUT(MYDEBUG_INPUT, "File drivers: " << iDmy << std::endl);
575  } break;
576 
577  /********* Miscellaneous *********/
578 
579  /* Spegne il flag di assemblaggio iniziale;
580  * di default viene eseguito solo se sono definiti vincoli */
581  case SKIPINITIALJOINTASSEMBLY: {
583  DEBUGLCOUT(MYDEBUG_INPUT, "Skipping initial joint assembly" << std::endl);
584  } break;
585 
586  /* Uso di diversi tipi di elementi nell'assemblaggio iniziale */
587  case USE:
588  while (true) {
589  switch (KeyWords(HP.GetWord())) {
590  /* Esce dal ciclo */
591  case INASSEMBLY:
592  goto EndOfUse;
593 
594  case RIGIDBODIES:
597  "Rigid bodies will be used "
598  "in initial joint assembly"
599  << std::endl);
600  break;
601 
602  case GRAVITY:
605  "Gravity will be used "
606  "in initial joint assembly"
607  << std::endl);
608  break;
609 
610  case FORCES:
613  "Forces will be used "
614  "in initial joint assembly"
615  << std::endl);
616  break;
617 
618  /* Lo lascio per backwards compatibility */
619  case BEAMS:
620 #if 0
622 #endif /* 0 */
624  "Beams are used by default "
625  "in initial joint assembly"
626  << std::endl);
627  break;
628 
629  case PLATES:
632  "Plates will be used "
633  "in initial joint assembly"
634  << std::endl);
635  break;
636 
637  case AERODYNAMICELEMENTS:
640  "Aerodynamic Elements will be used "
641  "in initial joint assembly"
642  << std::endl);
643 
644  if (!ElemData[Elem::AIRPROPERTIES].bToBeUsedInAssembly()) {
646  }
647 
648  break;
649 
650  case LOADABLEELEMENTS:
653  "Loadable Elements will be used "
654  "in initial joint assembly"
655  << std::endl);
656  break;
657 
658  /* Elemento non autorizzato */
659  default:
660  silent_cerr("Element type at line "
661  << HP.GetLineData()
662  << " is not allowed; aborting..."
663  << std::endl);
664 
666 
667  /* Errore */
668  case UNKNOWN:
669  silent_cerr("Unknown element type "
670  "at line " << HP.GetLineData() << "; "
671  "aborting..." << std::endl);
672 
674  }
675  }
676 
677 EndOfUse:
678  break;
679 
680  /* Rigidezza delle molle fittizie usate
681  * nell'assemblaggio iniziale;
682  * se viene fornito un solo valore, viene usato sia per posizione
683  * che per velocita';
684  * se ne vengono forniti due, il primo vale per la posizione ed
685  * il secondo per la velocita'
686  */
687  case INITIALSTIFFNESS:
688  pedantic_cout("\"initial stiffness\" deprecated at line "
689  << HP.GetLineData() << "; use \"stiffness\""
690  << std::endl);
691 
692  case STIFFNESS:
695 
696  if (HP.IsArg()) {
699  } else {
702  }
703 
704  DEBUGLCOUT(MYDEBUG_INPUT, "Initial position stiffness: "
705  << dInitialPositionStiffness << std::endl
706  << "Initial velocity stiffness: "
707  << dInitialVelocityStiffness << std::endl);
708 
709  break;
710 
711  /* Omega solidale con il nodo o con il rif. globale */
712  case OMEGAROTATES:
713  if (!HP.GetYesNo(bOmegaRotates)) {
714  silent_cerr("Invalid option at line "
715  << HP.GetLineData() << std::endl);
717  }
718 
719  break;
720 
721  /* Tolleranza nell'assemblaggio iniziale; viene calcolata come:
722  * sqrt(sum(res^2)/(1.+sum(sol^2)) */
723  case INITIALTOLERANCE:
724  pedantic_cout("\"initial tolerance\" deprecated at line "
725  << HP.GetLineData() << "; use \"tolerance\""
726  << std::endl);
727 
728  case TOLERANCE:
731  DEBUGLCOUT(MYDEBUG_INPUT, "Initial assembly tolerance: "
732  << dInitialAssemblyTol << std::endl);
733  break;
734 
735  /* Numero massimo di iterazioni nell'assemblaggio iniziale;
736  * di default ne e' consentita solo una, indice di condizioni
737  * iniziali corrette */
738  case MAXINITIALITERATIONS:
739  pedantic_cout("\"max initial iterations\" deprecated at line "
740  << HP.GetLineData() << "; use \"max iterations\""
741  << std::endl);
742  case MAXITERATIONS:
745  DEBUGLCOUT(MYDEBUG_INPUT, "Max initial iterations: "
746  << iMaxInitialIterations << std::endl);
747  break;
748 
749  case EPSILON:
750  dEpsilon = HP.GetReal();
751  if (dEpsilon <= 0.) {
752  silent_cerr("illegal \"epsilon\"=" << dEpsilon
753  << " at line " << HP.GetLineData()
754  << std::endl);
756  }
757  break;
758 
759  case PRINT:
760  while (HP.IsArg()) {
761  if (HP.IsKeyWord("dof" "stats")) {
763 
764  } else if (HP.IsKeyWord("dof" "description")) {
766 
767  } else if (HP.IsKeyWord("equation" "description")) {
769 
770  } else if (HP.IsKeyWord("description")) {
772 
773  } else if (HP.IsKeyWord("element" "connection")) {
775 
776  } else if (HP.IsKeyWord("node" "connection")) {
778 
779  } else if (HP.IsKeyWord("connection")) {
781 
782  } else if (HP.IsKeyWord("all")) {
784 
785  } else if (HP.IsKeyWord("none")) {
787 
788  } else if (HP.IsKeyWord("to" "file")) {
790 
791  } else {
792  silent_cerr("unknown print flag at line "
793  << HP.GetLineData() << std::endl);
795  }
796  }
797  break;
798 
799  case SOLVER:
800  silent_cerr("\"solver\" keyword at line "
801  << HP.GetLineData() << " is deprecated; "
802  "use \"linear solver\" instead" << std::endl);
803  case LINEARSOLVER:
804  ReadLinSol(CurrSolver, HP);
805  break;
806 
807  /* Titolo */
808  case TITLE: {
809  ASSERT(sSimulationTitle == NULL);
810  if (sSimulationTitle != NULL) {
812  }
813  const char* sTmp(HP.GetStringWithDelims());
815  DEBUGLCOUT(MYDEBUG_INPUT, "Simulation title: "
816  "\"" << sSimulationTitle << '"' << std::endl);
817  } break;
818 
819  /* Crea il file di restart */
820  case MAKERESTARTFILE:
821  DEBUGLCOUT(MYDEBUG_INPUT, "Restart file will be generated " << std::endl);
822  if (HP.IsArg()) {
823  if (HP.IsKeyWord("iterations")) {
827  "every " << iRestartIterations
828  << " iterations" << std::endl);
829  } else if (HP.IsKeyWord("time")) {
830  RestartEvery = TIME;
831  dRestartTime = HP.GetReal();
833  "every " << dRestartTime
834  << " time units" << std::endl);
835  } else if (HP.IsKeyWord("times")) {
838  if (iNumRestartTimes < 1) {
839  silent_cerr("illegal number of restart times "
840  << iNumRestartTimes << std::endl);
842  }
844  for (integer i = 0; i < iNumRestartTimes; i++) {
845  pdRestartTimes[i] = HP.GetReal();
847  " at time "
848  << pdRestartTimes[0]
849  << std::endl);
850  }
851  } else {
852  silent_cerr("Error: unrecognized restart option at line "
853  << HP.GetLineData() << std::endl);
854 
856  }
857  } else {
859  }
860 
861  if (HP.IsKeyWord("with" "solution" "array")) {
862  saveXSol = true;
863  }
864  break;
865 
866  case OUTPUTFILENAME:
867  silent_cerr("\"output file name\" no longer supported at line "
868  << HP.GetLineData() << std::endl);
870 
871  case OUTPUTPRECISION: {
872  int iPrec = HP.GetInt();
873  OutHdl.SetPrecision(iPrec);
874  } break;
875 
876  case OUTPUTFREQUENCY: {
877  if (pOutputMeter != 0) {
878  silent_cerr("Output meter/frequency already defined" << std::endl);
880  }
881  integer iFreq = HP.GetInt();
882  if (iFreq < 1) {
883  silent_cerr("Illegal output frequency " << iFreq
884  << " at line " << HP.GetLineData() << std::endl);
886  }
890  -std::numeric_limits<double>::max(),
891  std::numeric_limits<double>::max(),
892  iFreq)
893  );
894  } break;
895 
896  case OUTPUTMETER:
897  if (pOutputMeter != 0) {
898  silent_cerr("Output meter/frequency already defined" << std::endl);
900  }
901  pOutputMeter = HP.GetDriveCaller(false);
902  break;
903 
904  case OUTPUTRESULTS:
905  while (HP.IsArg()) {
906  /* require support for ADAMS/View .res output */
907  if (HP.IsKeyWord("adams")) {
908 #if defined USE_ADAMS
909  ResMode |= RES_ADAMS;
910 
911  if (HP.IsArg()) {
912  if (HP.IsKeyWord("model" "name")) {
913  if (sAdamsModelName != 0) {
914  pedantic_cerr("line " << HP.GetLineData()
915  << ": ADAMS output model name "
916  "already defined; replacing..."
917  << std::endl);
918  SAFEDELETEARR(sAdamsModelName);
919  sAdamsModelName = 0;
920  }
921 
922  const char *tmp = HP.GetStringWithDelims();
923  SAFESTRDUP(sAdamsModelName, tmp);
924  }
925 
926  /* default; conservative: output is very verbose */
927  if (HP.IsKeyWord("velocity")) {
928  if (!HP.GetYesNo(bAdamsVelocity)) {
929  silent_cerr("unknown value "
930  "for \"velocity\" flag at line "
931  << HP.GetLineData() << std::endl);
933  }
934  }
935 
936  if (HP.IsKeyWord("acceleration")) {
937  if (!HP.GetYesNo(bAdamsAcceleration)) {
938  silent_cerr("unknown value "
939  "for \"acceleration\" flag at line "
940  << HP.GetLineData() << std::endl);
942  }
943  }
944  }
945 
946  if (sAdamsModelName == 0) {
947  SAFESTRDUP(sAdamsModelName, "mbdyn");
948  }
949 #else /* !USE_ADAMS */
950  silent_cerr("Please rebuild with ADAMS output enabled"
951  << std::endl);
953 #endif /* USE_ADAMS */
954  /* require support for MotionView output */
955  } else if (HP.IsKeyWord("motion" "view")) {
956 #if defined USE_MOTIONVIEW
957  ResMode |= RES_MOTIONVIEW;
958 
959  /*
960  * add output info
961  */
962 #else /* !USE_MOTIONVIEW */
963  silent_cerr("Please rebuild with MotionView output enabled"
964  << std::endl);
966 #endif /* USE_MOTIONVIEW */
967 
968  } else if (HP.IsKeyWord("netcdf")) {
969  ResMode |= RES_NETCDF;
970  if (HP.IsKeyWord("sync")) {
971 #ifdef USE_NETCDF
972  bNetCDFsync = true;
973 #endif // USE_NETCDF
974  }
975  if (HP.IsKeyWord("no" "text")) {
976 #ifdef USE_NETCDF
977  bNetCDFnoText = true;
978 #endif // USE_NETCDF
979  }
980 #ifndef USE_NETCDF
981  silent_cerr("\"netcdf\" ignored; please rebuild with NetCDF output enabled"
982  << std::endl);
983 #endif /* ! USE_NETCDF */
984 
985  } else {
986  silent_cerr("unknown \"output results\" "
987  "mode at line " << HP.GetLineData()
988  << std::endl);
990  }
991  }
992  break;
993 
994  case DEFAULTOUTPUT:
995  while (HP.IsArg()) {
996  KeyWords CurrDefOut(KeyWords(HP.GetWord()));
997  switch (CurrDefOut) {
998  case ALL:
999  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1000  ElemData[iCnt].DefaultOut(true);
1001  }
1002  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
1003  NodeData[iCnt].DefaultOut(true);
1004  }
1005  break;
1006 
1007  case NONE:
1008  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1009  ElemData[iCnt].DefaultOut(false);
1010  }
1011  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
1012  NodeData[iCnt].DefaultOut(false);
1013  }
1014  break;
1015 
1016  case REFERENCEFRAMES:
1017  bOutputFrames = true;
1018  break;
1019 
1020  case ACCELERATIONS:
1021  bOutputAccels = true;
1022  break;
1023 
1024  case DRIVECALLERS:
1025  bOutputDriveCaller = true;
1026  break;
1027 
1028  case STRUCTURALNODES:
1030  break;
1031 
1032  case ELECTRICNODES:
1034  break;
1035 
1036  case THERMALNODES:
1038  break;
1039 
1040  case ABSTRACTNODES:
1042  break;
1043 
1044  case HYDRAULICNODES:
1046  break;
1047 
1048  case GRAVITY:
1050  break;
1051 
1052  case RIGIDBODIES:
1054  break;
1055 
1056  case JOINTS:
1058  break;
1059 
1060  case BEAMS:
1062  break;
1063 
1064  case PLATES:
1066  break;
1067 
1068  case AIRPROPERTIES:
1070  break;
1071 
1072  case ROTORS:
1073  case INDUCEDVELOCITYELEMENTS:
1075  break;
1076 
1077  case AEROMODALS:
1079  break;
1080 
1081  case AERODYNAMICELEMENTS:
1083  break;
1084 
1085  case FORCES:
1087  break;
1088 
1089  case GENELS:
1091  break;
1092 
1093  case ELECTRICBULKELEMENTS:
1095  break;
1096 
1097  case ELECTRICELEMENTS:
1099  break;
1100 
1101  case THERMALELEMENTS:
1103  break;
1104 
1105  case HYDRAULICELEMENTS:
1107  break;
1108  case LOADABLEELEMENTS:
1110  break;
1111 #ifdef USE_EXTERNAL
1112  case EXTERNALELEMENTS:
1114  break;
1115 #endif /* USE_EXTERNAL */
1116 
1117  case UNKNOWN:
1118  silent_cerr("warning: unknown output case at line "
1119  << HP.GetLineData() << std::endl);
1120  ASSERT(0);
1121  break;
1122 
1123  default:
1124  silent_cerr("case " << sKeyWords[CurrDesc] << " at line "
1125  << HP.GetLineData() << " is not allowed" << std::endl);
1126  ASSERT(0);
1127  break;
1128  }
1129  }
1130  break;
1131 
1132  case DEFAULTORIENTATION:
1134  break;
1135 
1136  case DEFAULTBEAMOUTPUT:
1137  ReadBeamCustomOutput(this, HP, unsigned(-1), Beam::VISCOELASTIC,
1138  ElemData[Elem::BEAM].uOutputFlags, ElemData[Elem::BEAM].od);
1139  break;
1140 
1141  case DEFAULTAERODYNAMICOUTPUT:
1142  ReadAerodynamicCustomOutput(this, HP, unsigned(-1),
1144  break;
1145 
1146  case DEFAULTSCALE:
1147  while (HP.IsArg()) {
1148  KeyWords CurrDefOut(KeyWords(HP.GetWord()));
1149  doublereal dScale = HP.GetReal(1.);
1150 
1151  switch (CurrDefOut) {
1152  case ALL:
1153  for (int iCnt = 0; iCnt < DofOwner::LASTDOFTYPE; iCnt++) {
1154  DofData[iCnt].dDefScale= dScale;
1155  }
1156  break;
1157 
1158  case STRUCTURALNODES:
1159  DofData[DofOwner::STRUCTURALNODE].dDefScale = dScale;
1160  break;
1161 
1162  case ELECTRICNODES:
1163  DofData[DofOwner::ELECTRICNODE].dDefScale = dScale;
1164  break;
1165 
1166  case THERMALNODES:
1167  DofData[DofOwner::THERMALNODE].dDefScale = dScale;
1168  break;
1169 
1170  case ABSTRACTNODES:
1171  DofData[DofOwner::ABSTRACTNODE].dDefScale = dScale;
1172  break;
1173 
1174  case HYDRAULICNODES:
1175  DofData[DofOwner::HYDRAULICNODE].dDefScale = dScale;
1176  break;
1177 
1178  case JOINTS:
1179  DofData[DofOwner::JOINT].dDefScale = dScale;
1180  break;
1181 
1182  case ROTORS:
1183  case INDUCEDVELOCITYELEMENTS:
1184  DofData[DofOwner::INDUCEDVELOCITY].dDefScale = dScale;
1185  break;
1186 
1187  case AEROMODALS:
1188  DofData[DofOwner::AEROMODAL].dDefScale = dScale;
1189  break;
1190 
1191  case GENELS:
1192  DofData[DofOwner::GENEL].dDefScale = dScale;
1193  break;
1194 
1195  case ELECTRICBULKELEMENTS:
1196  DofData[DofOwner::ELECTRICBULK].dDefScale = dScale;
1197  break;
1198 
1199  case ELECTRICELEMENTS:
1200  DofData[DofOwner::ELECTRIC].dDefScale = dScale;
1201  break;
1202 
1203  case THERMALELEMENTS:
1204  DofData[DofOwner::THERMAL].dDefScale = dScale;
1205  break;
1206 
1207  case HYDRAULICELEMENTS:
1208  DofData[DofOwner::HYDRAULIC].dDefScale = dScale;
1209  break;
1210 
1211  case LOADABLEELEMENTS:
1212  DofData[DofOwner::LOADABLE].dDefScale = dScale;
1213  break;
1214 
1215  case UNKNOWN:
1216  silent_cerr("warning: unknown output case at line "
1217  << HP.GetLineData() << std::endl);
1218  ASSERT(0);
1219  break;
1220 
1221  default:
1222  silent_cerr("case " << sKeyWords[CurrDesc] << " at line "
1223  << HP.GetLineData() << " is not allowed" << std::endl);
1224  ASSERT(0);
1225  break;
1226  }
1227  }
1228  break;
1229 
1230  case FDJAC_METER: {
1231 #ifdef MBDYN_FDJAC
1232  if (pFDJacMeter != 0) {
1233  silent_cerr("\"finite difference jacobian meter\" already defined" << std::endl);
1235  }
1236 #endif // MBDYN_FDJAC
1237  DriveCaller *pTmp = HP.GetDriveCaller(false);
1238 #ifdef MBDYN_FDJAC
1239  pFDJacMeter = pTmp;
1240 #else // !MBDYN_FDJAC
1241  silent_cerr("warning, \"finite difference jacobian meter\" not supported (ignored)" << std::endl);
1242  SAFEDELETE(pTmp);
1243 #endif // !MBDYN_FDJAC
1244  } break;
1245 
1246  case READSOLUTIONARRAY:{
1247  int len = strlen(sInputFileName) + sizeof(".X");
1248  SAFENEWARR(solArrFileName, char, len);
1249  snprintf(solArrFileName, len, "%s.X", sInputFileName);
1250  } break;
1251 
1252  case SELECTTIMEOUT:
1253 #ifdef USE_SOCKET
1254  if (HP.IsKeyWord("forever")) {
1255  SocketUsersTimeout = 0;
1256 
1257  } else {
1258  int timeout = HP.GetInt();
1259  if (timeout <= 0) {
1260  silent_cerr("warning: illegal select timeout " << timeout
1261  << " (ignored) at line " << HP.GetLineData()
1262  << std::endl);
1263  } else {
1264  SocketUsersTimeout = 60*timeout;
1265  }
1266  }
1267 #else // ! USE_SOCKET
1268  silent_cerr("warning: \"select timeout\" not allowed (ignored) "
1269  "at line " << HP.GetLineData()
1270  << " because the current architecture "
1271  "apparently does not support sockets"
1272  << std::endl);
1273 #endif // ! USE_SOCKET
1274  break;
1275 
1276  case MODEL:
1277  if (HP.IsKeyWord("static")) {
1278  bStaticModel = true;
1279  }
1280  break;
1281 
1282  case RIGIDBODYKINEMATICS: {
1283  if (HP.IsKeyWord("const")) {
1284  Vec3 X(Zero3);
1285  Mat3x3 R(Eye3);
1286  Vec3 V(Zero3);
1287  Vec3 W(Zero3);
1288  Vec3 XPP(Zero3);
1289  Vec3 WP(Zero3);
1290 
1291  bool bGot(false);
1292 
1293  if (HP.IsKeyWord("position")) {
1294  X = HP.GetPosAbs(::AbsRefFrame);
1295  if (!X.IsNull()) {
1296  bGot = true;
1297  }
1298  }
1299 
1300  if (HP.IsKeyWord("orientation")) {
1301  R = HP.GetRotAbs(::AbsRefFrame);
1302  if (!R.IsExactlySame(Eye3)) {
1303  bGot = true;
1304  }
1305  }
1306 
1307  if (HP.IsKeyWord("velocity")) {
1308  V = HP.GetVecAbs(::AbsRefFrame);
1309  if (!V.IsNull()) {
1310  bGot = true;
1311  }
1312  }
1313 
1314  if (HP.IsKeyWord("angular" "velocity")) {
1315  W = HP.GetVecAbs(::AbsRefFrame);
1316  if (!W.IsNull()) {
1317  bGot = true;
1318  }
1319  }
1320 
1321  if (HP.IsKeyWord("acceleration")) {
1322  XPP = HP.GetVecAbs(::AbsRefFrame);
1323  if (!XPP.IsNull()) {
1324  bGot = true;
1325  }
1326  }
1327 
1328  if (HP.IsKeyWord("angular" "acceleration")) {
1329  WP = HP.GetVecAbs(::AbsRefFrame);
1330  if (!WP.IsNull()) {
1331  bGot = true;
1332  }
1333  }
1334 
1335  if (!bGot) {
1336  silent_cerr("null rigid body kinematics "
1337  "at line " << HP.GetLineData()
1338  << std::endl);
1339  break;
1340  }
1341 
1344  ConstRigidBodyKinematics(X, R, V, W, XPP, WP));
1345 
1346  } else if (HP.IsKeyWord("drive")) {
1347  TplDriveCaller<Vec3> *pXDrv(0);
1348  TplDriveCaller<Vec3> *pThetaDrv(0);
1349  TplDriveCaller<Vec3> *pVDrv(0);
1350  TplDriveCaller<Vec3> *pWDrv(0);
1351  TplDriveCaller<Vec3> *pXPPDrv(0);
1352  TplDriveCaller<Vec3> *pWPDrv(0);
1353 
1354  bool bGot(false);
1355 
1356  if (HP.IsKeyWord("position")) {
1357  pXDrv = ReadDCVecRel(this, HP, ::AbsRefFrame);
1358  bGot = true;
1359  }
1360 
1361  if (HP.IsKeyWord("orientation")) {
1362  pThetaDrv = ReadDCVecRel(this, HP, ::AbsRefFrame);
1363  bGot = true;
1364  }
1365 
1366  if (HP.IsKeyWord("velocity")) {
1367  pVDrv = ReadDCVecRel(this, HP, ::AbsRefFrame);
1368  bGot = true;
1369  }
1370 
1371  if (HP.IsKeyWord("angular" "velocity")) {
1372  pWDrv = ReadDCVecRel(this, HP, ::AbsRefFrame);
1373  bGot = true;
1374  }
1375 
1376  if (HP.IsKeyWord("acceleration")) {
1377  pXPPDrv = ReadDC3D(this, HP);
1378  bGot = true;
1379  }
1380 
1381  if (HP.IsKeyWord("angular" "acceleration")) {
1382  pWPDrv = ReadDC3D(this, HP);
1383  bGot = true;
1384  }
1385 
1386  if (!bGot) {
1387  silent_cerr("null rigid body kinematics "
1388  "at line " << HP.GetLineData()
1389  << std::endl);
1390  break;
1391  }
1392 
1396  pThetaDrv, pVDrv, pWDrv,
1397  pXPPDrv, pWPDrv));
1398 
1399  } else {
1400  silent_cerr("unknown rigid body kinematics "
1401  "at line " << HP.GetLineData()
1402  << std::endl);
1404  }
1405 
1406  if (HP.IsArg()) {
1407  silent_cerr("Semicolon expected at line "
1408  << HP.GetLineData() << std::endl);
1410  }
1411  } break;
1412 
1413  case UNKNOWN:
1414  /*
1415  * If description is not in key table the parser
1416  * returns UNKNONW, so "default" can be used to
1417  * intercept control cases that are not allowed.
1418  */
1419  DEBUGCERR("");
1420  silent_cerr("unknown description at line "
1421  << HP.GetLineData() << std::endl);
1423  ASSERT(0);
1424  break;
1425 
1426  default:
1427  silent_cerr("case " << sKeyWords[CurrDesc] << " at line "
1428  << HP.GetLineData() << " is not allowed" << std::endl);
1430  }
1431  }
1432 
1433  if (KeyWords(HP.GetWord()) != CONTROLDATA) {
1434  DEBUGCERR("");
1435  silent_cerr("\"end: control data;\" expected at line "
1436  << HP.GetLineData() << std::endl);
1438  }
1439 
1440  /* Se non c'e' il punto e virgola finale */
1441  if (HP.IsArg()) {
1442  DEBUGCERR("");
1443  silent_cerr("semicolon expected at line "
1444  << HP.GetLineData() << std::endl);
1446  }
1447 
1448 #ifdef USE_NETCDF
1449  /* FIXME: from now on, NetCDF is enabled */
1450  if (bNetCDFnoText) {
1451  // enables or disables text output
1452  OutHdl.ClearText();
1453  }
1454 #endif // USE_NETCDF
1455 
1456  if (bOutput(RES_NETCDF)) {
1465  // OutHdl.SetNetCDF(OutputHandler::PLATES);
1466  }
1467 
1468  integer iOutputFrequency = 0;
1469  if (pOutputMeter == 0) {
1471  iOutputFrequency = 1;
1472 
1473  } else {
1474  MeterDriveCaller *pMDC = dynamic_cast<MeterDriveCaller *>(pOutputMeter);
1475  if (pMDC != 0) {
1476  iOutputFrequency = pMDC->iGetSteps();
1477  }
1478  }
1479 
1480  if (iOutputFrequency == 0) {
1481  OutHdl.Log() << "output frequency: custom" << std::endl;
1482 
1483  } else {
1484  OutHdl.Log() << "output frequency: " << iOutputFrequency << std::endl;
1485  }
1486 
1487  DEBUGLCOUT(MYDEBUG_INPUT, "End of control data" << std::endl);
1488 } /* End of DataManager::ReadControl() */
eRestart RestartEvery
Definition: dataman.h:164
void ReadLinSol(LinSol &cs, HighParser &HP, bool bAllowEmpty)
Definition: readlinsol.cc:39
void SetNetCDF(const OutputHandler::OutFiles out)
Definition: output.cc:500
void module_initialize(void)
Definition: modules.cc:44
const Vec3 Zero3(0., 0., 0.)
static int timeout
doublereal dEpsilon
Definition: dataman.h:126
char * sSimulationTitle
Definition: dataman.h:158
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
integer iGetSteps(void) const
Definition: drive_.h:1305
Definition: matvec3.h:98
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
Mat3x3 GetRotAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1857
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
OrientationDescription ReadOrientationDescription(MBDynParser &HP)
Definition: dataman3.cc:2502
doublereal dInitialPositionStiffness
Definition: dataman.h:121
bool bOmegaRotates
Definition: dataman.h:123
OutputHandler OutHdl
Definition: dataman.h:105
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
Definition: parsinc.cc:673
#define DEBUGCERR(msg)
Definition: myassert.h:235
integer iMaxInitialIterations
Definition: dataman.h:125
Definition: dataman4.cc:96
const char * psReadControlDrivers[]
Definition: enums.cc:357
void ReadBeamCustomOutput(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, Beam::Type BT, unsigned &uFlags, OrientationDescription &od)
Definition: beam.cc:1776
bool bSkipInitialJointAssembly
Definition: dataman.h:117
bool saveXSol
Definition: dataman.h:175
void ReadAerodynamicCustomOutput(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, unsigned &uFlags, OrientationDescription &od)
Definition: aeroelem.cc:1295
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)
doublereal dRestartTime
Definition: dataman.h:166
void SetPrecision(int iNewPrecision)
Definition: output.cc:663
#define SAFENEW(pnt, item)
Definition: mynewmem.h:695
int ResMode
Definition: dataman.h:201
DriveCaller * pOutputMeter
Definition: dataman.h:179
bool IsExactlySame(const Mat3x3 &m) const
Definition: matvec3.h:1237
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
RigidBodyKinematics * pRBK
Definition: dataman.h:129
int GetDescription(void)
Definition: parser.cc:730
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
Vec3 GetPosAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1401
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
Definition: parser.cc:1228
void ClearText(void)
Definition: output.cc:465
bool bOutputFrames
Definition: dataman.h:118
doublereal dInitialAssemblyTol
Definition: dataman.h:124
integer iRestartIterations
Definition: dataman.h:165
#define ASSERT(expression)
Definition: colamd.c:977
OrientationDescription od
Definition: dataman.h:229
bool bInitialJointAssemblyToBeDone
Definition: dataman.h:116
KeyWords
Definition: dataman4.cc:94
const char * psReadControlNodes[]
Definition: enums.cc:387
doublereal dInitialVelocityStiffness
Definition: dataman.h:122
const doublereal dDefaultInitialStiffness
Definition: dataman.cc:80
bool bOutput(ResType t) const
Definition: dataman.cc:694
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
const integer iDefaultMaxInitialIterations
Definition: dataman.cc:83
bool bOutputDriveCaller
Definition: dataman.h:120
char * solArrFileName
Definition: dataman.h:176
Vec3 GetVecAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1641
virtual bool GetYesNo(bool &bRet)
Definition: parser.cc:1022
virtual bool IsArg(void)
Definition: parser.cc:807
doublereal * pdRestartTimes
Definition: dataman.h:168
virtual int GetWord(void)
Definition: parser.cc:1083
void ToBeUsedInAssembly(bool b)
Definition: dataman.h:578
#define SAFESTRDUP(pnt, src)
Definition: mynewmem.h:707
bool bStaticModel
Definition: dataman.h:130
const char * psReadControlElems[]
Definition: enums.cc:122
LinSol CurrSolver
Definition: dataman.h:127
#define SAFENEWARR(pnt, item, sz)
Definition: mynewmem.h:701
void SetDataManager(DataManager *pdm)
Definition: mbpar.cc:296
integer iNumRestartTimes
Definition: dataman.h:169
std::ostream & Log(void) const
Definition: output.h:541
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
const doublereal dDefaultInitialAssemblyTol
Definition: dataman.cc:82
DriveHandler DrvHdl
Definition: dataman.h:104
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
unsigned uPrintFlags
Definition: dataman.h:156
Mat3x3 R
bool bOutputAccels
Definition: dataman.h:119
TplDriveCaller< Vec3 > * ReadDCVecRel(const DataManager *pDM, MBDynParser &HP, const ReferenceFrame &rf)
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

void DataManager::ReadDrivers ( MBDynParser HP)
protected

Definition at line 2187 of file dataman3.cc.

References DEBUGCERR, DEBUGCOUTFNAME, DEBUGLCOUT, DriveData, END, Drive::FILEDRIVE, HighParser::GetDescription(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetWord(), iNumTypes, HighParser::IsArg(), iTotDrive, Drive::LASTDRIVETYPE, LASTKEYWORD, MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, psDriveNames, and ReadDriveData().

Referenced by DataManager().

2188 {
2189  DEBUGCOUTFNAME("DataManager::ReadDrivers");
2190 
2191  /* parole chiave del blocco di controllo */
2192  const char* sKeyWords[] = {
2193  "end",
2194  "drivers",
2195  "file",
2196  NULL
2197  };
2198 
2199  /* enum delle parole chiave */
2200  enum KeyWords {
2201  UNKNOWN = -1,
2202 
2203  END = 0,
2204  DRIVERS,
2205  FILEDRIVE,
2206 
2207  LASTKEYWORD
2208  };
2209 
2210  /* tabella delle parole chiave */
2211  KeyTable K(HP, sKeyWords);
2212 
2213  /* strutture di conteggio dei drivers letti */
2215  for (int i = 0; i < Drive::LASTDRIVETYPE; i++) {
2216  iNumTypes[i] = DriveData[i].iNum;
2217  }
2218 
2219  int iMissingDrivers = iTotDrive;
2220  DEBUGLCOUT(MYDEBUG_INPUT, "Expected drivers: " << iMissingDrivers
2221  << std::endl);
2222 
2223  KeyWords CurrDesc;
2224  while ((CurrDesc = KeyWords(HP.GetDescription())) != END) {
2225  /* puntatore al puntatore al driver */
2226  Drive** ppD = NULL;
2227 
2228  /* legge la label */
2229  unsigned int uLabel = 0;
2230  if (CurrDesc >= 0) {
2231  uLabel = unsigned(HP.GetInt());
2232  }
2233 
2234  /* in base al tipo, avviene l'allocazione */
2235  switch (CurrDesc) {
2236  /* drivers */
2237  case FILEDRIVE: {
2238  silent_cout("Reading "
2239  << psDriveNames[Drive::FILEDRIVE] << "(" << uLabel << ")"
2240  << std::endl);
2241 
2242  if (iNumTypes[Drive::FILEDRIVE]-- <= 0) {
2243  DEBUGCERR("");
2244  silent_cerr("line " << HP.GetLineData() << ": "
2245  << psDriveNames[Drive::FILEDRIVE] << "(" << uLabel << ") "
2246  "exceeds file drivers number" << std::endl);
2248  }
2249 
2250  /* allocazione e creazione */
2251  int i = DriveData[Drive::FILEDRIVE].iNum
2252  - iNumTypes[Drive::FILEDRIVE] - 1;
2253  ppD = DriveData[Drive::FILEDRIVE].ppFirstDrive + i;
2254 
2255  *ppD = ReadDriveData(uLabel, this, HP);
2256  } break;
2257 
2258  /* aggiungere qui i nuovi tipi */
2259 
2260  /* in caso di tipo sconosciuto */
2261  default:
2262  DEBUGCERR("");
2263  silent_cerr("unknown drive type at line "
2264  << HP.GetLineData() << std::endl);
2266 
2267  }
2268 
2269  /* verifica dell'allocazione */
2270  if (*ppD == NULL) {
2271  DEBUGCERR("");
2272  silent_cerr("error in allocation "
2273  "of " << psDriveNames[Drive::FILEDRIVE] << "(" << uLabel << ")"
2274  << std::endl);
2276  }
2277 
2278  /* decrementa il totale degli elementi mancanti */
2279  iMissingDrivers--;
2280  }
2281 
2282  if (KeyWords(HP.GetWord()) != DRIVERS) {
2283  DEBUGCERR("");
2284  silent_cerr("\"end: drivers;\" expected at line "
2285  << HP.GetLineData() << std::endl);
2287  }
2288 
2289  /* Se non c'e' il punto e virgola finale */
2290  if (HP.IsArg()) {
2291  DEBUGCERR("");
2292  silent_cerr("semicolon expected at line "
2293  << HP.GetLineData() << std::endl);
2295  }
2296 
2297  if (iMissingDrivers > 0) {
2298  silent_cerr("warning, " << iMissingDrivers
2299  << " drivers are missing" << std::endl);
2301  }
2302 
2303  DEBUGLCOUT(MYDEBUG_INPUT, "End of drivers data" << std::endl);
2304 } /* End of ReadDrivers */
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
Definition: drive.h:89
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
#define DEBUGCERR(msg)
Definition: myassert.h:235
unsigned int iTotDrive
Definition: dataman.h:622
Definition: dataman4.cc:96
Drive * ReadDriveData(unsigned uLabel, const DataManager *pDM, MBDynParser &HP)
Definition: drive_.cc:1283
int GetDescription(void)
Definition: parser.cc:730
KeyWords
Definition: dataman4.cc:94
static int iNumTypes[Elem::LASTELEMTYPE]
Definition: dataman4.cc:91
virtual bool IsArg(void)
Definition: parser.cc:807
virtual int GetWord(void)
Definition: parser.cc:1083
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
const char * psDriveNames[]
Definition: enums.cc:351

Here is the call graph for this function:

Elem * DataManager::ReadElem ( MBDynParser HP,
Elem::Type  type 
) const

Definition at line 2334 of file dataman3.cc.

References DEBUGLCOUT, HighParser::GetInt(), IncludeParser::GetLineData(), MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, pFindElem(), psElemNames, and psNodeNames.

Referenced by LoadIncForce::LoadIncForce(), ReadAerodynamicModal(), ReadElem(), ReadGenel(), ReadModalExtForce(), ReadModalForce(), and Wheel4::Wheel4().

2335 {
2336  integer iElem = HP.GetInt();
2337  if (iElem < 0) {
2338  silent_cerr("DataManager::ReadElem: invalid node label " << iElem
2339  << " at line " << HP.GetLineData() << std::endl);
2341  }
2342  unsigned int uElem = (unsigned int)iElem;
2343 
2344  DEBUGLCOUT(MYDEBUG_INPUT, "DataManager::ReadElem: " << psNodeNames[type] << "(" << uElem << ")" << std::endl);
2345 
2346  /* verifica di esistenza dell'elemento */
2347  Elem* pElem = dynamic_cast<Elem *>(pFindElem(type, uElem));
2348  if (pElem == 0) {
2349  silent_cerr("DataManager::ReadElem: " << psElemNames[type] << "(" << uElem << ")"
2350  " not defined at line "
2351  << HP.GetLineData() << std::endl);
2353  }
2354 
2355  return pElem;
2356 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
const char * psNodeNames[]
Definition: enums.cc:372
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

template<class Tbase , Elem::Type type>
Tbase * DataManager::ReadElem ( MBDynParser HP) const

Definition at line 1029 of file dataman.h.

References ASSERT, WithLabel::GetLabel(), IncludeParser::GetLineData(), MBDYN_EXCEPT_ARGS, psElemNames, and ReadElem().

1030 {
1031  Elem *pElem = ReadElem(HP, type);
1032  ASSERT(pElem != 0);
1033 
1034  Tbase *pElemBase = dynamic_cast<Tbase *>(pElem);
1035  if (pElemBase == 0) {
1036  silent_cerr("DataManager::ReadElem: unable to cast " << psElemNames[type] << "(" << pElem->GetLabel() << ") "
1037  "to \"" << mbdyn_demangle<Tbase>() << "\" at line " << HP.GetLineData() << std::endl);
1039  }
1040 
1041  return pElemBase;
1042 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
Definition: dataman3.cc:2334
#define ASSERT(expression)
Definition: colamd.c:977
Definition: elem.h:75
const char * psElemNames[]
Definition: enums.cc:39
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

template<class Tder , class Tbase , Elem::Type type>
Tder * DataManager::ReadElem ( MBDynParser HP) const

Definition at line 1046 of file dataman.h.

References ASSERT, IncludeParser::GetLineData(), MBDYN_EXCEPT_ARGS, and psElemNames.

1047 {
1048  Tbase *pElemBase = ReadElem<Tbase, type>(HP);
1049  ASSERT(pElemBase != 0);
1050 
1051  Tder *pElemDer = dynamic_cast<Tder *>(pElemBase);
1052  if (pElemBase == 0) {
1053  silent_cerr("DataManager::ReadElem: unable to cast " << psElemNames[type] << "(" << pElemBase->GetLabel() << ") "
1054  "from \"" << mbdyn_demangle<Tbase>() << "\" "
1055  "to \"" << mbdyn_demangle<Tder>() << "\" at line " << HP.GetLineData() << std::endl);
1057  }
1058 
1059  return pElemDer;
1060 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define ASSERT(expression)
Definition: colamd.c:977
const char * psElemNames[]
Definition: enums.cc:39
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

void DataManager::ReadElems ( MBDynParser HP)
protected

Definition at line 157 of file dataman4.cc.

References AbsRefFrame, Elem::AERODYNAMIC, AERODYNAMICBEAM, AERODYNAMICBEAM2, AERODYNAMICBEAM3, AERODYNAMICBODY, AERODYNAMICEXTERNAL, AERODYNAMICEXTERNALMODAL, AEROMODAL, Elem::AEROMODAL, AIRCRAFTINSTRUMENTS, Elem::AIRPROPERTIES, AIRPROPERTIES, ASSERT, Elem::AUTOMATICSTRUCTURAL, AUTOMATICSTRUCTURAL, Elem::BEAM, BEAM, BEAM2, BEAM3, Elem2Param::Bind(), BIND, BODY, Elem::BODY, Elem::BULK, BULK, COUPLE, DEBUGCERR, DEBUGCOUT, DEBUGCOUTFNAME, DEBUGLCOUT, HighParser::DEFAULTDELIM, DRIVEN, StructDispNode::DYNAMIC, StructNode::DYNAMIC, Elem::ELECTRIC, ELECTRIC, DataManager::ElemDataStructure::ElemContainer, ElemData, ELEMENTS, Elems, END, EXISTING, HighParser::ExpectDescription(), Elem::EXTERNAL, Elem::FORCE, FORCE, fReadOutput(), Elem::GENEL, GENEL, GENERICAERODYNAMICFORCE, HighParser::GetDescription(), MBDynParser::GetDriveCaller(), Elem::GetElemType(), HighParser::GetInt(), WithLabel::GetLabel(), IncludeParser::GetLineData(), WithLabel::GetName(), HighParser::GetStringWithDelims(), DynamicStructDispNode::GetStructDispNodeType(), DynamicStructNode::GetStructNodeType(), MBDynParser::GetVecAbs(), HighParser::GetWord(), GRAVITY, Elem::GRAVITY, GUST, HBEAM, Elem::HYDRAULIC, HYDRAULIC, DataManager::ElemDataStructure::iExpectedNum, SimulationEntity::iGetNumPrivData(), SimulationEntity::iGetPrivDataIdx(), Elem::INDUCEDVELOCITY, INDUCEDVELOCITY, Elem::INERTIA, INERTIA, AutomaticStructDispElem::Init(), AutomaticStructElem::Init(), InsertElem(), HighParser::IsArg(), HighParser::IsKeyWord(), JOINT, Elem::JOINT, JOINT_REGULARIZATION, Elem::JOINT_REGULARIZATION, Elem::LASTELEMTYPE, Elem::LOADABLE, LOADABLE, MBDYN_EXCEPT_ARGS, MEMBRANE4EAS, OutputHandler::MODAL, module_initialize(), MYDEBUG_INPUT, NO_OP, DataManager::NodeDataStructure::NodeContainer, NodeData, OUTPUT, OUTPUT_ELEMENT, OutputOpen(), SimulationEntity::ParseHint(), pFindElem(), Elem::PLATE, ppFindElem(), psElemNames, AirPropOwner::PutAirProperties(), GravityOwner::PutGravity(), WithLabel::PutName(), ReadAirProperties(), ReadGravity(), ReadGustData(), ReadOneElem(), ROTOR, RTAI_OUTPUT, SAFENEWWITHCONSTRUCTOR, ToBeOutput::SetOutputFlag(), SHELL4EAS, SHELL4EASANS, SOCKETSTREAM_MOTION_OUTPUT, Elem::SOCKETSTREAM_OUTPUT, SOCKETSTREAM_OUTPUT, Node::STRUCTURAL, Elem::THERMAL, THERMAL, Elem::UNKNOWN, UNKNOWNKEYWORD, and USER_DEFINED.

Referenced by DataManager().

158 {
159  DEBUGCOUTFNAME("DataManager::ReadElems");
160 
161  /* parole chiave del blocco degli elementi */
162  const char* sKeyWords[] = {
163  "end",
164 
165  "elements",
166 
167  "gravity",
168  "body",
169  "automatic" "structural",
170  "joint",
171  "joint" "regularization",
172  "couple",
173  "beam3",
174  "beam",
175  "beam2",
176  "hbeam",
177 
178  "membrane4eas",
179  "shell4eas",
180  "shell4easans",
181 
182  "air" "properties",
183  "gust",
184  "induced" "velocity",
185  "rotor",
186  "aerodynamic" "body",
187  "aerodynamic" "beam3",
188  "aerodynamic" "beam",
189  "aerodynamic" "beam2",
190  "aerodynamic" "external",
191  "aerodynamic" "external" "modal",
192  "aero" "modal",
193  "aircraft" "instruments",
194  "generic" "aerodynamic" "force",
195 
196  "force",
197 
198  "genel",
199  "electric",
200 
201  "thermal",
202 
203  "hydraulic",
204 
205  "bulk",
206  "user" "defined",
207  "loadable", // deprecated
208  "driven",
209 
210  "output" "element",
211  "stream" "output", // deprecated
212  "stream" "motion" "output", // deprecated
213  "RTAI" "output", // deprecated
214 
215  "inertia",
216 
217  "existing",
218  "output",
219  "bind",
220 
221  NULL
222  };
223 
224  /* tabella delle parole chiave */
225  KeyTable K(HP, sKeyWords);
226 
227  /* strutture di conteggio degli elementi letti */
228  for (int i = 0; i < Elem::LASTELEMTYPE; i++) {
230  }
231 
232  int iMissingElems = Elems.size();
233  DEBUGLCOUT(MYDEBUG_INPUT, "Expected elements: " << iMissingElems << std::endl);
234 
235  ElemVecType::iterator ei = Elems.begin();
236 
237  /* Aggiunta degli elementi strutturali automatici legati ai nodi dinamici */
238  if (ElemData[Elem::AUTOMATICSTRUCTURAL].iExpectedNum > 0) {
239  for (NodeContainerType::const_iterator i = NodeData[Node::STRUCTURAL].NodeContainer.begin();
240  i != NodeData[Node::STRUCTURAL].NodeContainer.end(); ++i)
241  {
242  const DynamicStructNode *pN = dynamic_cast<const DynamicStructNode *>(i->second);
243  if (pN != 0) {
244  // NOTE: could be a modal node
245  if (pN->GetStructNodeType() != StructNode::DYNAMIC) {
246  continue;
247  }
248 
249  Elem *pTmpEl = 0;
250  SAFENEWWITHCONSTRUCTOR(pTmpEl,
252  AutomaticStructElem(pN));
254 
255  *ei = pTmpEl;
256  ++ei;
257 
258  ASSERT(iNumTypes[Elem::AUTOMATICSTRUCTURAL] > 0);
259 
260  iMissingElems--;
263  "Initializing automatic structural element linked to StructuralNode("
264  << pN->GetLabel() << ")" << std::endl);
265  continue;
266  }
267 
268  const DynamicStructDispNode *pDN = dynamic_cast<const DynamicStructDispNode *>(i->second);
269  if (pDN != 0) {
270  // NOTE: could be a modal node
272  continue;
273  }
274 
275  Elem *pTmpEl = 0;
276  SAFENEWWITHCONSTRUCTOR(pTmpEl,
279  InsertElem(ElemData[Elem::AUTOMATICSTRUCTURAL], pDN->GetLabel(), pTmpEl);
280 
281  *ei = pTmpEl;
282  ++ei;
283 
284  ASSERT(iNumTypes[Elem::AUTOMATICSTRUCTURAL] > 0);
285 
286  iMissingElems--;
289  "Initializing automatic structural element linked to StructDispNode(" << pDN->GetLabel() << ")" << std::endl);
290  continue;
291  }
292  }
293  }
294 
295  KeyWords CurrDesc;
296  while ((CurrDesc = KeyWords(HP.GetDescription())) != END) {
297  if (CurrDesc == OUTPUT) {
298  DEBUGLCOUT(MYDEBUG_INPUT, "Elements to be output: ");
299  Elem::Type Typ;
300  switch (KeyWords(HP.GetWord())) {
301  case BODY: {
302  DEBUGLCOUT(MYDEBUG_INPUT, "bodies" << std::endl);
303  Typ = Elem::BODY;
304  break;
305  }
306 
307  case AUTOMATICSTRUCTURAL: {
308  DEBUGLCOUT(MYDEBUG_INPUT, "automatic structural" << std::endl);
310  break;
311  }
312 
313  case JOINT: {
314  DEBUGLCOUT(MYDEBUG_INPUT, "joints" << std::endl);
315  Typ = Elem::JOINT;
316  break;
317  }
318 
319  case BEAM:
320  case BEAM3: /* same as BEAM */
321  case BEAM2:
322  case HBEAM: {
323  DEBUGLCOUT(MYDEBUG_INPUT, "beams" << std::endl);
324  Typ = Elem::BEAM;
325  break;
326  }
327 
328  case MEMBRANE4EAS:
329  case SHELL4EAS:
330  case SHELL4EASANS: {
331  DEBUGLCOUT(MYDEBUG_INPUT, "shells" << std::endl);
332  Typ = Elem::PLATE;
333  break;
334  }
335 
336  case INDUCEDVELOCITY:
337  case ROTOR: {
338  DEBUGLCOUT(MYDEBUG_INPUT, "induced velocity elements" << std::endl);
339  Typ = Elem::INDUCEDVELOCITY;
340  break;
341  }
342 
343  case AEROMODAL: {
344  DEBUGLCOUT(MYDEBUG_INPUT, "aeromodal" << std::endl);
345  Typ = Elem::AEROMODAL;
346  break;
347  }
348 
349 #ifdef USE_EXTERNAL
350  case AERODYNAMICEXTERNAL:
352  DEBUGLCOUT(MYDEBUG_INPUT, "aerodynamic external" << std::endl);
353  Typ = Elem::EXTERNAL;
354  break;
355  }
356 #endif /* USE_EXTERNAL */
357 
358  case AERODYNAMICBODY:
359  case AERODYNAMICBEAM:
360  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
361  case AERODYNAMICBEAM2:
362  case AIRCRAFTINSTRUMENTS:
364  DEBUGLCOUT(MYDEBUG_INPUT, "aerodynamic" << std::endl);
365  Typ = Elem::AERODYNAMIC;
366  break;
367  }
368 
369  case FORCE:
370  case COUPLE:
371  {
372  DEBUGLCOUT(MYDEBUG_INPUT, "forces" << std::endl);
373  Typ = Elem::FORCE;
374  break;
375  }
376 
377  case GENEL: {
378  DEBUGLCOUT(MYDEBUG_INPUT, "genels" << std::endl);
379  Typ = Elem::GENEL;
380  break;
381  }
382 
383  case ELECTRIC: {
384  DEBUGLCOUT(MYDEBUG_INPUT, "electric" << std::endl);
385  Typ = Elem::ELECTRIC;
386  break;
387  }
388 
389  case THERMAL: {
390  DEBUGLCOUT(MYDEBUG_INPUT, "thermal" << std::endl);
391  Typ = Elem::THERMAL;
392  break;
393  }
394 
395  case HYDRAULIC: {
396  DEBUGLCOUT(MYDEBUG_INPUT, "hydraulic elements" << std::endl);
397  Typ = Elem::HYDRAULIC;
398  break;
399  }
400 
401  case BULK: {
402  DEBUGLCOUT(MYDEBUG_INPUT, "bulk" << std::endl);
403  Typ = Elem::BULK;
404  break;
405  }
406 
407  case USER_DEFINED:
408  case LOADABLE: {
409  DEBUGLCOUT(MYDEBUG_INPUT, "loadable" << std::endl);
410  Typ = Elem::LOADABLE;
411  break;
412  }
413 
414  case UNKNOWNKEYWORD: {
415  silent_cerr("Error: unknown element type, cannot modify output"
416  << std::endl);
418  }
419 
420  default: {
421  silent_cerr("Error: element type " << sKeyWords[CurrDesc]
422  << " at line " << HP.GetLineData() << " is not allowed"
423  << std::endl);
425  }
426  } /* end switch (KeyWords(HP.GetWord())) */
427 
428  /* Elements list */
429  while (HP.IsArg()) {
430  if (HP.IsKeyWord("range")) {
431  unsigned int uL = (unsigned int)HP.GetInt();
432  unsigned int uEndL = (unsigned int)HP.GetInt();
433  if (uEndL < uL) {
434  silent_cerr("End label " << uEndL
435  << " must be larger than "
436  "or equal to start label "
437  << uL << std::endl);
439  }
440  for ( ; uL <= uEndL; uL++) {
441  Elem* pE = dynamic_cast<Elem *>(pFindElem(Typ, uL));
442  if (pE != 0) {
443  DEBUGLCOUT(MYDEBUG_INPUT, "element " << uL << std::endl);
444  pE->SetOutputFlag(flag(1));
445  if (dynamic_cast<const Modal *>(pE)) {
447  }
448  }
449  }
450 
451  } else {
452  unsigned int uL = (unsigned int)HP.GetInt();
453  Elem* pE = dynamic_cast<Elem *>(pFindElem(Typ, uL));
454  if (pE == 0) {
455  silent_cerr(psElemNames[Typ] << "(" << uL << ") "
456  "is not defined (ignored); output cannot be modified "
457  "at line " << HP.GetLineData()
458  << std::endl);
459  } else {
460  DEBUGLCOUT(MYDEBUG_INPUT, "element " << uL << std::endl);
461  pE->SetOutputFlag(flag(1) | ElemData[Typ].uOutputFlags);
462  if (dynamic_cast<const Modal *>(pE)) {
464  }
465  }
466  }
467  } /* end while (HP.IsArg()) */
468 
469  } else if (CurrDesc == BIND) {
470  Elem* pEl = 0;
472 
473  if (HP.IsKeyWord("air" "properties")) {
475  if (ElemData[t].ElemContainer.empty()) {
476  silent_cerr("air properties not defined; "
477  "cannot bind at line "
478  << HP.GetLineData() << std::endl);
480  }
481  ElemContainerType::iterator ap = ElemData[t].ElemContainer.begin();
482  pEl = ap->second;
483 
484  } else {
485  /* Label dell'elemento */
486  unsigned int uL = HP.GetInt();
487 
488  /* Tipo dell'elemento */
489  switch (KeyWords(HP.GetWord())) {
490  case BODY:
491  t = Elem::BODY;
492  break;
493 
494  case AUTOMATICSTRUCTURAL:
496  break;
497 
498  case JOINT:
499  t = Elem::JOINT;
500  break;
501 
502  case FORCE:
503  case COUPLE:
504  t = Elem::FORCE;
505  break;
506 
507  case INERTIA:
508  t = Elem::INERTIA;
509  break;
510 
511  case BEAM:
512  case BEAM3: /* same as BEAM */
513  case BEAM2:
514  case HBEAM:
515  t = Elem::BEAM;
516  break;
517 
518  case MEMBRANE4EAS:
519  case SHELL4EAS:
520  case SHELL4EASANS:
521  t = Elem::PLATE;
522  break;
523 
524  case INDUCEDVELOCITY:
525  case ROTOR:
527  break;
528 
529  case AEROMODAL:
530  t = Elem::AEROMODAL;
531  break;
532 
533 #ifdef USE_EXTERNAL
534  case AERODYNAMICEXTERNAL:
536  t = Elem::EXTERNAL;
537  break;
538 #endif /* USE_EXTERNAL */
539 
540  case AERODYNAMICBODY:
541  case AERODYNAMICBEAM:
542  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
543  case AERODYNAMICBEAM2:
544  case AIRCRAFTINSTRUMENTS:
546  t = Elem::AERODYNAMIC;
547  break;
548 
549  case GENEL:
550  t = Elem::GENEL;
551  break;
552 
553  case ELECTRIC:
554  t = Elem::ELECTRIC;
555  break;
556 
557  case THERMAL:
558  t = Elem::THERMAL;
559  break;
560 
561  case HYDRAULIC:
562  t = Elem::HYDRAULIC;
563  break;
564 
565  case BULK:
566  t = Elem::BULK;
567  break;
568 
569  case USER_DEFINED:
570  case LOADABLE:
571  t = Elem::LOADABLE;
572  break;
573 
574  case OUTPUT_ELEMENT:
575  case RTAI_OUTPUT: // deprecated
576  case SOCKETSTREAM_OUTPUT: // deprecated
577  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
579  << " does not support bind" << std::endl);
580  default:
581  silent_cerr("DataManager::ReadElems: unknown element type (label=" << uL << ") "
582  "at line " << HP.GetLineData() << std::endl);
584  } /* end switch (KeyWords(HP.GetWord())) */
585 
586  pEl = dynamic_cast<Elem*>(pFindElem(t, uL));
587 
588  if (!pEl) {
589  silent_cerr("cannot find " << psElemNames[t] << " (" << uL << ") "
590  "at line " << HP.GetLineData() << std::endl);
592  }
593  }
594 
595  /* Label del nodo parameter */
596  unsigned uL = HP.GetInt();
597 
598  Elem2Param* pNd = pFindNode<Elem2Param, ParameterNode, Node::PARAMETER>(uL);
599  if (pNd == 0) {
600  silent_cerr("can't find parameter node (" << uL << ") "
601  "at line " << HP.GetLineData() << std::endl);
603  }
604 
605  /* Numero d'ordine del dato privato a cui fare il binding */
606  unsigned int i = 0;
607  std::string s;
608  if (HP.IsKeyWord("name") || HP.IsKeyWord("string" /* deprecated */ )) {
609  s = HP.GetStringWithDelims();
610 
611  ASSERT(!s.empty());
612 
613  DEBUGCOUT("binding to " << psElemNames[pEl->GetElemType()]
614  << "(" << pEl->GetLabel() << ") private data "
615  "\"" << s << "\"" << std::endl);
616 
617  i = pEl->iGetPrivDataIdx(s.c_str());
618 
619  } else {
620  if (HP.IsKeyWord("index")) {
621  // may become required
622  NO_OP;
623  }
624  i = HP.GetInt();
625  }
626 
627  /* indice del dato a cui il parametro e' bound */
628  if (i <= 0 || i > pEl->iGetNumPrivData()) {
629  if (!s.empty()) {
630  silent_cerr("error in private data \"" << s << "\" "
631  "for element " << psElemNames[t] << " (" << pEl->GetLabel() << ") "
632  "while binding to ParameterNode(" << uL << ") "
633  "at line " << HP.GetLineData() << std::endl);
634 
635  } else {
636  silent_cerr("error in private data #" << i << " "
637  "for element " << psElemNames[t] << " (" << pEl->GetLabel() << ") "
638  "while binding to ParameterNode(" << uL << ") "
639  "at line " << HP.GetLineData() << std::endl);
640  }
642  }
643 
644  /* fa il binding del ParameterNode all'elemento */
645  DEBUGLCOUT(MYDEBUG_INPUT, "Binding " << psElemNames[t]
646  << " (" << pEl->GetLabel() << ") "
647  "to Parameter " << pNd->GetLabel() << std::endl);
648  pNd->Bind(pEl, i);
649 
650  /* Gust is attached to air properties... */
651  } else if (CurrDesc == GUST) {
652  if (ElemData[Elem::AIRPROPERTIES].ElemContainer.empty()) {
653  silent_cerr("air properties not defined; "
654  "cannot add gust at line "
655  << HP.GetLineData() << std::endl);
657  }
658  ElemContainerType::iterator ap = ElemData[Elem::AIRPROPERTIES].ElemContainer.begin();
659  dynamic_cast<AirProperties *>(ap->second)->AddGust(ReadGustData(this, HP));
660 
661  /* gestisco a parte gli elementi automatici strutturali, perche'
662  * sono gia' stati costruiti altrove e li devo solo inizializzare;
663  * eventualmente si puo' fare altrimenti */
664  } else if (CurrDesc == AUTOMATICSTRUCTURAL) {
665  AutomaticStructDispElem* pASD = ReadElem<AutomaticStructDispElem, Elem::AUTOMATICSTRUCTURAL>(HP);
666  ASSERT(pASD != 0);
667  AutomaticStructElem* pAS = dynamic_cast<AutomaticStructElem *>(pASD);
668  if (pAS) {
669  DEBUGCOUT("reading AutomaticStructElem(" << pAS->GetLabel() << ")" << std::endl);
670 
671  /* forse e' il caso di usare il riferimento del nodo? */
672 
673  /* NOTE: i primi due sono gestiti direttamente
674  * dagli elementi con inerzia, e quindi non sono usati */
675  Vec3 q(HP.GetVecAbs(::AbsRefFrame));
676  Vec3 g(HP.GetVecAbs(::AbsRefFrame));
677  Vec3 qp(HP.GetVecAbs(::AbsRefFrame));
678  Vec3 gp(HP.GetVecAbs(::AbsRefFrame));
679 
680  DEBUGCOUT("Q = " << q << std::endl
681  << "G = " << g << std::endl
682  << "Qp = " << qp << std::endl
683  << "Gp = " << gp << std::endl);
684 
685  pAS->Init(q, g, qp, gp);
686 
687  } else {
688  DEBUGCOUT("reading AutomaticStructDispElem(" << pASD->GetLabel() << ")" << std::endl);
689 
690  Vec3 q(HP.GetVecAbs(::AbsRefFrame));
691  Vec3 qp(HP.GetVecAbs(::AbsRefFrame));
692 
693  DEBUGCOUT("Q = " << q << std::endl
694  << "Qp = " << qp << std::endl);
695 
696  pASD->Init(q, qp);
697  }
698 
699  /* <<<< D E F A U L T >>>> : Read one element and create it */
700  /* default: leggo un elemento e lo creo */
701  } else {
702  /* puntatore all'elemento */
703  Elem* pE = 0;
704 
705  unsigned int uLabel;
706  switch (CurrDesc) {
707  /* Qui vengono elencati gli elementi unici, che non richiedono label
708  * (per ora: accelerazione di gravita' e proprieta' dell'aria */
709 
710  /* Accelerazione di gravita' */
711  case GRAVITY: {
712  silent_cout("Reading Gravity" << std::endl);
713 
714  if (iNumTypes[Elem::GRAVITY]-- <= 0) {
715  DEBUGCERR("");
716  silent_cerr("line " << HP.GetLineData() << ": "
717  ": Gravity is not defined" << std::endl);
718 
720  }
721 
722  pE = ReadGravity(this, HP);
723  uLabel = 1;
724  InsertElem(ElemData[Elem::GRAVITY], uLabel, pE);
725 
726  *ei = pE;
727  ++ei;
728 
729  break;
730  }
731 
732  /* Elementi aerodinamici: proprieta' dell'aria */
733  case AIRPROPERTIES: {
734  silent_cout("Reading AirProperties" << std::endl);
735 
736  if (iNumTypes[Elem::AIRPROPERTIES]-- <= 0) {
737  DEBUGCERR("");
738  silent_cerr("line " << HP.GetLineData() << ": "
739  "AirProperties is not defined"
740  << std::endl);
741 
743  }
744 
745  uLabel = 1;
746 
747  pE = ReadAirProperties(this, HP);
748  if (pE != 0) {
750 
751  *ei = pE;
752  ++ei;
753  }
754 
755  break;
756  }
757 
758  /* Elemento generico: legge la label e fa un nuovo switch */
759  default: {
760  /* legge la label */
761  uLabel = unsigned(HP.GetInt());
762 
763  /* in base al tipo, avviene l'allocazione */
764  switch (CurrDesc) {
765  case DRIVEN: {
766  /* Reads the driver */
767  DriveCaller* pDC = HP.GetDriveCaller();
768  std::vector<std::string> hints;
769 
770  for (unsigned i = 1; HP.IsKeyWord("hint"); i++) {
771  const char *hint = HP.GetStringWithDelims(HighParser::DEFAULTDELIM, false);
772  if (hint == 0) {
773  silent_cerr("Driven(" << uLabel << "): "
774  "unable to read hint #" << i
775  << " at line " << HP.GetLineData()
776  << std::endl);
778  }
779  hints.push_back(hint);
780  }
781 
782  HP.ExpectDescription();
783  KeyWords CurrDriven = KeyWords(HP.GetDescription());
784 
785 #ifdef DEBUG
786  switch (CurrDriven) {
787  case FORCE:
788  case BODY:
789  case JOINT:
791  case COUPLE:
792  case BEAM:
793  case BEAM3: /* same as BEAM */
794  case BEAM2:
795  case HBEAM:
796  case SHELL4EAS:
797  case SHELL4EASANS:
798 
799  case INDUCEDVELOCITY:
800  case ROTOR:
801  case AERODYNAMICBODY:
802  case AERODYNAMICBEAM:
803  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
804  case AERODYNAMICBEAM2:
805  case AIRCRAFTINSTRUMENTS:
807 
808  case GENEL:
809  case ELECTRIC:
810 
811  case THERMAL:
812 
813  case HYDRAULIC:
814 
815  case BULK:
816  case USER_DEFINED:
817  case LOADABLE:
818  case EXISTING:
819  DEBUGLCOUT(MYDEBUG_INPUT, "OK, this element can be driven" << std::endl);
820  break;
821 
822  case OUTPUT_ELEMENT:
823  case RTAI_OUTPUT: // deprecated
824  case SOCKETSTREAM_OUTPUT: // deprecated
825  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
827  << " cannot be driven" << std::endl);
829 
830  default:
831  DEBUGCERR("warning, this element cannot be driven" << std::endl);
832  break;
833  }
834 #endif /* DEBUG */
835 
836  Elem **ppE = 0;
837  bool bExisting(false);
838  if (CurrDriven == EXISTING) {
839  bExisting = true;
840  iMissingElems++;
841  CurrDriven = KeyWords(HP.GetWord());
842  unsigned int uL = (unsigned int)HP.GetInt();
843  if (uL != uLabel) {
844  silent_cerr("Error: the driving element must have "
845  "the same label of the driven one"
846  << std::endl);
847 
849  }
850 
851  /* FIXME: use pFindElem() instead? */
852  switch (CurrDriven) {
853  case FORCE:
854  ppE = ppFindElem(Elem::FORCE, uLabel);
855  break;
856 
857  case BODY:
858  ppE = ppFindElem(Elem::BODY, uLabel);
859  break;
860 
861  case JOINT:
862  ppE = ppFindElem(Elem::JOINT, uLabel);
863  break;
864 
866  ppE = ppFindElem(Elem::JOINT_REGULARIZATION, uLabel);
867  break;
868 
869  case COUPLE:
870  ppE = ppFindElem(Elem::FORCE, uLabel);
871  break;
872 
873  case BEAM:
874  case BEAM3: /* same as BEAM */
875  case BEAM2:
876  case HBEAM:
877  ppE = ppFindElem(Elem::BEAM, uLabel);
878  break;
879 
880  case MEMBRANE4EAS:
881  case SHELL4EAS:
882  case SHELL4EASANS:
883  ppE = ppFindElem(Elem::PLATE, uLabel);
884  break;
885 
886  case INDUCEDVELOCITY:
887  case ROTOR:
888  ppE = ppFindElem(Elem::INDUCEDVELOCITY, uLabel);
889  break;
890 
891  case AERODYNAMICBODY:
892  case AERODYNAMICBEAM:
893  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
894  case AERODYNAMICBEAM2:
895  case AIRCRAFTINSTRUMENTS:
897  ppE = ppFindElem(Elem::AERODYNAMIC, uLabel);
898  break;
899 
900  case GENEL:
901  ppE = ppFindElem(Elem::GENEL, uLabel);
902  break;
903 
904  case ELECTRIC:
905  ppE = ppFindElem(Elem::ELECTRIC, uLabel);
906  break;
907 
908  case THERMAL:
909  ppE = ppFindElem(Elem::THERMAL, uLabel);
910  break;
911 
912  case HYDRAULIC:
913  ppE = ppFindElem(Elem::HYDRAULIC, uLabel);
914  break;
915 
916  case BULK:
917  ppE = ppFindElem(Elem::BULK, uLabel);
918  break;
919 
920  case USER_DEFINED:
921  case LOADABLE:
922  ppE = ppFindElem(Elem::LOADABLE, uLabel);
923  break;
924 
925  default:
926  DEBUGCERR("warning, this element can't be driven" << std::endl);
927  break;
928 
929  } /*switch (CurrDriven) */
930 
931  if (ppE == NULL) {
932  silent_cerr("Error: element " << uLabel
933  << "cannot be driven since it doesn't exist"
934  << std::endl);
935 
937  }
938 
939  pE = *ppE;
940 
941  flag fOut = fReadOutput(HP, pE->GetElemType());
942  pE->SetOutputFlag(fOut);
943 
944  } else {
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 "
951  << HP.GetLineData() << std::endl);
952 
954  }
955 
956  /* Reads the true element */
957  ppE = ReadOneElem(HP, uLabel, "", CurrDriven);
958  if (ppE == NULL) {
959  DEBUGCERR("");
960  silent_cerr("error in allocation of element "
961  << uLabel << std::endl);
962 
964  }
965 
966  pE = *ppE;
967  } /* if (CurrDriven == EXISTING) {..} else {..} */
968 
969  SimulationEntity::Hints *pHints = 0;
970  if (!hints.empty()) {
971  for (std::vector<std::string>::const_iterator i = hints.begin();
972  i != hints.end(); ++i)
973  {
974  Hint *ph = pE->ParseHint(this, i->c_str());
975  if (ph != 0) {
976  if (pHints == 0) {
977  pHints = new SimulationEntity::Hints;
978  }
979  pHints->push_back(ph);
980  }
981  }
982  }
983 
984  /* Creates the driver for the element */
985  Elem* pEl = 0;
987  DrivenElem,
988  DrivenElem(this, pDC, pE, pHints));
989 
990  if (bExisting) {
991  ElemVecType::iterator eitmp = Elems.begin();
992  for (; eitmp != Elems.end(); ++eitmp) {
993  if (*eitmp == pE) {
994  *eitmp = pEl;
995  break;
996  }
997  }
998 
999  ASSERT(eitmp != Elems.end());
1000 
1001  } else {
1002  *ei = pEl;
1003  ++ei;
1004  }
1005 
1006  /* Substitutes the element with the driver */
1007  pE = *ppE = pEl;
1008 
1009  break;
1010  } /* end case DRIVEN: */
1011 
1012  /* <<<< N O R M A L E L E M E N T S >>>>> */
1013  /* Normal element */
1014  case FORCE:
1015 
1016  case BODY:
1017  case INERTIA:
1018  case JOINT:
1019  case JOINT_REGULARIZATION:
1020  case COUPLE:
1021  case BEAM:
1022  case BEAM3: /* same as BEAM */
1023  case BEAM2:
1024  case HBEAM:
1025  case MEMBRANE4EAS:
1026  case SHELL4EAS:
1027  case SHELL4EASANS:
1028 
1029  case GUST:
1030  case INDUCEDVELOCITY:
1031  case ROTOR:
1032  case AERODYNAMICBODY:
1033  case AERODYNAMICBEAM:
1034  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
1035  case AERODYNAMICBEAM2:
1036  case AIRCRAFTINSTRUMENTS:
1038 #ifdef USE_EXTERNAL
1039  case AERODYNAMICEXTERNAL:
1041 #endif /* USE_EXTERNAL */
1042  case AEROMODAL:
1043 
1044  case GENEL:
1045  case ELECTRIC:
1046 
1047  case THERMAL:
1048 
1049  case HYDRAULIC:
1050 
1051  case BULK:
1052  case USER_DEFINED:
1053  case LOADABLE:
1054 
1055  case OUTPUT_ELEMENT:
1056  case RTAI_OUTPUT: // deprecated
1057  case SOCKETSTREAM_OUTPUT: // deprecated
1058  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
1059  {
1060  Elem **ppE = 0;
1061 
1062  /* Nome dell'elemento */
1063  std::string sName;
1064  if (HP.IsKeyWord("name")) {
1065  const char *sTmp = HP.GetStringWithDelims();
1066  if (sTmp == 0) {
1067  silent_cerr("error - element type "
1068  << sKeyWords[CurrDesc] << ": "
1069  "unable to parse name"
1070  " at line " << HP.GetLineData()
1071  << std::endl);
1073  }
1074  sName = sTmp;
1075  }
1076 
1077 #ifdef USE_RUNTIME_LOADING
1078  if ((CurrDesc == LOADABLE || CurrDesc == USER_DEFINED)
1079  && !moduleInitialized)
1080  {
1082  moduleInitialized = true;
1083  }
1084 #endif // USE_RUNTIME_LOADING
1085 
1086  ppE = ReadOneElem(HP, uLabel, sName, CurrDesc);
1087 
1088  if (ppE != 0) {
1089  pE = *ppE;
1090  if (!sName.empty() && sName != pE->GetName()) {
1091  pE->PutName(sName);
1092  }
1093 
1094  *ei = *ppE;
1095  ++ei;
1096  }
1097 
1098  break;
1099  } /* end case 'Normal elements'*/
1100 
1101  /* in caso di tipo sconosciuto */
1102  case UNKNOWNKEYWORD: {
1103  DEBUGCERR("");
1104  silent_cerr("error - unknown element type at line "
1105  << HP.GetLineData() << std::endl);
1106 
1108  }
1109 
1110  default: {
1111  DEBUGCERR("");
1112  silent_cerr("error - element type " << sKeyWords[CurrDesc]
1113  << " at line " << HP.GetLineData()
1114  << " is not allowed " << std::endl);
1115 
1117  }
1118  } /* end switch (CurrDesc) 'in base al tipo' */
1119 
1120  } /* end case default: 'Elemento generico' */
1121  } /* end switch (CurrDesc) 'Elemento generico' */
1122 
1123  /* verifica dell'allocazione */
1124  if (pE != 0) {
1125  /* decrementa il totale degli elementi mancanti */
1126  iMissingElems--;
1127  }
1128 
1129  } /* end <<<< D E F A U L T >>>> : Read one element and create it */
1130  /* end default: leggo un elemento e lo creo */
1131 
1132  } /* while ((CurrDesc = KeyWords(HP.GetDescription())) != END) */
1133 
1134  if (KeyWords(HP.GetWord()) != ELEMENTS) {
1135  DEBUGCERR("");
1136  silent_cerr("<end: elements;> expected at line"
1137  << HP.GetLineData() << std::endl);
1138 
1140  }
1141 
1142  /* Se non c'e' il punto e virgola finale */
1143  if (HP.IsArg()) {
1144  DEBUGCERR("");
1145  silent_cerr("semicolon expected at line " << HP.GetLineData()
1146  << std::endl);
1147 
1149  }
1150 
1151  if (iMissingElems > 0) {
1152  DEBUGCERR("");
1153  silent_cerr("error: " << iMissingElems
1154  << " elements are missing;" << std::endl);
1155  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1156  if (iNumTypes[iCnt] > 0) {
1157  silent_cerr(" " << iNumTypes[iCnt]
1158  << ' ' << psElemNames[iCnt] << std::endl);
1159  }
1160  }
1161 
1163  }
1164 
1165  /* Linka gli elementi che generano forze d'inerzia all'elemento
1166  * accelerazione di gravita' */
1167  if (!ElemData[Elem::GRAVITY].ElemContainer.empty()) {
1168  Gravity* pGrav = dynamic_cast<Gravity *>(ElemData[Elem::GRAVITY].ElemContainer.begin()->second);
1169  ASSERT(pGrav != 0);
1170 
1171  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1172  if (ElemData[iCnt].bGeneratesInertiaForces()
1173  && !ElemData[iCnt].ElemContainer.empty())
1174  {
1175  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1176  p != ElemData[iCnt].ElemContainer.end(); ++p)
1177  {
1178  ElemGravityOwner *pGO = Cast<ElemGravityOwner>(p->second);
1179 
1180  ASSERT(pGO != 0);
1181  pGO->PutGravity(pGrav);
1182  }
1183  }
1184  }
1185  }
1186 
1187  /* Linka gli elementi che usano le proprieta' dell'aria all'elemento
1188  * proprieta' dell'aria */
1189  if (!ElemData[Elem::AIRPROPERTIES].ElemContainer.empty()) {
1190  AirProperties* pProp = dynamic_cast<AirProperties *>(ElemData[Elem::AIRPROPERTIES].ElemContainer.begin()->second);
1191  ASSERT(pProp != 0);
1192 
1193  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1194  if (ElemData[iCnt].bUsesAirProperties()
1195  && !ElemData[iCnt].ElemContainer.empty())
1196  {
1197  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1198  p != ElemData[iCnt].ElemContainer.end(); ++p)
1199  {
1200  AerodynamicElem *pAE = Cast<AerodynamicElem>(p->second);
1201 
1202  ASSERT(pAE != 0);
1203  pAE->PutAirProperties(pProp);
1204  }
1205  }
1206  }
1207 
1208  } else { /* '' */
1209  /* Esegue un controllo per vedere se esistono elementi aerodinamici
1210  * ma non sono definite le proprieta' dell'aria, nel qual caso
1211  * il calcolo deve essere arrestato */
1212  bool bStop(false);
1213 
1214  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1215  if (ElemData[iCnt].bUsesAirProperties()
1216  && !ElemData[iCnt].ElemContainer.empty())
1217  {
1218  for (ElemContainerType::const_iterator p = ElemData[iCnt].ElemContainer.begin();
1219  p != ElemData[iCnt].ElemContainer.end(); ++p)
1220  {
1221  if (dynamic_cast<AerodynamicElem *>(p->second)->NeedsAirProperties()) {
1222  if (!bStop) {
1223  silent_cerr("The following aerodynamic elements "
1224  "are defined: " << std::endl);
1225  bStop = true;
1226  }
1227  }
1228  }
1229  }
1230  }
1231 
1232  if (bStop) {
1233  silent_cerr("while no air properties are defined; aborting..."
1234  << std::endl);
1235 
1237  }
1238  }
1239 
1240 #ifdef DEBUG
1241  ASSERT(ei == Elems.end());
1242 
1243  /* count & initialize element array */
1244  unsigned iNumElems = 0;
1245  for (int iCnt = 0; iCnt < Elem::LASTELEMTYPE; iCnt++) {
1246  iNumElems += ElemData[iCnt].ElemContainer.size();
1247  }
1248  ASSERT(iNumElems == Elems.size());
1249 #endif // DEBUG
1250 
1251  DEBUGLCOUT(MYDEBUG_INPUT, "End of elements data" << std::endl);
1252 } /* End of DataManager::ReadElems() */
Definition: hint.h:38
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
Elem * ReadGravity(DataManager *pDM, MBDynParser &HP)
Definition: gravity.cc:237
ElemVecType Elems
Definition: dataman.h:609
void PutName(const std::string &sN)
Definition: withlab.cc:56
virtual StructDispNode::Type GetStructDispNodeType(void) const
Definition: strnode.cc:1101
void module_initialize(void)
Definition: modules.cc:44
ElemContainerType ElemContainer
Definition: dataman.h:591
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
void PutGravity(const Gravity *pG)
Definition: gravity.cc:201
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
void Init(const Vec3 &b, const Vec3 &bp)
Definition: autostr.cc:69
Elem ** InsertElem(ElemDataStructure &eldata, unsigned int uLabel, Elem *pE)
Definition: dataman.h:595
virtual Hint * ParseHint(DataManager *pDM, const char *s) const
Definition: simentity.cc:76
virtual void PutAirProperties(const AirProperties *pAP)
Definition: aerodyn.cc:717
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: simentity.cc:142
Gust * ReadGustData(const DataManager *pDM, MBDynParser &HP)
Definition: gust.cc:190
#define DEBUGCERR(msg)
Definition: myassert.h:235
#define NO_OP
Definition: myassert.h:74
virtual Elem::Type GetElemType(void) const =0
std::vector< Hint * > Hints
Definition: simentity.h:89
Definition: dataman4.cc:96
NodeContainerType NodeContainer
Definition: dataman.h:731
Elem * ReadAirProperties(DataManager *pDM, MBDynParser &HP)
Definition: aerodyn.cc:521
virtual void ExpectDescription(void)
Definition: parser.cc:789
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
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)
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
virtual void Bind(const Elem *pEl, unsigned int i)
Definition: j2p.cc:53
int GetDescription(void)
Definition: parser.cc:730
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
Definition: parser.cc:1228
#define ASSERT(expression)
Definition: colamd.c:977
Elem ** ppFindElem(Elem::Type Typ, unsigned int uElem) const
Definition: elman.cc:629
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
static int iNumTypes[Elem::LASTELEMTYPE]
Definition: dataman4.cc:91
void Init(const Vec3 &b, const Vec3 &g, const Vec3 &bp, const Vec3 &gp)
Definition: autostr.cc:428
Elem ** ReadOneElem(MBDynParser &HP, unsigned int uLabel, const std::string &sName, int CurrType)
Definition: dataman4.cc:1255
virtual unsigned int iGetNumPrivData(void) const
Definition: simentity.cc:136
Vec3 GetVecAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1641
Definition: j2p.h:40
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
Type
Definition: elem.h:91
const char * psElemNames[]
Definition: enums.cc:39
virtual int GetWord(void)
Definition: parser.cc:1083
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
void OutputOpen(const OutputHandler::OutFiles out)
Definition: dataman.cc:677
virtual void SetOutputFlag(flag f=flag(1))
Definition: output.cc:896
const std::string & GetName(void) const
Definition: withlab.cc:68
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual StructNode::Type GetStructNodeType(void) const
Definition: strnode.cc:2946
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

Node * DataManager::ReadNode ( MBDynParser HP,
Node::Type  type 
) const

Definition at line 2309 of file dataman3.cc.

References DEBUGLCOUT, HighParser::GetInt(), IncludeParser::GetLineData(), MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, pFindNode(), and psNodeNames.

Referenced by AeroDynModule::AeroDynModule(), asynchronous_machine::asynchronous_machine(), HydrodynamicPlainBearing::HydrodynamicPlainBearing(), InlineFriction::InlineFriction(), LoadIncForce::LoadIncForce(), ModuleIMU::ModuleIMU(), ModuleIMUConstraint::ModuleIMUConstraint(), ModuleNonsmoothNode::ModuleNonsmoothNode(), NodeDistDCR::Read(), MotionContentTypeReader::Read(), ReadAerodynamicBody(), ReadAircraftInstruments(), ReadBeam(), ReadBeam2(), ReadBody(), ReadElectric(), ReadForce(), ReadGenel(), ReadGenericAerodynamicForce(), ReadHBeam(), ReadHydraulicElem(), ReadJoint(), ReadMembrane4EAS(), ReadModalExtForce(), ReadModalMappingExtForce(), ReadNode(), ReadResSet(), ReadRotor(), ReadRotorData(), ReadShell4EAS(), ReadShell4EASANS(), ReadStructExtForce(), ReadStructMappingExtForce(), ReadStructNode(), ReadStructuralForce(), ReadThermal(), Wheel2::Wheel2(), and Wheel4::Wheel4().

2310 {
2311  integer iNode = HP.GetInt();
2312  if (iNode < 0) {
2313  silent_cerr("DataManager::ReadNode: invalid node label " << iNode
2314  << " at line " << HP.GetLineData() << std::endl);
2316  }
2317  unsigned int uNode = (unsigned int)iNode;
2318 
2319  DEBUGLCOUT(MYDEBUG_INPUT, "DataManager::ReadNode: " << psNodeNames[type] << "(" << uNode << ")" << std::endl);
2320 
2321  /* verifica di esistenza del nodo */
2322  Node* pNode = pFindNode(type, uNode);
2323  if (pNode == 0) {
2324  silent_cerr("DataManager::ReadNode: " << psNodeNames[type] << "(" << uNode << ")"
2325  " not defined at line "
2326  << HP.GetLineData() << std::endl);
2328  }
2329 
2330  return pNode;
2331 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: node.h:67
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
const char * psNodeNames[]
Definition: enums.cc:372
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * pFindNode(Node::Type Typ, unsigned int uNode) const
Definition: nodeman.cc:179
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

template<class Tbase , Node::Type type>
Tbase * DataManager::ReadNode ( MBDynParser HP) const

Definition at line 994 of file dataman.h.

References ASSERT, WithLabel::GetLabel(), IncludeParser::GetLineData(), MBDYN_EXCEPT_ARGS, psNodeNames, and ReadNode().

995 {
996  Node *pNode = ReadNode(HP, type);
997  ASSERT(pNode != 0);
998 
999  Tbase *pNodeBase = dynamic_cast<Tbase *>(pNode);
1000  if (pNodeBase == 0) {
1001  silent_cerr("DataManager::ReadNode: unable to cast " << psNodeNames[type] << "(" << pNode->GetLabel() << ") "
1002  "to \"" << mbdyn_demangle<Tbase>() << "\" at line " << HP.GetLineData() << std::endl);
1004  }
1005 
1006  return pNodeBase;
1007 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: node.h:67
#define ASSERT(expression)
Definition: colamd.c:977
const char * psNodeNames[]
Definition: enums.cc:372
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
unsigned int GetLabel(void) const
Definition: withlab.cc:62
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309

Here is the call graph for this function:

template<class Tder , class Tbase , Node::Type type>
Tder * DataManager::ReadNode ( MBDynParser HP) const

Definition at line 1011 of file dataman.h.

References ASSERT, IncludeParser::GetLineData(), MBDYN_EXCEPT_ARGS, and psNodeNames.

1012 {
1013  Tbase *pNodeBase = ReadNode<Tbase, type>(HP);
1014  ASSERT(pNodeBase != 0);
1015 
1016  Tder *pNodeDer = dynamic_cast<Tder *>(pNodeBase);
1017  if (pNodeDer == 0) {
1018  silent_cerr("DataManager::ReadNode: unable to cast " << psNodeNames[type] << "(" << pNodeBase->GetLabel() << ") "
1019  "from \"" << mbdyn_demangle<Tbase>() << "\" "
1020  "to \"" << mbdyn_demangle<Tder>() << "\" at line " << HP.GetLineData() << std::endl);
1022  }
1023 
1024  return pNodeDer;
1025 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define ASSERT(expression)
Definition: colamd.c:977
const char * psNodeNames[]
Definition: enums.cc:372
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function:

void DataManager::ReadNodes ( MBDynParser HP)
protected

Definition at line 1557 of file dataman3.cc.

References Node::ABSTRACT, DofOwner::ABSTRACTNODE, ASSERT, DEBUGCERR, DEBUGCOUTFNAME, DEBUGLCOUT, DofData, dReadScale(), DrvHdl, DummyDofOwner, Node::ELECTRIC, ELECTRIC, DofOwner::ELECTRICNODE, END, fReadOutput(), HighParser::GetDescription(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::GetStringWithDelims(), HighParser::GetWord(), Node::HYDRAULIC, HYDRAULIC, DofOwner::HYDRAULICNODE, DataManager::NodeDataStructure::iExpectedNum, InsertNode(), iNumTypes, HighParser::IsArg(), HighParser::IsKeyWord(), iTotNodes, LASTKEYWORD, Node::LASTNODETYPE, MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, DataManager::NodeDataStructure::NodeContainer, NodeData, Nodes, OUTPUT, Node::PARAMETER, pFindNode(), ScalarDof::pNode, psNodeNames, psReadNodesNodes, ReadScalarAlgebraicNode(), ReadScalarDifferentialNode(), ReadScalarDof(), ReadStructNode(), SAFENEWWITHCONSTRUCTOR, ToBeOutput::SetOutputFlag(), DofOwner::SetScale(), Node::STRUCTURAL, DofOwner::STRUCTURALNODE, Node::THERMAL, THERMAL, and DofOwner::THERMALNODE.

Referenced by DataManager().

1558 {
1559  DEBUGCOUTFNAME("DataManager::ReadNodes");
1560 
1561  /* parole chiave del blocco di controllo */
1562  const char* sKeyWords[] = {
1563  "end",
1564  "nodes",
1565 
1568  psReadNodesNodes[Node::THERMAL],
1569  psReadNodesNodes[Node::ABSTRACT],
1570  psReadNodesNodes[Node::PARAMETER],
1571  psReadNodesNodes[Node::HYDRAULIC],
1572 
1573  "output",
1574  NULL
1575  };
1576 
1577  /* enum delle parole chiave */
1578  enum KeyWords {
1579  UNKNOWN = -1,
1580 
1581  END = 0,
1582  NODES,
1583 
1584  STRUCTURAL,
1585  ELECTRIC,
1586  THERMAL,
1587  ABSTRACT,
1588  PARAMETER,
1589  HYDRAULIC,
1590 
1591  OUTPUT,
1592 
1593  LASTKEYWORD
1594  };
1595 
1596  /* tabella delle parole chiave */
1597  KeyTable K(HP, sKeyWords);
1598 
1599  /* struttura di servizio che conta i nodi tipo per tipo */
1601  for (int i = 0; i < Node::LASTNODETYPE; i++) {
1602  iNumTypes[i] = NodeData[i].iExpectedNum;
1603  }
1604 
1605  int iMissingNodes = iTotNodes;
1606  DEBUGLCOUT(MYDEBUG_INPUT, "Expected nodes: " << iMissingNodes << std::endl);
1607 
1608  NodeVecType::iterator ni = Nodes.begin();
1609 
1610  KeyWords CurrDesc;
1611  while ((CurrDesc = KeyWords(HP.GetDescription())) != END) {
1612  if (CurrDesc == OUTPUT) {
1613  DEBUGLCOUT(MYDEBUG_INPUT, "nodes to be output: ");
1614 
1615  Node::Type Typ;
1616  flag fOutput = 1;
1617  switch (KeyWords(HP.GetWord())) {
1618 
1619  case STRUCTURAL:
1620  DEBUGLCOUT(MYDEBUG_INPUT, "structural" << std::endl);
1621  Typ = Node::STRUCTURAL;
1622  if (HP.IsKeyWord("accelerations")) {
1623  fOutput |= 2;
1624  }
1625  break;
1626 
1627  case ELECTRIC:
1628  DEBUGLCOUT(MYDEBUG_INPUT, "electric" << std::endl);
1629  Typ = Node::ELECTRIC;
1630  break;
1631 
1632  case THERMAL:
1633  DEBUGLCOUT(MYDEBUG_INPUT, "thermal" << std::endl);
1634  Typ = Node::THERMAL;
1635  break;
1636 
1637  case ABSTRACT:
1638  DEBUGLCOUT(MYDEBUG_INPUT, "abstract" << std::endl);
1639  Typ = Node::ABSTRACT;
1640  break;
1641 
1642  case PARAMETER:
1643  DEBUGLCOUT(MYDEBUG_INPUT, "parameter" << std::endl);
1644  Typ = Node::PARAMETER;
1645  break;
1646 
1647  case HYDRAULIC:
1648  DEBUGLCOUT(MYDEBUG_INPUT, "hydraulic" << std::endl);
1649  Typ = Node::HYDRAULIC;
1650  break;
1651 
1652  default:
1653  silent_cerr("Error: unknown node type, cannot modify output"
1654  << std::endl);
1655 
1657  }
1658 
1659  while (HP.IsArg()) {
1660  if (HP.IsKeyWord("range")) {
1661  unsigned int uL = (unsigned int)HP.GetInt();
1662  unsigned int uEndL = (unsigned int)HP.GetInt();
1663 
1664  if (uEndL < uL) {
1665  silent_cerr("End label " << uEndL
1666  << " must be larger "
1667  "than or equal to start label " << uL
1668  << std::endl);
1670  }
1671 
1672  for (; uL <= uEndL; uL++) {
1673  Node* pN = pFindNode(Typ, uL);
1674  if (pN != NULL) {
1676  "node " << uL << std::endl);
1677  pN->SetOutputFlag(fOutput);
1678  }
1679  }
1680 
1681  } else {
1682  unsigned int uL = (unsigned int)HP.GetInt();
1683 
1684  Node* pN = pFindNode(Typ, uL);
1685  if (pN == 0) {
1686  silent_cerr(psNodeNames[Typ]
1687  << "(" << uL << ") "
1688  "is not defined (ignored); "
1689  "output cannot be modified "
1690  "at line " << HP.GetLineData()
1691  << std::endl);
1692 
1693  } else {
1694  DEBUGLCOUT(MYDEBUG_INPUT, "node " << uL << std::endl);
1695  pN->SetOutputFlag(fOutput);
1696  }
1697  }
1698  }
1699  } else {
1700  /* puntatore al puntatore al nodo */
1701  Node** ppN = NULL;
1702 
1703  /* legge la label */
1704  unsigned int uLabel = 0;
1705  if (CurrDesc >= 0) {
1706  uLabel = unsigned(HP.GetInt());
1707  }
1708 
1709  /* Nome del nodo */
1710  std::string sName;
1711  if (HP.IsKeyWord("name")) {
1712  const char *sTmp = HP.GetStringWithDelims();
1713  sName = sTmp;
1714  }
1715 
1716  /* in base al tipo, avviene l'allocazione */
1717  switch (CurrDesc) {
1718  /* Struttura del blocco di lettura dei nodi:
1719  *
1720  * - test sul numero di nodi letti rispetto a quelli dichiarati
1721  * nel blocco di controllo:
1722  * if(iNumTypes[Node::??]-- <= 0)
1723  * < gestione dell'errore >
1724  *
1725  * - verifica di esistenza del nodo
1726  * if(pFindNode(Node::??, uLabel) != NULL)
1727  * < gestione dell'errore >
1728  *
1729  * - lettura dati specifici
1730  *
1731  * - allocazione e costruzione del nodo:
1732  * - assegnazione del puntatore:
1733  * ppN = NodeData[Node::??].ppFirstNode+
1734  * iNumTypes[Node::??];
1735  *
1736  * - allocazione e costruzione:
1737  * SAFENEW((??Node*)*ppN, ??Node(uLabel));
1738  *
1739  * - correzione del DofOwner relativo al nodo:
1740  * (DofData[DofOwner::??].pFirstDofOwner+
1741  * iNumTypes[Node::??])->iNumDofs =
1742  * DofData[DofOwner::??].iSize;
1743  *
1744  * - scrittura dei dati specifici dell'oggetto creato.
1745  * In alternativa i dati possono essere passato tutti
1746  * attraverso il costruttore.
1747  */
1748 
1749 
1750  /* Nodi strutturali */
1751  case STRUCTURAL: {
1752  silent_cout("Reading "
1753  << psNodeNames[Node::STRUCTURAL] << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")"
1754  << std::endl);
1755 
1756  /* verifica che non siano gia' stati letti tutti
1757  * quelli previsti */
1758  if (iNumTypes[Node::STRUCTURAL]-- <= 0) {
1759  DEBUGCERR("");
1760  silent_cerr("line " << HP.GetLineData() << ": "
1761  << psNodeNames[Node::STRUCTURAL] << "(" << uLabel << ") "
1762  "exceeds structural nodes number"
1763  << std::endl);
1764 
1766  }
1767 
1768  /* verifica di esistenza del nodo */
1769  if (pFindNode(Node::STRUCTURAL, uLabel) != NULL) {
1770  DEBUGCERR("");
1771  silent_cerr("line " << HP.GetLineData() << ": "
1772  << psNodeNames[Node::STRUCTURAL] << "(" << uLabel << ") "
1773  "already defined" << std::endl);
1774 
1776  }
1777 
1778 
1779  /* lettura dei dati specifici */
1780 
1781  /* allocazione e creazione */
1783  - iNumTypes[Node::STRUCTURAL] - 1;
1784  DofOwner* pDO = DofData[DofOwner::STRUCTURALNODE].pFirstDofOwner + i;
1785 
1786  Node *pN = ReadStructNode(this, HP, pDO, uLabel);
1787  if (pN != 0) {
1788  ppN = InsertNode(NodeData[Node::STRUCTURAL], uLabel, pN);
1789  }
1790  } break;
1791 
1792  /* nodi elettrici */
1793  case ELECTRIC: {
1794  silent_cout("Reading "
1795  << psNodeNames[Node::ELECTRIC] << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")"
1796  << std::endl);
1797 
1798  /*
1799  * verifica che non siano gia' stati letti tutti
1800  * quelli previsti
1801  */
1802  if (iNumTypes[Node::ELECTRIC]-- <= 0) {
1803  silent_cerr("line " << HP.GetLineData() << ": "
1804  << psNodeNames[Node::ELECTRIC] << "(" << uLabel << ") "
1805  "exceeds declared number" << std::endl);
1807  }
1808 
1809  /* Initial values */
1810  doublereal dx(0.);
1811  doublereal dxp(0.);
1812 
1813  ReadScalarDifferentialNode(HP, uLabel, Node::ELECTRIC, dx, dxp);
1815  flag fOut = fReadOutput(HP, Node::ELECTRIC);
1816 
1817  /* allocazione e creazione */
1819  - iNumTypes[Node::ELECTRIC] - 1;
1820  DofOwner* pDO = DofData[DofOwner::ELECTRICNODE].pFirstDofOwner + i;
1821  pDO->SetScale(dScale);
1822 
1823  Node *pN = 0;
1825  ElectricNode,
1826  ElectricNode(uLabel, pDO, dx, dxp, fOut));
1827  if (pN != 0) {
1828  ppN = InsertNode(NodeData[Node::ELECTRIC], uLabel, pN);
1829  }
1830 
1831  } break;
1832 
1833  case THERMAL: {
1834  silent_cout("Reading "
1835  << psNodeNames[Node::THERMAL] << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")"
1836  << std::endl);
1837 
1838  /*
1839  * verifica che non siano gia' stati letti tutti
1840  * quelli previsti
1841  */
1842  if (iNumTypes[Node::THERMAL]-- <= 0) {
1843  silent_cerr("line " << HP.GetLineData() << ": "
1844  << psNodeNames[Node::THERMAL] << "(" << uLabel << ") "
1845  "exceeds declared number" << std::endl);
1847  }
1848 
1849  /* Initial values */
1850  doublereal dx(0.);
1851  doublereal dxp(0.);
1852 
1853  ReadScalarDifferentialNode(HP, uLabel, Node::THERMAL, dx, dxp);
1855  flag fOut = fReadOutput(HP, Node::THERMAL);
1856 
1857  /* allocazione e creazione */
1859  - iNumTypes[Node::THERMAL] - 1;
1860  DofOwner* pDO = DofData[DofOwner::THERMALNODE].pFirstDofOwner + i;
1861  pDO->SetScale(dScale);
1862 
1863  Node *pN = 0;
1865  ThermalNode,
1866  ThermalNode(uLabel, pDO, dx, dxp, fOut));
1867  if (pN != 0) {
1868  ppN = InsertNode(NodeData[Node::THERMAL], uLabel, pN);
1869  }
1870 
1871  } break;
1872 
1873  /* nodi astratti */
1874  case ABSTRACT: {
1875  silent_cout("Reading "
1876  << psNodeNames[Node::ABSTRACT] << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")"
1877  << std::endl);
1878 
1879  bool bAlgebraic(false);
1880 
1881  /*
1882  * verifica che non siano gia' stati letti tutti
1883  * quelli previsti
1884  */
1885  if (iNumTypes[Node::ABSTRACT]-- <= 0) {
1886  silent_cerr("line " << HP.GetLineData() << ": "
1887  << psNodeNames[Node::ABSTRACT] << "(" << uLabel << ") "
1888  "exceeds declared number" << std::endl);
1890  }
1891 
1892  if (HP.IsKeyWord("algebraic")) {
1893  bAlgebraic = true;
1894 
1895  } else if (!HP.IsKeyWord("differential")) {
1896  pedantic_cout("unspecified "
1897  << psNodeNames[Node::ABSTRACT] << "(" << uLabel << ") "
1898  "at line " << HP.GetLineData() << "; "
1899  "assuming \"differential\"" << std::endl);
1900  }
1901 
1902  /* lettura dei dati specifici */
1903  doublereal dx(0.);
1904  doublereal dxp(0.);
1905 
1906  if (bAlgebraic) {
1907  ReadScalarAlgebraicNode(HP, uLabel, Node::ABSTRACT, dx);
1908 
1909  } else {
1910  ReadScalarDifferentialNode(HP, uLabel, Node::ABSTRACT, dx, dxp);
1911  }
1913  flag fOut = fReadOutput(HP, Node::ABSTRACT);
1914 
1915  /* allocazione e creazione */
1917  - iNumTypes[Node::ABSTRACT] - 1;
1918  DofOwner* pDO = DofData[DofOwner::ABSTRACTNODE].pFirstDofOwner + i;
1919  pDO->SetScale(dScale);
1920 
1921  Node *pN = 0;
1922  if (bAlgebraic) {
1925  ScalarAlgebraicNode(uLabel, pDO, dx, fOut));
1926 
1927  } else {
1930  ScalarDifferentialNode(uLabel, pDO, dx, dxp, fOut));
1931  }
1932 
1933  if (pN != 0) {
1934  ppN = InsertNode(NodeData[Node::ABSTRACT], uLabel, pN);
1935  }
1936  } break;
1937 
1938  /* parametri */
1939  case PARAMETER: {
1940  silent_cout("Reading "
1941  << psNodeNames[Node::PARAMETER] << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")"
1942  << std::endl);
1943 
1944  /* verifica che non siano gia' stati letti tutti
1945  * quelli previsti */
1946  if (iNumTypes[Node::PARAMETER]-- <= 0) {
1947  DEBUGCERR("");
1948  silent_cerr("line " << HP.GetLineData() << ": "
1949  << psNodeNames[Node::PARAMETER] << "(" << uLabel << ") "
1950  "exceeds parameters number" << std::endl);
1951 
1953  }
1954 
1955  /* verifica di esistenza del nodo */
1956  if (pFindNode(Node::PARAMETER, uLabel) != NULL) {
1957  DEBUGCERR("");
1958  silent_cerr("line " << HP.GetLineData() << ": "
1959  << psNodeNames[Node::PARAMETER] << "(" << uLabel << ") "
1960  "already defined" << std::endl);
1961 
1963  }
1964 
1965  Node *pN = 0;
1966 
1967  /* bound a elemento */
1968  if (HP.IsKeyWord("element")) {
1970  psNodeNames[Node::PARAMETER] << "(" << uLabel << ") "
1971  "will be linked to an element" << std::endl);
1972  flag fOut = fReadOutput(HP, Node::PARAMETER);
1973 
1974  /* allocazione e creazione */
1976  Elem2Param,
1977  Elem2Param(uLabel, &DummyDofOwner, fOut));
1978 
1979  } else if (HP.IsKeyWord("sample" "and" "hold") ||
1980  HP.IsKeyWord("sample'n'hold"))
1981  {
1982 
1984  psNodeNames[Node::PARAMETER] << "(" << uLabel << ") "
1985  "is a sample-and-hold" << std::endl);
1986 
1987  ScalarDof SD(ReadScalarDof(this, HP, false, false));
1988 
1989  DriveCaller *pDC = NULL;
1992 
1993  doublereal dSP = HP.GetReal();
1994  if (dSP <= 0.) {
1995  silent_cerr("illegal sample period "
1996  "for SampleAndHold(" << uLabel << ") "
1997  "at line " << HP.GetLineData()
1998  << std::endl);
2000  }
2001 
2002  flag fOut = fReadOutput(HP, Node::PARAMETER);
2003 
2004  /* allocazione e creazione */
2006  SampleAndHold,
2007  SampleAndHold(uLabel, &DummyDofOwner,
2008  SD.pNode, pDC, dSP, fOut));
2009 
2010  /* strain gage */
2011  } else if (HP.IsKeyWord("strain" "gage") /* deprecated */
2012  || HP.IsKeyWord("beam" "strain" "gage"))
2013  {
2015  psNodeNames[Node::PARAMETER] << "(" << uLabel << ") "
2016  "is a strain gage" << std::endl);
2017 
2018  doublereal dY = HP.GetReal();
2019  doublereal dZ = HP.GetReal();
2020 
2021  flag fOut = fReadOutput(HP, Node::PARAMETER);
2022 
2023  /* allocazione e creazione */
2026  StrainGageParam(uLabel, &DummyDofOwner,
2027  dY, dZ, fOut));
2028 
2029  /* parametro generico */
2030  } else {
2031 
2032  /* lettura dei dati specifici */
2033  doublereal dX(0.);
2034  if (HP.IsArg()) {
2035  /* eat keyword "value" */
2036  if (!HP.IsKeyWord("value")) {
2037  pedantic_cerr("ParameterNode(" << uLabel << "): "
2038  "initial value specified without "
2039  "\"value\" keyword (deprecated)" << std::endl);
2040  }
2041  dX = HP.GetReal();
2043  "Initial value x = " << dX
2044  << " is supplied" << std::endl);
2045  }
2046 
2047  flag fOut = fReadOutput(HP, Node::PARAMETER);
2048 
2049  /* allocazione e creazione */
2051  ParameterNode,
2052  ParameterNode(uLabel, &DummyDofOwner,
2053  dX, fOut));
2054  }
2055 
2056  if (pN != 0) {
2057  ppN = InsertNode(NodeData[Node::PARAMETER], uLabel, pN);
2058  }
2059  } break;
2060 
2061  /* nodi idraulici */
2062  case HYDRAULIC: {
2063  silent_cout("Reading "
2064  << psNodeNames[Node::HYDRAULIC] << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")"
2065  << std::endl);
2066 
2067  /*
2068  * verifica che non siano gia' stati letti tutti
2069  * quelli previsti
2070  */
2071  if (iNumTypes[Node::HYDRAULIC]-- <= 0) {
2072  silent_cerr("line " << HP.GetLineData() << ": "
2073  << psNodeNames[Node::HYDRAULIC] << "(" << uLabel << ") "
2074  "exceeds declared number" << std::endl);
2076  }
2077 
2078  /* lettura dei dati specifici */
2079  doublereal dx(0.);
2080  ReadScalarAlgebraicNode(HP, uLabel, Node::ABSTRACT, dx);
2082  flag fOut = fReadOutput(HP, Node::HYDRAULIC);
2083 
2084  /* allocazione e creazione */
2086  - iNumTypes[Node::HYDRAULIC] - 1;
2087  DofOwner* pDO = DofData[DofOwner::HYDRAULICNODE].pFirstDofOwner + i;
2088  pDO->SetScale(dScale);
2089 
2090  Node *pN = 0;
2092  PressureNode,
2093  PressureNode(uLabel, pDO, dx, fOut));
2094 
2095  if (pN != 0) {
2096  ppN = InsertNode(NodeData[Node::HYDRAULIC], uLabel, pN);
2097  }
2098  } break;
2099 
2100 
2101  /* aggiungere eventuali nuovi tipi di nodo */
2102 
2103 
2104  /* in caso di tipo errato */
2105  case UNKNOWN:
2106  DEBUGCERR("");
2107  silent_cerr("unknown node type at line "
2108  << HP.GetLineData() << std::endl);
2110 
2111  default:
2112  DEBUGCERR("");
2113  silent_cerr("node type " << sKeyWords[CurrDesc]
2114  << " at line " << HP.GetLineData()
2115  << " is not allowed" << std::endl);
2116 
2118  }
2119 
2120  /* verifica dell'allocazione - comune a tutti i casi */
2121  if (*ppN == NULL) {
2122  DEBUGCERR("");
2123  silent_cerr("error in allocation "
2124  "of " << psNodeNames[CurrDesc] << "(" << uLabel << ")"
2125  << std::endl);
2126 
2128  }
2129 
2130  if (!sName.empty()) {
2131  (*ppN)->PutName(sName);
2132  }
2133 
2134  *ni = *ppN;
2135  ++ni;
2136 
2137  /* Decrementa i nodi attesi */
2138  iMissingNodes--;
2139  }
2140  }
2141 
2142  if (KeyWords(HP.GetWord()) != NODES) {
2143  DEBUGCERR("");
2144  silent_cerr("\"end: nodes;\" expected at line "
2145  << HP.GetLineData() << std::endl);
2146 
2148  }
2149 
2150  /* Se non c'e' il punto e virgola finale */
2151  if (HP.IsArg()) {
2152  DEBUGCERR("");
2153  silent_cerr("semicolon expected at line "
2154  << HP.GetLineData() << std::endl);
2155 
2157  }
2158 
2159  if (iMissingNodes > 0) {
2160  DEBUGCERR("");
2161  silent_cerr("warning: " << iMissingNodes
2162  << " nodes are missing;" << std::endl);
2163  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
2164  if (iNumTypes[iCnt] > 0) {
2165  silent_cerr(" " << iNumTypes[iCnt]
2166  << ' ' << psNodeNames[iCnt] << std::endl);
2167  }
2168  }
2169 
2171  }
2172 
2173  /* count & initialize node array */
2174  unsigned iNumNodes = 0;
2175  for (int iCnt = 0; iCnt < Node::LASTNODETYPE; iCnt++) {
2176  iNumNodes += NodeData[iCnt].NodeContainer.size();
2177  }
2178 
2179  ASSERT(ni == Nodes.end());
2180  ASSERT(iNumNodes == Nodes.size());
2181 
2182  DEBUGLCOUT(MYDEBUG_INPUT, "End of nodes data" << std::endl);
2183 } /* End of DataManager::ReadNodes() */
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
long int flag
Definition: mbdyn.h:43
const char * psReadNodesNodes[]
Definition: enums.cc:398
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: node.h:67
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
NodeVecType Nodes
Definition: dataman.h:743
DofOwner DummyDofOwner
Definition: dataman.h:815
unsigned int iTotNodes
Definition: dataman.h:748
#define DEBUGCERR(msg)
Definition: myassert.h:235
Definition: dataman4.cc:96
NodeContainerType NodeContainer
Definition: dataman.h:731
int ReadScalarDifferentialNode(MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX, doublereal &dXP) const
Definition: dataman3.cc:1539
int ReadScalarAlgebraicNode(MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX) const
Definition: dataman3.cc:1510
doublereal dReadScale(MBDynParser &HP, enum DofOwner::Type t) const
Definition: dataman3.cc:1491
void SetScale(const doublereal &d)
Definition: dofown.cc:44
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
int GetDescription(void)
Definition: parser.cc:730
struct DataManager::NodeDataStructure NodeData[Node::LASTNODETYPE]
Type
Definition: node.h:71
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
Definition: parser.cc:1228
#define ASSERT(expression)
Definition: colamd.c:977
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
static int iNumTypes[Elem::LASTELEMTYPE]
Definition: dataman4.cc:91
const char * psNodeNames[]
Definition: enums.cc:372
Definition: j2p.h:40
virtual bool IsArg(void)
Definition: parser.cc:807
ScalarDof ReadScalarDof(const DataManager *pDM, MBDynParser &HP, bool bDof, bool bOrder)
Definition: dataman3.cc:2423
virtual int GetWord(void)
Definition: parser.cc:1083
Node * ReadStructNode(DataManager *pDM, MBDynParser &HP, DofOwner *pDO, unsigned int uLabel)
Definition: strnode.cc:3978
Node ** InsertNode(NodeDataStructure &nodedata, unsigned int uLabel, Node *pN)
Definition: dataman.h:735
DriveHandler DrvHdl
Definition: dataman.h:104
virtual void SetOutputFlag(flag f=flag(1))
Definition: output.cc:896
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * pFindNode(Node::Type Typ, unsigned int uNode) const
Definition: nodeman.cc:179
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

Elem ** DataManager::ReadOneElem ( MBDynParser HP,
unsigned int  uLabel,
const std::string &  sName,
int  CurrType 
)
protected

Definition at line 1255 of file dataman4.cc.

References AbsRefFrame, DofOwner::AERODYNAMIC, Elem::AERODYNAMIC, AERODYNAMICBEAM, AERODYNAMICBEAM2, AERODYNAMICBEAM3, AERODYNAMICBODY, AERODYNAMICEXTERNAL, AERODYNAMICEXTERNALMODAL, DofOwner::AEROMODAL, AEROMODAL, Elem::AEROMODAL, AIRCRAFTINSTRUMENTS, ASSERTMSG, Elem::BEAM, BEAM, BEAM2, BEAM3, BODY, Elem::BODY, Elem::BULK, BULK, COUPLE, DEBUGCERR, DofData, DofOwner::ELECTRIC, Elem::ELECTRIC, ELECTRIC, DataManager::ElemDataStructure::ElemContainer, ElemData, Elem::EXTERNAL, Eye3, Elem::FORCE, FORCE, fReadOutput(), DofOwner::GENEL, Elem::GENEL, GENEL, GENERICAERODYNAMICFORCE, HighParser::GetInt(), WithLabel::GetLabel(), IncludeParser::GetLineData(), MBDynParser::GetPosAbs(), MBDynParser::GetRotAbs(), HBEAM, DofOwner::HYDRAULIC, Elem::HYDRAULIC, HYDRAULIC, DataManager::ElemDataStructure::iExpectedNum, DofOwner::INDUCEDVELOCITY, Elem::INDUCEDVELOCITY, INDUCEDVELOCITY, Elem::INERTIA, INERTIA, InsertElem(), HighParser::IsArg(), HighParser::IsKeyWord(), DofOwner::JOINT, JOINT, Elem::JOINT, JOINT_REGULARIZATION, Elem::JOINT_REGULARIZATION, DofOwner::LOADABLE, Elem::LOADABLE, LOADABLE, OutputHandler::Log(), MBDYN_EXCEPT_ARGS, MEMBRANE4EAS, StreamContent::MOTION, OutHdl, Inertia::OUTPUT_ALWAYS, OUTPUT_ELEMENT, Inertia::OUTPUT_LOG, Inertia::OUTPUT_OUT, ParseUserDefinedElem(), pFindElem(), DofOwner::PLATE, Elem::PLATE, psElemNames, R, ReadAerodynamicBeam(), ReadAerodynamicBeam2(), ReadAerodynamicBody(), ReadAerodynamicModal(), ReadAircraftInstruments(), ReadBeam(), ReadBeam2(), ReadBody(), ReadBulk(), ReadElectric(), ReadForce(), ReadGenel(), ReadGenericAerodynamicForce(), ReadHBeam(), ReadHydraulicElem(), ReadJoint(), ReadJointRegularization(), ReadLoadable(), ReadMembrane4EAS(), ReadOutputElem(), ReadRotor(), ReadShell4EAS(), ReadShell4EASANS(), ReadThermal(), ROTOR, RTAI_OUTPUT, SAFEDELETE, SAFENEWWITHCONSTRUCTOR, SHELL4EAS, SHELL4EASANS, StreamOutElem::SOCKETSTREAM, SOCKETSTREAM_MOTION_OUTPUT, Elem::SOCKETSTREAM_OUTPUT, SOCKETSTREAM_OUTPUT, DofOwner::THERMAL, Elem::THERMAL, THERMAL, Mat3x3::Transpose(), StreamOutElem::UNDEFINED, StreamContent::UNKNOWN, Elem::UNKNOWN, USER_DEFINED, StreamContent::VALUES, and Zero3.

Referenced by ReadElems().

1256 {
1257  Elem* pE = 0;
1258  Elem** ppE = 0;
1259 
1260  switch (KeyWords(CurrType)) {
1261  /* forza */
1262  case FORCE:
1263  case COUPLE:
1264  {
1265  bool bCouple(false);
1266  if (KeyWords(CurrType) == FORCE) {
1267  silent_cout("Reading Force(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1268 
1269  } else /* if(KeyWords(CurrType) == COUPLE) */ {
1270  bCouple = true;
1271  silent_cout("Reading Couple(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1272  }
1273 
1274  if (iNumTypes[Elem::FORCE]-- <= 0) {
1275  DEBUGCERR("");
1276  silent_cerr("line " << HP.GetLineData()
1277  << ": Force(" << uLabel << ") "
1278  << "exceeds force elements number" << std::endl);
1279 
1281  }
1282 
1283  /* verifica che non sia gia' definito */
1284  if (pFindElem(Elem::FORCE, uLabel) != NULL) {
1285  DEBUGCERR("");
1286  silent_cerr("line " << HP.GetLineData()
1287  << ": Force(" << uLabel << ") "
1288  "already defined" << std::endl);
1289 
1291  }
1292 
1293  /* allocazione e creazione */
1294  pE = ReadForce(this, HP, uLabel, bCouple);
1295  if (pE != 0) {
1296  ppE = InsertElem(ElemData[Elem::FORCE], uLabel, pE);
1297  }
1298 
1299  break;
1300  }
1301 
1302  case BODY: {
1303  silent_cout("Reading Body(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1304 
1305  if (iNumTypes[Elem::BODY]-- <= 0) {
1306  DEBUGCERR("");
1307  silent_cerr("line " << HP.GetLineData()
1308  << ": Body(" << uLabel << ") "
1309  "exceeds rigid body elements number" << std::endl);
1310 
1312  }
1313 
1314  /* verifica che non sia gia' definito */
1315  if (pFindElem(Elem::BODY, uLabel) != NULL) {
1316  DEBUGCERR("");
1317  silent_cerr("line " << HP.GetLineData()
1318  << ": Body(" << uLabel << ") "
1319  "already defined" << std::endl);
1320 
1322  }
1323 
1324  /* allocazione e creazione */
1325  pE = ReadBody(this, HP, uLabel);
1326  if (pE != 0) {
1327  ppE = InsertElem(ElemData[Elem::BODY], uLabel, pE);
1328  }
1329 
1330  break;
1331  }
1332 
1333  /* vincoli */
1334  case JOINT: {
1335  silent_cout("Reading Joint(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1336 
1337  if (iNumTypes[Elem::JOINT]-- <= 0) {
1338  DEBUGCERR("");
1339  silent_cerr("line " << HP.GetLineData()
1340  << ": Joint(" << uLabel << ") "
1341  "exceeds joint elements number" << std::endl);
1342 
1344  }
1345 
1346  /* verifica che non sia gia' definito */
1347  if (pFindElem(Elem::JOINT, uLabel) != NULL) {
1348  DEBUGCERR("");
1349  silent_cerr("line " << HP.GetLineData()
1350  << ": Joint(" << uLabel << ") "
1351  "already defined" << std::endl);
1352 
1354  }
1355 
1356  /* allocazione e creazione */
1358  - iNumTypes[Elem::JOINT] - 1;
1359  DofOwner* pDO = DofData[DofOwner::JOINT].pFirstDofOwner + i;
1360 
1361  pE = ReadJoint(this, HP, pDO, uLabel);
1362  if (pE != 0) {
1363  ppE = InsertElem(ElemData[Elem::JOINT], uLabel, pE);
1364  }
1365 
1366  /* attenzione: i Joint aggiungono DofOwner e quindi devono
1367  * completare la relativa struttura */
1368  break;
1369  }
1370 
1371  /* regolarizzazione vincoli */
1372  case JOINT_REGULARIZATION: {
1373  silent_cout("Reading JointRegularization(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1374 
1375  if (iNumTypes[Elem::JOINT_REGULARIZATION]-- <= 0) {
1376  DEBUGCERR("");
1377  silent_cerr("line " << HP.GetLineData()
1379  << "(" << uLabel << ")"
1380  " exceeds " << psElemNames[Elem::JOINT_REGULARIZATION]
1381  << " elements number" << std::endl);
1382 
1384  }
1385 
1386  /* verifica che non sia gia' definito */
1387  if (pFindElem(Elem::JOINT_REGULARIZATION, uLabel) != NULL) {
1388  DEBUGCERR("");
1389  silent_cerr("line " << HP.GetLineData()
1391  << "(" << uLabel << ")"
1392  << " already defined" << std::endl);
1393 
1395  }
1396 
1397  /* allocazione e creazione */
1398  pE = ReadJointRegularization(this, HP, uLabel);
1399  if (pE != 0) {
1400  ppE = InsertElem(ElemData[Elem::JOINT_REGULARIZATION], uLabel, pE);
1401  }
1402 
1403  /* attenzione: i Joint aggiungono DofOwner e quindi devono
1404  * completare la relativa struttura */
1405  break;
1406  }
1407 
1408  /* trave */
1409  case BEAM:
1410  case BEAM3: /* same as BEAM */
1411  case BEAM2:
1412  case HBEAM: {
1413  silent_cout("Reading Beam(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1414 
1415  if (iNumTypes[Elem::BEAM]-- <= 0) {
1416  DEBUGCERR("");
1417  silent_cerr("line " << HP.GetLineData() << ": "
1418  "Beam(" << uLabel << ") "
1419  "exceeds beam elements number" << std::endl);
1420 
1422  }
1423 
1424  /* verifica che non sia gia' definito */
1425  if (pFindElem(Elem::BEAM, uLabel) != NULL) {
1426  DEBUGCERR("");
1427  silent_cerr("line " << HP.GetLineData() << ": "
1428  "Beam(" << uLabel << ") "
1429  "already defined" << std::endl);
1430 
1432  }
1433 
1434  /* allocazione e creazione */
1435  switch (KeyWords(CurrType)) {
1436  case BEAM3:
1437  case BEAM: /* same as BEAM3 */
1438  pE = ReadBeam(this, HP, uLabel);
1439  break;
1440 
1441  case BEAM2:
1442  pE = ReadBeam2(this, HP, uLabel);
1443  break;
1444 
1445  case HBEAM:
1446  pE = ReadHBeam(this, HP, uLabel);
1447  break;
1448 
1449  default:
1451  }
1452 
1453  if (pE != 0) {
1454  ppE = InsertElem(ElemData[Elem::BEAM], uLabel, pE);
1455  }
1456 
1457  break;
1458  }
1459 
1460  /* shell */
1461  case MEMBRANE4EAS:
1462  case SHELL4EAS:
1463  case SHELL4EASANS: {
1464  const char *sType;
1465  switch (KeyWords(CurrType)) {
1466  case MEMBRANE4EAS:
1467  sType = "Membrane";
1468  break;
1469 
1470  case SHELL4EAS:
1471  case SHELL4EASANS:
1472  sType = "Shell";
1473  break;
1474 
1475  default:
1477  }
1478 
1479  silent_cout("Reading " << sType << "(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1480 
1481  if (iNumTypes[Elem::PLATE]-- <= 0) {
1482  DEBUGCERR("");
1483  silent_cerr("line " << HP.GetLineData() << ": "
1484  << sType << "(" << uLabel << ") "
1485  "exceeds plate elements number" << std::endl);
1486 
1488  }
1489 
1490  /* verifica che non sia gia' definito */
1491  if (pFindElem(Elem::PLATE, uLabel) != NULL) {
1492  DEBUGCERR("");
1493  silent_cerr("line " << HP.GetLineData() << ": "
1494  << sType << "(" << uLabel << ") "
1495  "already defined" << std::endl);
1496 
1498  }
1499 
1500  /* allocazione e creazione */
1502  - iNumTypes[Elem::PLATE] - 1;
1503  DofOwner* pDO = DofData[DofOwner::PLATE].pFirstDofOwner + i;
1504 
1505  /* allocazione e creazione */
1506  switch (KeyWords(CurrType)) {
1507  case MEMBRANE4EAS:
1508  pE = ReadMembrane4EAS(this, HP, pDO, uLabel);
1509  break;
1510 
1511  case SHELL4EAS:
1512  pE = ReadShell4EAS(this, HP, pDO, uLabel);
1513  break;
1514 
1515  case SHELL4EASANS:
1516  pE = ReadShell4EASANS(this, HP, pDO, uLabel);
1517  break;
1518 
1519  default:
1521  }
1522 
1523  if (pE != 0) {
1524  ppE = InsertElem(ElemData[Elem::PLATE], uLabel, pE);
1525  }
1526 
1527  break;
1528  }
1529 
1530  /* Elementi aerodinamici: rotori */
1531  case ROTOR:
1532  case INDUCEDVELOCITY: {
1533  silent_cout("Reading InducedVelocity(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1534 
1535  switch (KeyWords(CurrType)) {
1536  case ROTOR:
1537  silent_cerr("InducedVelocity(" << uLabel << "): deprecated \"rotor\", use \"induced velocity\" of type \"rotor\" instead at line " << HP.GetLineData() << std::endl);
1538  break;
1539 
1540  case INDUCEDVELOCITY:
1541  if (HP.IsKeyWord("rotor")) {
1542  // continue
1543  } else {
1544  silent_cerr("InducedVelocity(" << uLabel << "): unknown \"induced velocity\" type at line " << HP.GetLineData() << " (missing \"rotor\" keyword?)" << std::endl);
1546  }
1547  break;
1548 
1549  default:
1551  }
1552 
1553  if (iNumTypes[Elem::INDUCEDVELOCITY]-- <= 0) {
1554  DEBUGCERR("");
1555  silent_cerr("InducedVelocity(" << uLabel << "): "
1556  "exceeds induced velocity elements number "
1557  "at line " << HP.GetLineData() << std::endl);
1558 
1560  }
1561 
1562  /* verifica che non sia gia' definito */
1563  if (pFindElem(Elem::INDUCEDVELOCITY, uLabel) != NULL) {
1564  DEBUGCERR("");
1565  silent_cerr("InducedVelocity(" << uLabel << ") "
1566  "already defined at line "
1567  << HP.GetLineData() << std::endl);
1568 
1570  }
1571 
1572  /* allocazione e creazione */
1575  DofOwner* pDO = DofData[DofOwner::INDUCEDVELOCITY].pFirstDofOwner + i;
1576 
1577  pE = ReadRotor(this, HP, pDO, uLabel);
1578  if (pE != 0) {
1579  ppE = InsertElem(ElemData[Elem::INDUCEDVELOCITY], uLabel, pE);
1580  }
1581 
1582  break;
1583  }
1584 
1585  /* Elementi aerodinamici: modale */
1586  case AEROMODAL: {
1587  silent_cout("Reading AeroModal(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1588 
1589  if (iNumTypes[Elem::AEROMODAL]-- <= 0) {
1590  DEBUGCERR("");
1591  silent_cerr("line " << HP.GetLineData() << ": "
1592  "AeroModal(" << uLabel << ") "
1593  "exceeds aeromodal elements number" << std::endl);
1594 
1596  }
1597 
1598  /* verifica che non sia gia' definito */
1599  if (pFindElem(Elem::AEROMODAL, uLabel) != NULL) {
1600  DEBUGCERR("");
1601  silent_cerr("line " << HP.GetLineData() << ": "
1602  "AeroModal(" << uLabel << ") "
1603  "already defined" << std::endl);
1604 
1606  }
1607 
1608  /* allocazione e creazione */
1610  - iNumTypes[Elem::AEROMODAL] - 1;
1611  DofOwner* pDO = DofData[DofOwner::AEROMODAL].pFirstDofOwner + i;
1612 
1613  pE = ReadAerodynamicModal(this, HP, pDO, uLabel);
1614  if (pE != 0) {
1615  ppE = InsertElem(ElemData[Elem::AEROMODAL], uLabel, pE);
1616  }
1617 
1618  break;
1619  }
1620 
1621  /* Elementi aerodinamici: aeromodal */
1622  case AERODYNAMICEXTERNAL:
1623  case AERODYNAMICEXTERNALMODAL: {
1624 #ifdef USE_EXTERNAL
1625  silent_cout("Reading External(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1626 
1627  if (iNumTypes[Elem::EXTERNAL]-- <= 0) {
1628  DEBUGCERR("");
1629  silent_cerr("line " << HP.GetLineData() << ": "
1630  "External(" << uLabel << ") "
1631  "exceeds external elements number" << std::endl);
1632 
1634  }
1635 
1636  /* verifica che non sia gia' definito */
1637  if (pFindElem(Elem::EXTERNAL, uLabel) != NULL) {
1638  DEBUGCERR("");
1639  silent_cerr("line " << HP.GetLineData() << ": "
1640  "External(" << uLabel << ") "
1641  "already defined" << std::endl);
1642 
1644  }
1645 
1646  /* allocazione e creazione */
1647  switch (KeyWords(CurrType)) {
1648  case AERODYNAMICEXTERNAL:
1649  pE = ReadAerodynamicExternal(this, HP, uLabel);
1650  break;
1651 
1653  pE = ReadAerodynamicExternalModal(this, HP, uLabel);
1654  break;
1655 
1656  default:
1657  ASSERTMSG(0, "You shouldn't have reached this point");
1658  break;
1659  }
1660  if (pE != 0) {
1661  ppE = InsertElem(ElemData[Elem::EXTERNAL], uLabel, pE);
1662  }
1663 #else /* !USE_EXTERNAL */
1664  silent_cerr("You need mpi and -DUSE_AERODYNAMIC_EXTERNAL "
1665  << "to use this type of elements." << std::endl);
1667 #endif /* !USE_EXTERNAL */
1668  break;
1669  }
1670 
1671  case AERODYNAMICBODY:
1672  case AERODYNAMICBEAM:
1673  case AERODYNAMICBEAM3: /* same as AERODYNAMICBEAM */
1674  case AERODYNAMICBEAM2:
1675  case AIRCRAFTINSTRUMENTS:
1676  case GENERICAERODYNAMICFORCE: {
1677  silent_cout("Reading AerodynamicElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1678 
1679  if (iNumTypes[Elem::AERODYNAMIC]-- <= 0) {
1680  DEBUGCERR("");
1681  silent_cerr("line " << HP.GetLineData() << ": "
1682  "AerodynamicElement(" << uLabel << ") "
1683  "exceeds aerodynamic elements number" << std::endl);
1684 
1686  }
1687 
1688  /* verifica che non sia gia' definito */
1689  if (pFindElem(Elem::AERODYNAMIC, uLabel) != NULL) {
1690  DEBUGCERR("");
1691  silent_cerr("line " << HP.GetLineData() << ": "
1692  "AerodynamicElement(" << uLabel << ") "
1693  "already defined" << std::endl);
1694 
1696  }
1697 
1698  /* allocazione e creazione */
1701  DofOwner* pDO = DofData[DofOwner::AERODYNAMIC].pFirstDofOwner + i;
1702 
1703  /* allocazione e creazione */
1704  switch (KeyWords(CurrType)) {
1705  case AERODYNAMICBODY:
1706  pE = ReadAerodynamicBody(this, HP, pDO, uLabel);
1707  break;
1708 
1709  case AERODYNAMICBEAM3:
1710  case AERODYNAMICBEAM: /* same as BEAM3 */
1711  pE = ReadAerodynamicBeam(this, HP, pDO, uLabel);
1712  break;
1713 
1714  case AERODYNAMICBEAM2:
1715  pE = ReadAerodynamicBeam2(this, HP, pDO, uLabel);
1716  break;
1717 
1718  case AIRCRAFTINSTRUMENTS:
1719  pE = ReadAircraftInstruments(this, HP, pDO, uLabel);
1720  break;
1721 
1723  pE = ReadGenericAerodynamicForce(this, HP, pDO, uLabel);
1724  break;
1725 
1726  default:
1727  ASSERTMSG(0, "You shouldn't have reached this point");
1728  break;
1729  }
1730  if (pE != 0) {
1731  ppE = InsertElem(ElemData[Elem::AERODYNAMIC], uLabel, pE);
1732  }
1733 
1734  break;
1735  }
1736 
1737  /* genel */
1738  case GENEL: {
1739  silent_cout("Reading Genel(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1740 
1741  if (iNumTypes[Elem::GENEL]-- <= 0) {
1742  DEBUGCERR("");
1743  silent_cerr("line " << HP.GetLineData() << ": "
1744  "Genel(" << uLabel << ") "
1745  "exceeds genel elements number" << std::endl);
1746 
1748  }
1749 
1750  /* verifica che non sia gia' definito */
1751  if (pFindElem(Elem::GENEL, uLabel) != NULL) {
1752  DEBUGCERR("");
1753  silent_cerr("line " << HP.GetLineData() << ": "
1754  "Genel(" << uLabel << ") "
1755  "already defined" << std::endl);
1756 
1758  }
1759 
1760  /* allocazione e creazione */
1762  - iNumTypes[Elem::GENEL] - 1;
1763  DofOwner* pDO = DofData[DofOwner::GENEL].pFirstDofOwner + i;
1764 
1765  pE = ReadGenel(this, HP, pDO, uLabel);
1766  if (pE != 0) {
1767  ppE = InsertElem(ElemData[Elem::GENEL], uLabel, pE);
1768  }
1769 
1770  break;
1771  }
1772 
1773  /* elementi idraulici */
1774  case HYDRAULIC: {
1775  silent_cout("Reading HydraulicElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1776 
1777  if (iNumTypes[Elem::HYDRAULIC]-- <= 0) {
1778  DEBUGCERR("");
1779  silent_cerr("line " << HP.GetLineData() << ": "
1780  "HydraulicElement(" << uLabel << ") "
1781  "exceeds hydraulic elements number" << std::endl);
1782 
1784  }
1785 
1786  /* verifica che non sia gia' definito */
1787  if (pFindElem(Elem::HYDRAULIC, uLabel) != NULL) {
1788  DEBUGCERR("");
1789  silent_cerr("line " << HP.GetLineData() << ": "
1790  "HydraulicElement(" << uLabel << ") "
1791  "already defined" << std::endl);
1792 
1794  }
1795 
1796  /* allocazione e creazione */
1798  - iNumTypes[Elem::HYDRAULIC] - 1;
1799  DofOwner* pDO = DofData[DofOwner::HYDRAULIC].pFirstDofOwner + i;
1800 
1801  pE = ReadHydraulicElem(this, HP, pDO, uLabel);
1802  if (pE != 0) {
1803  ppE = InsertElem(ElemData[Elem::HYDRAULIC], uLabel, pE);
1804  }
1805 
1806  /* attenzione: gli elementi elettrici aggiungono DofOwner
1807  * e quindi devono completare la relativa struttura */
1808 
1809  break;
1810  }
1811 
1812  /* elementi elettrici */
1813  case ELECTRIC: {
1814  silent_cout("Reading ElectricElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1815 
1816  if (iNumTypes[Elem::ELECTRIC]-- <= 0) {
1817  DEBUGCERR("");
1818  silent_cerr("line " << HP.GetLineData() << ": "
1819  "ElectricElement(" << uLabel << ") "
1820  "exceeds electric elements number" << std::endl);
1821 
1823  }
1824 
1825  /* verifica che non sia gia' definito */
1826  if (pFindElem(Elem::ELECTRIC, uLabel) != NULL) {
1827  DEBUGCERR("");
1828  silent_cerr("line " << HP.GetLineData() << ": "
1829  "ElectricElement(" << uLabel << ") "
1830  "already defined" << std::endl);
1831 
1833  }
1834 
1835  /* allocazione e creazione */
1837  - iNumTypes[Elem::ELECTRIC] - 1;
1838  DofOwner* pDO = DofData[DofOwner::ELECTRIC].pFirstDofOwner + i;
1839 
1840  pE = ReadElectric(this, HP, pDO, uLabel);
1841  if (pE != 0) {
1842  ppE = InsertElem(ElemData[Elem::ELECTRIC], uLabel, pE);
1843  }
1844 
1845  /* attenzione: gli elementi elettrici aggiungono DofOwner
1846  * e quindi devono completare la relativa struttura */
1847 
1848  break;
1849  }
1850 
1851  /* elementi termici */
1852  case THERMAL: {
1853  silent_cout("Reading ThermalElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1854 
1855  if (iNumTypes[Elem::THERMAL]-- <= 0) {
1856  DEBUGCERR("");
1857  silent_cerr("line " << HP.GetLineData() << ": "
1858  "ThermalElement(" << uLabel << ") "
1859  "exceeds thermal elements number" << std::endl);
1860 
1862  }
1863 
1864  /* verifica che non sia gia' definito */
1865  if (pFindElem(Elem::THERMAL, uLabel) != NULL) {
1866  DEBUGCERR("");
1867  silent_cerr("line " << HP.GetLineData() << ": "
1868  "ThermalElement(" << uLabel << ") "
1869  "already defined" << std::endl);
1870 
1872  }
1873 
1874  /* allocazione e creazione */
1876  - iNumTypes[Elem::THERMAL] - 1;
1877  DofOwner* pDO = DofData[DofOwner::THERMAL].pFirstDofOwner + i;
1878 
1879  pE = ReadThermal(this, HP, pDO, uLabel);
1880  if (pE != 0) {
1881  ppE = InsertElem(ElemData[Elem::THERMAL], uLabel, pE);
1882  }
1883 
1884  /* attenzione: gli elementi termici aggiungono DofOwner
1885  * e quindi devono completare la relativa struttura */
1886 
1887  break;
1888  }
1889 
1890  /* elementi bulk */
1891  case BULK: {
1892  silent_cout("Reading BulkElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1893 
1894  if (iNumTypes[Elem::BULK]-- <= 0) {
1895  DEBUGCERR("");
1896  silent_cerr("line " << HP.GetLineData() << ": "
1897  "BulkElement(" << uLabel << ") "
1898  "exceeds bulk elements number" << std::endl);
1899 
1901  }
1902 
1903  /* verifica che non sia gia' definito */
1904  if (pFindElem(Elem::BULK, uLabel) != NULL) {
1905  DEBUGCERR("");
1906  silent_cerr("line " << HP.GetLineData() << ": "
1907  "BulkElement(" << uLabel << ") "
1908  "already defined" << std::endl);
1909 
1911  }
1912 
1913  /* allocazione e creazione */
1914  pE = ReadBulk(this, HP, uLabel);
1915  if (pE != 0) {
1916  ppE = InsertElem(ElemData[Elem::BULK], uLabel, pE);
1917  }
1918 
1919  break;
1920  }
1921 
1922  /* elementi loadable */
1923  case USER_DEFINED:
1924  case LOADABLE: {
1925  silent_cout("Reading LoadableElement(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1926 
1927  if (iNumTypes[Elem::LOADABLE]-- <= 0) {
1928  DEBUGCERR("");
1929  silent_cerr("line " << HP.GetLineData() << ": "
1930  "LoadableElement(" << uLabel << ") "
1931  "exceeds loadable elements number" << std::endl);
1932 
1934  }
1935 
1936  /* verifica che non sia gia' definito */
1937  if (pFindElem(Elem::LOADABLE, uLabel) != NULL) {
1938  DEBUGCERR("");
1939  silent_cerr("line " << HP.GetLineData() << ": "
1940  "LoadableElement(" << uLabel << ") "
1941  "already defined" << std::endl);
1942 
1944  }
1945 
1946  /* allocazione e creazione */
1948  - iNumTypes[Elem::LOADABLE] - 1;
1949  DofOwner* pDO = DofData[DofOwner::LOADABLE].pFirstDofOwner + i;
1950 
1951  if (KeyWords(CurrType) == USER_DEFINED) {
1952  pE = ParseUserDefinedElem(uLabel, pDO, this, HP);
1953  } else {
1954  pE = ReadLoadable(this, HP, pDO, uLabel);
1955  }
1956 
1957  if (pE != 0) {
1958  ppE = InsertElem(ElemData[Elem::LOADABLE], uLabel, pE);
1959  }
1960 
1961  break;
1962  }
1963 
1964  case RTAI_OUTPUT: // deprecated
1965 #ifndef USE_RTAI
1966  silent_cout("need --with-rtai to allow RTMBDyn mailboxes; "
1967  "using stream output instead..." << std::endl);
1968 #endif /* ! USE_RTAI */
1969  /* fall thru... */
1970 
1971  case OUTPUT_ELEMENT:
1972  case SOCKETSTREAM_OUTPUT: // deprecated
1973  case SOCKETSTREAM_MOTION_OUTPUT: // deprecated
1974  {
1975  silent_cout("Reading StreamOutElem(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
1976 
1977  if (iNumTypes[Elem::SOCKETSTREAM_OUTPUT]-- <= 0) {
1978  DEBUGCERR("");
1979  silent_cerr("line " << HP.GetLineData() << ": "
1980  "StreamOutElem(" << uLabel << ") "
1981  "exceeds stream output elements number" << std::endl);
1982 
1984  }
1985 
1986  /* verifica che non sia gia' definito */
1987  if (pFindElem(Elem::SOCKETSTREAM_OUTPUT, uLabel) != NULL) {
1988  DEBUGCERR("");
1989  silent_cerr("line " << HP.GetLineData() << ": "
1990  "StreamOutElem(" << uLabel << ") "
1991  "already defined" << std::endl);
1992 
1994  }
1995 
1996  /* allocazione e creazione */
1997  StreamOutElem::Type eType;
1998  StreamContent::Type sType;
1999  switch (KeyWords(CurrType)) {
2000  case RTAI_OUTPUT:
2001  case SOCKETSTREAM_OUTPUT:
2002  pedantic_cerr("SocketStreamElem(" << uLabel << "): "
2003  "deprecated in favour of 'output element: <label>, socket stream, ...' "
2004  "at line " << HP.GetLineData() << std::endl);
2006  sType = StreamContent::VALUES;
2007  break;
2008 
2010  pedantic_cerr("SocketStreamMotionElem(" << uLabel << "): "
2011  "deprecated in favour of 'output element: <label>, socket stream, motion, ...' "
2012  "at line " << HP.GetLineData() << std::endl);
2014  sType = StreamContent::MOTION;
2015  break;
2016 
2017  default:
2018  eType = StreamOutElem::UNDEFINED;
2019  sType = StreamContent::UNKNOWN;
2020  break;
2021  }
2022 
2023  pE = ReadOutputElem(this, HP, uLabel, eType, sType);
2024 
2025  if (pE != 0) {
2026  ppE = InsertElem(ElemData[Elem::SOCKETSTREAM_OUTPUT], uLabel, pE);
2027  }
2028  break;
2029  }
2030 
2031  case INERTIA: {
2032  silent_cout("Reading Inertia(" << uLabel << ( sName.empty() ? "" : ( std::string(", \"") + sName + "\"" ) ) << ")" << std::endl);
2033 
2034  Vec3 x(Zero3);
2035  if (HP.IsKeyWord("position")) {
2036  x = HP.GetPosAbs(::AbsRefFrame);
2037  }
2038 
2039  Mat3x3 R(Eye3);
2040  Mat3x3 RT(Eye3);
2041  if (HP.IsKeyWord("orientation")) {
2042  R = HP.GetRotAbs(::AbsRefFrame);
2043  RT = R.Transpose();
2044  }
2045 
2046  std::set<const ElemGravityOwner *> elements;
2047  Elem::Type Type = Elem::UNKNOWN;
2048  bool bOut(false);
2049  bool bLog(true);
2050  bool bAlways(false);
2051  while (HP.IsArg()) {
2052  if (HP.IsKeyWord("output")) {
2053  do {
2054  if (HP.IsKeyWord("no")) {
2055  bLog = false;
2056  bOut = false;
2057 
2058  } else if (HP.IsKeyWord("yes")) {
2059  bLog = false;
2060  bOut = true;
2061 
2062  } else if (HP.IsKeyWord("log")) {
2063  bLog = true;
2064  bOut = false;
2065 
2066  } else if (HP.IsKeyWord("both")) {
2067  bLog = true;
2068  bOut = true;
2069 
2070  } else if (HP.IsKeyWord("always")) {
2071  bAlways = true;
2072 
2073  } else {
2074  silent_cerr("Inertia(" << uLabel << "): "
2075  "unknown output mode "
2076  "at line " << HP.GetLineData()
2077  << std::endl);
2079  }
2080 
2081  } while(HP.IsKeyWord("output"));
2082 
2083  break;
2084 
2085  } else if (HP.IsKeyWord("body")) {
2086  Type = Elem::BODY;
2087 
2088  } else if (HP.IsKeyWord("joint")) {
2089  Type = Elem::JOINT;
2090 
2091  } else if (HP.IsKeyWord("user" "defined") || HP.IsKeyWord("loadable")) {
2092  Type = Elem::LOADABLE;
2093 
2094 #if 0
2095  } else if (HP.IsKeyWord("...")) {
2096  /* other types with inertia */
2097 #endif
2098  }
2099 
2100  if (Type == Elem::UNKNOWN) {
2101  if (!sName.empty()) {
2102  silent_cerr("Inertia(" << uLabel << ", \"" << sName << "\"): ");
2103  } else {
2104  silent_cerr("Inertia(" << uLabel << "): ");
2105  }
2106  silent_cerr("unknown or undefined element type "
2107  "at line " << HP.GetLineData() << std::endl);
2109  }
2110 
2111  /*
2112  * FIXME: duplicate check?
2113  */
2114 
2115  if (HP.IsKeyWord("all")) {
2116  for (ElemContainerType::const_iterator i = ElemData[Type].ElemContainer.begin();
2117  i != ElemData[Type].ElemContainer.end(); ++i)
2118  {
2119  ElemGravityOwner *pEl = dynamic_cast<ElemGravityOwner *>(i->second);
2120  if (pEl == 0) {
2121  silent_cerr(psElemNames[Type]
2122  << "(" << i->second->GetLabel() << "): "
2123  "not a gravity related element "
2124  "at line " << HP.GetLineData()
2125  << std::endl);
2127  }
2128 
2129  if (elements.find(pEl) != elements.end()) {
2130  silent_cerr(psElemNames[Type]
2131  << "(" << pEl->GetLabel() << "): "
2132  " duplicate label at line "
2133  << HP.GetLineData() << std::endl);
2135  }
2136  elements.insert(pEl);
2137  }
2138 
2139  } else {
2140  unsigned int uL = (unsigned int)HP.GetInt();
2141  Elem *pTmpEl = pFindElem(Type, uL);
2142  if (pTmpEl == 0) {
2143  silent_cerr("Inertia(" << uLabel << "): "
2144  "unable to find " << psElemNames[Type]
2145  << "(" << uL << ") "
2146  "at line " << HP.GetLineData() << std::endl);
2148  }
2149 
2150  ElemGravityOwner *pEl = dynamic_cast<ElemGravityOwner *>(pTmpEl);
2151  if (pEl == 0) {
2152  silent_cerr("Inertia(" << uLabel << "): "
2153  << psElemNames[Type]
2154  << "(" << uL << "): "
2155  "not a gravity related element "
2156  "at line " << HP.GetLineData()
2157  << std::endl);
2159  }
2160 
2161  if (elements.find(pEl) != elements.end()) {
2162  silent_cerr("Inertia(" << uLabel << "): "
2163  << psElemNames[Type] << "(" << uL << ") "
2164  "is duplicate at line " << HP.GetLineData()
2165  << std::endl);
2167  }
2168 
2169  elements.insert(pEl);
2170  }
2171  } /* end while (HP.IsArg()) */
2172 
2173  flag fOut = fReadOutput(HP, Elem::BODY);
2174  if (bLog) {
2175  fOut |= Inertia::OUTPUT_LOG; // was 0x2
2176  }
2177  if (bOut) {
2178  fOut |= Inertia::OUTPUT_OUT; // was 0x4
2179  }
2180  if (bAlways) {
2181  if (iNumTypes[Elem::INERTIA]-- <= 0) {
2182  DEBUGCERR("");
2183  silent_cerr("line " << HP.GetLineData() << ": "
2184  "Inertia(" << uLabel << ") "
2185  "exceeds inertia elements number" << std::endl);
2186 
2188  }
2189 
2190  /* verifica che non sia gia' definito */
2191  if (pFindElem(Elem::INERTIA, uLabel) != NULL) {
2192  DEBUGCERR("");
2193  silent_cerr("line " << HP.GetLineData() << ": "
2194  "Inertia(" << uLabel << ") "
2195  "already defined" << std::endl);
2196 
2198  }
2199 
2200  fOut |= Inertia::OUTPUT_ALWAYS; // was 0x8
2201  }
2202 
2203 
2205  Inertia(uLabel, sName, elements, x, R, OutHdl.Log(), fOut));
2206  if (pE != 0) {
2207  if (bAlways) {
2208  ppE = InsertElem(ElemData[Elem::INERTIA], uLabel, pE);
2209  } else {
2210  SAFEDELETE(pE);
2211  pE = 0;
2212  }
2213  }
2214 
2215  break;
2216  }
2217 
2218  /* In case the element type is not correct */
2219  default:
2220  silent_cerr("You shouldn't be here" << std::endl);
2221 
2223  }
2224 
2225  /* Ritorna il puntatore al puntatore all'elemento appena costruito */
2226  return ppE;
2227 }
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
Elem * ReadJointRegularization(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: jointreg.cc:527
Elem * ReadAerodynamicBeam(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeroelem.cc:2268
ElemContainerType ElemContainer
Definition: dataman.h:591
const Vec3 Zero3(0., 0., 0.)
long int flag
Definition: mbdyn.h:43
Elem * ReadShell4EASANS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: shelleasans.cc:869
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Elem * ReadAerodynamicModal(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeromodal.cc:612
Definition: matvec3.h:98
Elem * ReadOutputElem(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, StreamOutElem::Type eType, StreamContent::Type sType)
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
Mat3x3 GetRotAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1857
Elem ** InsertElem(ElemDataStructure &eldata, unsigned int uLabel, Elem *pE)
Definition: dataman.h:595
OutputHandler OutHdl
Definition: dataman.h:105
Elem * ReadAircraftInstruments(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: instruments.cc:268
#define ASSERTMSG(expr, msg)
Definition: myassert.h:219
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
#define DEBUGCERR(msg)
Definition: myassert.h:235
Elem * ReadMembrane4EAS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: membraneeas.cc:594
Elem * ReadJoint(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: joint.cc:187
Elem * ReadShell4EAS(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: shelleas.cc:1272
Elem * ReadThermal(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: therm.cc:82
Elem * ReadLoadable(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: userelem.cc:87
Elem * ReadHydraulicElem(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: preselem.cc:93
Elem * ReadBody(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: body.cc:1937
Elem * ReadForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, bool bCouple)
Definition: force.cc:246
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Definition: elman.cc:650
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)
Definition: beam2.cc:1329
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
Vec3 GetPosAbs(const ReferenceFrame &rf)
Definition: mbpar.cc:1401
Elem * ReadAerodynamicBody(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeroelem.cc:1361
Elem * ReadRotor(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: rotor.cc:2573
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
Elem * ReadAerodynamicBeam2(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: aeroelem.cc:3167
static int iNumTypes[Elem::LASTELEMTYPE]
Definition: dataman4.cc:91
Elem * ReadElectric(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: elec.cc:156
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
Type
Definition: elem.h:91
const char * psElemNames[]
Definition: enums.cc:39
Elem * ReadGenel(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
Definition: genel.cc:71
Elem * ReadBulk(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: bulk.cc:39
Elem * ReadHBeam(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: hbeam.cc:1091
std::ostream & Log(void) const
Definition: output.h:541
Elem * ReadBeam(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: beam.cc:1876
Elem * ReadGenericAerodynamicForce(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
struct DataManager::@30 DofData[DofOwner::LASTDOFTYPE]
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
unsigned int GetLabel(void) const
Definition: withlab.cc:62
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
Mat3x3 R
UserDefinedElem * ParseUserDefinedElem(unsigned uLabel, DofOwner *pDO, DataManager *const pDM, MBDynParser &HP)
Definition: userelem.cc:61
#define SAFEDELETE(pnt)
Definition: mynewmem.h:710

Here is the call graph for this function:

int DataManager::ReadScalarAlgebraicNode ( MBDynParser HP,
unsigned int  uLabel,
Node::Type  type,
doublereal dX 
) const

Definition at line 1510 of file dataman3.cc.

References DEBUGLCOUT, IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::IsArg(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, pFindNode(), and psNodeNames.

Referenced by ReadNodes(), and ReadScalarDifferentialNode().

1513 {
1514  /* verifica di esistenza del nodo */
1515  if (pFindNode(type, uLabel) != NULL) {
1516  silent_cerr("line " << HP.GetLineData()
1517  << ": " << psNodeNames[type] << "(" << uLabel
1518  << ") already defined" << std::endl);
1520  }
1521 
1522  if (HP.IsArg()) {
1523  /* eat keyword "value" */
1524  if (!HP.IsKeyWord("value")) {
1525  pedantic_cerr(psNodeNames[type] << "(" << uLabel
1526  << "): initial value specified without "
1527  "\"value\" keyword (deprecated)" << std::endl);
1528  }
1529  dX = HP.GetReal();
1530  DEBUGLCOUT(MYDEBUG_INPUT, "Initial value x = " << dX
1531  << " is supplied" << std::endl);
1532  return 1;
1533  }
1534 
1535  return 0;
1536 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
const char * psNodeNames[]
Definition: enums.cc:372
virtual bool IsArg(void)
Definition: parser.cc:807
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * pFindNode(Node::Type Typ, unsigned int uNode) const
Definition: nodeman.cc:179
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

int DataManager::ReadScalarDifferentialNode ( MBDynParser HP,
unsigned int  uLabel,
Node::Type  type,
doublereal dX,
doublereal dXP 
) const

Definition at line 1539 of file dataman3.cc.

References DEBUGLCOUT, HighParser::GetReal(), HighParser::IsKeyWord(), MYDEBUG_INPUT, and ReadScalarAlgebraicNode().

Referenced by ReadNodes().

1542 {
1543  if (ReadScalarAlgebraicNode(HP, uLabel, type, dX) == 1) {
1544  if (HP.IsKeyWord("derivative")) {
1545  dXP = HP.GetReal();
1547  "Initial derivative value xp = "
1548  << dXP << " is supplied" << std::endl);
1549  return 1;
1550  }
1551  }
1552 
1553  return 0;
1554 }
int ReadScalarAlgebraicNode(MBDynParser &HP, unsigned int uLabel, Node::Type type, doublereal &dX) const
Definition: dataman3.cc:1510
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

void DataManager::SetBufInRaw ( unsigned  uL,
integer  n,
const doublereal p 
)

Definition at line 2769 of file dataman2.cc.

References BufferStreamDriveRaw::bOwnsMemory(), Drive::FILEDRIVE, MBDYN_EXCEPT_ARGS, pFindDrive(), and BufferStreamDriveRaw::SetBufRaw().

Referenced by mb_sol_setbufin().

2770 {
2771  Drive* pD = pFindDrive(Drive::FILEDRIVE, uL);
2772  if (pD == 0) {
2773  silent_cerr("unable to find FileDrive(" << uL << ")" << std::endl);
2775  }
2776 
2777  BufferStreamDriveRaw *pBSD = dynamic_cast<BufferStreamDriveRaw *>(pD);
2778  if (pBSD == 0) {
2779  silent_cerr("FileDrive(" << uL << ") is not a BufferStreamDriveRaw" << std::endl);
2781  }
2782 
2783  if (pBSD->bOwnsMemory()) {
2784  silent_cerr("FileDrive(" << uL << ") owns its memory, unable to set buffer" << std::endl);
2786  }
2787 
2788  pBSD->SetBufRaw(n, p);
2789 }
Drive * pFindDrive(Drive::Type Typ, unsigned int uL) const
Definition: elman.cc:705
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: drive.h:89
bool bOwnsMemory(void) const
void SetBufRaw(integer n, const doublereal *p)

Here is the call graph for this function:

void DataManager::SetBufOutRaw ( unsigned  uL,
integer  n,
const doublereal p 
)

Definition at line 2804 of file dataman2.cc.

References BufferStreamElemRaw::bOwnsMemory(), MBDYN_EXCEPT_ARGS, and BufferStreamElemRaw::SetBufRaw().

Referenced by mb_sol_setbufout().

2805 {
2806  BufferStreamElemRaw *pBSE = pFindElem<BufferStreamElemRaw, StreamOutElem, Elem::SOCKETSTREAM_OUTPUT>(uL);
2807  if (pBSE == 0) {
2808  silent_cerr("unable to find StreamOutElem(" << uL << "), or not a BufferStreamElemRaw" << std::endl);
2810  }
2811 
2812  if (pBSE->bOwnsMemory()) {
2813  silent_cerr("StreamOutElem(" << uL << ") owns its memory, unable to set buffer" << std::endl);
2815  }
2816 
2817  pBSE->SetBufRaw(n, p);
2818 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bOwnsMemory(void) const
virtual void SetBufRaw(integer n, const doublereal *p)

Here is the call graph for this function:

void DataManager::SetLoadableElemModule ( std::string  name,
const LoadableCalls calls,
ModuleInsertMode  mode = MIM_FAIL 
)

Definition at line 73 of file dataman2.cc.

References calls, GetLoadableElemModule(), MapOfLoadableElemHandlers, MBDYN_EXCEPT_ARGS, MIM_FAIL, MIM_IGNORE, and MIM_REPLACE.

75 {
76  for (int j = 0; name[j]; j++) {
77  name[j] = tolower(name[j]);
78  }
79 
80  const LoadableCalls *tmp = GetLoadableElemModule(name);
81 
82  if (tmp != 0) {
83  switch (mode) {
84  case MIM_FAIL:
85  default:
86  silent_cerr("DataManager::SetLoadableElemModule(): "
87  "loadable element handler \"" << name
88  << "\" already defined" << std::endl);
90 
91  case MIM_IGNORE:
92  silent_cout("DataManager::SetLoadableElemModule(): "
93  "loadable element handler \"" << name
94  << "\" already defined; "
95  "new definition ignored" << std::endl);
96  return;
97 
98  case MIM_REPLACE:
99  silent_cout("DataManager::SetLoadableElemModule(): "
100  "loadable element handler \"" << name
101  << "\" already defined; "
102  "replaced by new definition" << std::endl);
103  break;
104  }
105  }
106 
108 }
void * calls
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
std::map< std::string, const LoadableCalls * > MapOfLoadableElemHandlers
Definition: dataman.h:102
const LoadableCalls * GetLoadableElemModule(std::string) const
Definition: dataman2.cc:58

Here is the call graph for this function:

void DataManager::SetOrientationDescription ( OrientationDescription  od)

Definition at line 851 of file dataman.cc.

References od.

852 {
853  this->od = od;
854 }
OrientationDescription od
Definition: dataman.h:229
void DataManager::SetOutput ( Elem::Type  t,
unsigned  flags,
OrientationDescription  od 
)

Definition at line 864 of file dataman.cc.

References ElemData, od, DataManager::ElemDataStructure::od, and DataManager::ElemDataStructure::uOutputFlags.

865 {
866  ElemData[t].uOutputFlags = flags;
867  ElemData[t].od = od;
868 }
OrientationDescription od
Definition: dataman.h:573
OrientationDescription od
Definition: dataman.h:229
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
void DataManager::SetScale ( VectorHandler XScale) const

Definition at line 159 of file dofman.cc.

References DofOwners, iTotDofOwners, and VectorHandler::PutCoef().

Referenced by InverseSolver::Prepare(), and Solver::Prepare().

160 {
161  for (integer iCnt = 0; iCnt < iTotDofOwners; iCnt++) {
162  integer iFirstIndex = DofOwners[iCnt].iFirstIndex;
163  unsigned int iNumDofs = DofOwners[iCnt].iNumDofs;
164  doublereal dScale = DofOwners[iCnt].dScale;
165 
166  for (unsigned int iDof = 1; iDof <= iNumDofs; iDof++) {
167  XScale.PutCoef(iFirstIndex + iDof, dScale);
168  }
169  }
170 }
integer iTotDofOwners
Definition: dataman.h:795
std::vector< DofOwner > DofOwners
Definition: dataman.h:796
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void DataManager::SetTime ( const doublereal dTime,
const doublereal dTimeStep = -1.,
const integer iStep = -1,
bool  bServePending = true 
)

Definition at line 139 of file dataman2.cc.

References DEBUGLCOUT, DriveData, DrvHdl, MathParser::GetSymbolTable(), Drive::LASTDRIVETYPE, MathPar, MYDEBUG_ASSEMBLY, MYDEBUG_INIT, pRBK, DriveHandler::SetTime(), and RigidBodyKinematics::Update().

Referenced by InverseSolver::Advance(), Solver::Advance(), DataManager(), ThirdOrderIntegrator::Jacobian(), InverseSolver::Prepare(), Solver::Prepare(), ThirdOrderIntegrator::Residual(), and Solver::Start().

141 {
142  /* Setta il tempo nel DriveHandler */
143  DrvHdl.SetTime(dTime, dTimeStep, iStep);
144 
146  "Global symbol table:" << std::endl
147  << MathPar.GetSymbolTable() << std::endl);
148 
149  /* serve i drive pending */
150  if (bServePending) {
151  for (int iType = 0; iType < Drive::LASTDRIVETYPE; iType++) {
152  for (unsigned int iCnt = 0; iCnt < DriveData[iType].iNum; iCnt++) {
153  DriveData[iType].ppFirstDrive[iCnt]->ServePending(dTime);
154  }
155  }
156  }
157 
158  // updates rigid body kinematics, if any
159  if (pRBK) {
160  pRBK->Update();
161  }
162 } /* End of DataManager::SetTime() */
MathParser & MathPar
Definition: dataman.h:98
struct DataManager::@29 DriveData[Drive::LASTDRIVETYPE]
RigidBodyKinematics * pRBK
Definition: dataman.h:129
virtual void Update(void)
Definition: rbk.cc:45
void SetTime(const doublereal &dt, const doublereal &dts, const integer &s)
Definition: drive.cc:208
DriveHandler DrvHdl
Definition: dataman.h:104
Table & GetSymbolTable(void) const
Definition: mathp.cc:1931
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

void DataManager::SetValue ( VectorHandler X,
VectorHandler XP 
)

Definition at line 1404 of file dataman2.cc.

References VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), ElemIter, VectorHandler::iGetSize(), MBDYN_EXCEPT_ARGS, Nodes, VectorHandler::pdGetVec(), SAFEDELETEARR, SimulationEntity::SetValue(), and solArrFileName.

Referenced by InverseSolver::Prepare(), and Solver::Prepare().

1405 {
1406  /* Nodi */
1407  for (NodeVecType::iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
1408  (*i)->SetValue(this, X, XP);
1409  }
1410 
1411  /* Elementi */
1412  /* Versione con iteratore: */
1413  Elem* pEl = NULL;
1414  if (ElemIter.bGetFirst(pEl)) {
1415  do {
1416  pEl->SetValue(this, X, XP);
1417  } while (ElemIter.bGetNext(pEl));
1418  }
1419  if (solArrFileName != NULL) {
1420  std::ifstream fp(solArrFileName);
1421 #ifdef HAVE_ISOPEN
1422  if (!fp.is_open()) {
1423  silent_cerr("DataManager::SetValue(): "
1424  "Cannot open file \"" << solArrFileName << "\""
1425  << std::endl);
1427  }
1428 #endif /* HAVE_ISOPEN */
1429  fp.read((char*)X.pdGetVec() , X.iGetSize()*sizeof(double));
1430  if (fp.gcount() != std::streamsize(X.iGetSize()*sizeof(double))) {
1431  silent_cerr("DataManager::SetValue(): "
1432  "File(" << solArrFileName << ") too short!"
1433  << std::endl);
1435  }
1436  fp.read((char*)XP.pdGetVec() , XP.iGetSize()*sizeof(double));
1437  if (fp.gcount() != std::streamsize(XP.iGetSize()*sizeof(double))) {
1438  silent_cerr("DataManager::SetValue(): "
1439  "File(" << solArrFileName << ") too short!"
1440  << std::endl);
1442  }
1444  fp.close();
1445  }
1446 } /* End of SetValue */
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
virtual doublereal * pdGetVec(void) const =0
NodeVecType Nodes
Definition: dataman.h:743
#define SAFEDELETEARR(pnt)
Definition: mynewmem.h:713
virtual integer iGetSize(void) const =0
VecIter< Elem * > ElemIter
Definition: dataman.h:612
char * solArrFileName
Definition: dataman.h:176
Definition: elem.h:75
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
Definition: simentity.cc:63

Here is the call graph for this function:

void DataManager::Update ( void  ) const
virtual

Reimplemented in SchurDataManager.

Definition at line 2511 of file dataman2.cc.

References VecIter< T >::bGetFirst(), VecIter< T >::bGetNext(), ElemIter, Nodes, pXCurr, pXPrimeCurr, and SimulationEntity::Update().

Referenced by ImplicitStepIntegrator::EvalProd(), InverseDynamicsStepSolver::EvalProd(), ThirdOrderIntegrator::Jacobian(), ThirdOrderIntegrator::Residual(), ThirdOrderIntegrator::Update(), StepNIntegrator::Update(), and InverseDynamicsStepSolver::Update().

2512 {
2513  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
2514  (*i)->Update(*pXCurr, *pXPrimeCurr);
2515  }
2516 
2517  /* Versione con iteratore: */
2518  Elem* pEl = NULL;
2519  if (ElemIter.bGetFirst(pEl)) {
2520  do {
2521  pEl->Update(*pXCurr, *pXPrimeCurr);
2522  } while (ElemIter.bGetNext(pEl));
2523  }
2524 }
bool bGetNext(T &TReturn) const
Definition: veciter.h:118
NodeVecType Nodes
Definition: dataman.h:743
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
VecIter< Elem * > ElemIter
Definition: dataman.h:612
Definition: elem.h:75
bool bGetFirst(T &TReturn) const
Definition: veciter.h:88
VectorHandler * pXCurr
Definition: dataman.h:108
virtual void Update(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: simentity.cc:98

Here is the call graph for this function:

void DataManager::Update ( InverseDynamics::Order  iOrder) const
virtual

Definition at line 793 of file invdataman.cc.

References InverseDynamics::ACCELERATION, ASSERT, DataManager::ElemDataStructure::ElemContainer, ElemData, InverseDynamics::INVERSE_DYNAMICS, Elem::JOINT, MBDYN_EXCEPT_ARGS, Nodes, pLambdaCurr, InverseDynamics::POSITION, pXCurr, pXPrimeCurr, pXPrimePrimeCurr, and InverseDynamics::VELOCITY.

794 {
795  const VectorHandler* pV = 0;
796 
797  switch (iOrder) {
799  // Update constraints reactions (for output only...)
800  for (ElemContainerType::const_iterator j = ElemData[Elem::JOINT].ElemContainer.begin();
801  j != ElemData[Elem::JOINT].ElemContainer.end(); ++j)
802  {
803  j->second->Update(*pLambdaCurr, iOrder);
804  }
805  return;
806 
807  // Nodes:
809  // Update nodes positions
810  pV = pXCurr;
811  break;
812 
814  // Update nodes velocities
815  pV = pXPrimeCurr;
816  break;
817 
819  // Update nodes accelerations
820  pV = pXPrimePrimeCurr;
821  break;
822 
823  default:
825  }
826 
827  ASSERT(pV != 0);
828  for (NodeVecType::const_iterator i = Nodes.begin(); i != Nodes.end(); ++i) {
829  (*i)->Update(*pV, iOrder);
830  }
831 }
ElemContainerType ElemContainer
Definition: dataman.h:591
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
NodeVecType Nodes
Definition: dataman.h:743
VectorHandler * pXPrimePrimeCurr
Definition: dataman.h:112
VectorHandler * pXPrimeCurr
Definition: dataman.h:109
#define ASSERT(expression)
Definition: colamd.c:977
VectorHandler * pLambdaCurr
Definition: dataman.h:113
struct DataManager::ElemDataStructure ElemData[Elem::LASTELEMTYPE]
VectorHandler * pXCurr
Definition: dataman.h:108

Friends And Related Function Documentation

friend class InitialAssemblyIterator
friend

Definition at line 495 of file dataman.h.

Member Data Documentation

bool DataManager::bInitialJointAssemblyToBeDone
protected

Definition at line 116 of file dataman.h.

Referenced by DataManager(), and ReadControl().

bool DataManager::bInverseDynamics
protected

Definition at line 133 of file dataman.h.

Referenced by bIsInverseDynamics(), bSetInverseDynamics(), and DataManager().

bool DataManager::bOmegaRotates
protected

Definition at line 123 of file dataman.h.

Referenced by bDoesOmegaRotate(), and ReadControl().

bool DataManager::bOutputAccels
protected

Definition at line 119 of file dataman.h.

Referenced by bOutputAccelerations(), IDDofInit(), and ReadControl().

bool DataManager::bOutputDriveCaller
protected

Definition at line 120 of file dataman.h.

Referenced by bOutputDriveCallers(), and ReadControl().

bool DataManager::bOutputFrames
protected

Definition at line 118 of file dataman.h.

Referenced by DataManager(), and ReadControl().

bool DataManager::bSkipInitialJointAssembly
protected

Definition at line 117 of file dataman.h.

Referenced by DataManager(), and ReadControl().

bool DataManager::bStaticModel
protected

Definition at line 130 of file dataman.h.

Referenced by bIsStaticModel(), bSetStaticModel(), and ReadControl().

LinSol DataManager::CurrSolver
protected

Definition at line 127 of file dataman.h.

Referenced by InitialJointAssembly(), and ReadControl().

doublereal DataManager::dDefScale

Definition at line 789 of file dataman.h.

doublereal DataManager::dEpsilon
protected

Definition at line 126 of file dataman.h.

Referenced by InitialJointAssembly(), and ReadControl().

doublereal DataManager::dInitialAssemblyTol
protected

Definition at line 124 of file dataman.h.

Referenced by InitialJointAssembly(), MakeRestart(), and ReadControl().

doublereal DataManager::dInitialPositionStiffness
protected

Definition at line 121 of file dataman.h.

Referenced by dGetInitialPositionStiffness(), MakeRestart(), and ReadControl().

doublereal DataManager::dInitialVelocityStiffness
protected

Definition at line 122 of file dataman.h.

Referenced by dGetInitialVelocityStiffness(), MakeRestart(), and ReadControl().

doublereal DataManager::dLastRestartTime
mutableprotected

Definition at line 173 of file dataman.h.

Referenced by AfterConvergence().

std::vector<DofOwner> DataManager::DofOwners
protected

Definition at line 796 of file dataman.h.

Referenced by DataManager(), DofDataInit(), DofInit(), IDDofInit(), and SetScale().

doublereal DataManager::dRestartTime
protected

Definition at line 166 of file dataman.h.

Referenced by AfterConvergence(), and ReadControl().

DofOwner DataManager::DummyDofOwner
protected

Definition at line 815 of file dataman.h.

Referenced by DofManager(), and ReadNodes().

ElemVecType DataManager::Elems
protected
integer DataManager::iCurrRestartIter
mutableprotected

Definition at line 172 of file dataman.h.

Referenced by AfterConvergence().

integer DataManager::iCurrRestartTime
mutableprotected

Definition at line 170 of file dataman.h.

Referenced by AfterConvergence().

int DataManager::iIDJointTotNumDofs
protected

Definition at line 135 of file dataman.h.

Referenced by IDDofInit(), IDDofOwnerSet(), iIDGetJointTotNumDofs(), and iIDGetTotNumDofs().

int DataManager::iIDNodeTotNumDofs
protected

Definition at line 134 of file dataman.h.

Referenced by IDDofInit(), IDDofOwnerSet(), iIDGetNodeTotNumDofs(), and iIDGetTotNumDofs().

integer DataManager::iMaxInitialIterations
protected

Definition at line 125 of file dataman.h.

Referenced by InitialJointAssembly(), MakeRestart(), and ReadControl().

integer DataManager::iMaxWorkNumColsJac
protected

Definition at line 627 of file dataman.h.

Referenced by ElemAssInit().

integer DataManager::iMaxWorkNumItemsJac
protected

Definition at line 628 of file dataman.h.

Referenced by ElemAssInit().

integer DataManager::iMaxWorkNumRowsJac
protected

Definition at line 626 of file dataman.h.

Referenced by ElemAssInit().

integer DataManager::iMaxWorkNumRowsRes
protected

Definition at line 625 of file dataman.h.

Referenced by ElemAssInit().

unsigned int DataManager::iNum

Definition at line 618 of file dataman.h.

Referenced by InitialJointAssembly(), MakeRestart(), and pFindDrive().

integer DataManager::iNum

Definition at line 787 of file dataman.h.

integer DataManager::iNumRestartTimes
protected

Definition at line 169 of file dataman.h.

Referenced by AfterConvergence(), and ReadControl().

integer DataManager::iOutputCount
mutableprotected

Definition at line 180 of file dataman.h.

integer DataManager::iRestartIterations
protected

Definition at line 165 of file dataman.h.

Referenced by AfterConvergence(), and ReadControl().

integer DataManager::iSize

Definition at line 788 of file dataman.h.

Referenced by OutputEigenvectors(), PrintResidual(), and PrintSolution().

integer DataManager::iTotDofOwners
protected

Definition at line 795 of file dataman.h.

Referenced by DofDataInit(), DofInit(), IDDofInit(), and SetScale().

integer DataManager::iTotDofs
protected
unsigned int DataManager::iTotDrive
protected

Definition at line 622 of file dataman.h.

Referenced by DataManager(), ElemDataInit(), ElemManagerDestructor(), MakeRestart(), and ReadDrivers().

unsigned int DataManager::iTotNodes
protected

Definition at line 748 of file dataman.h.

Referenced by DataManager(), NodeDataInit(), and ReadNodes().

Converged_t DataManager::m_IsConverged
mutableprotected
std::map<std::string, const LoadableCalls *> DataManager::MapOfLoadableElemHandlers
protected

Definition at line 102 of file dataman.h.

Referenced by GetLoadableElemModule(), and SetLoadableElemModule().

MathParser& DataManager::MathPar
protected

Definition at line 98 of file dataman.h.

Referenced by DataManager(), GetMathParser(), InsertSym(), PopCurrData(), PushCurrData(), and SetTime().

MBDynParser& DataManager::MBPar
protected

Definition at line 97 of file dataman.h.

Referenced by DataManager(), DriveOutput(), DriveTrace(), and GetMBDynParser().

OrientationDescription DataManager::od
protected
doublereal* DataManager::pdRestartTimes
protected

Definition at line 168 of file dataman.h.

Referenced by AfterConvergence(), and ReadControl().

DofOwner* DataManager::pFirstDofOwner

Definition at line 786 of file dataman.h.

VectorHandler* DataManager::pLambdaCurr
mutableprotected

Definition at line 113 of file dataman.h.

Referenced by LinkToSolution(), and Update().

DriveCaller* DataManager::pOutputMeter
protected

Definition at line 179 of file dataman.h.

Referenced by Output(), ReadControl(), and ~DataManager().

void** DataManager::ppCleanupData
protected

Definition at line 89 of file dataman.h.

Referenced by DataManager(), and ~DataManager().

Drive** DataManager::ppDrive
protected

Definition at line 621 of file dataman.h.

Referenced by ElemDataInit(), ElemManagerDestructor(), and MakeRestart().

Drive** DataManager::ppFirstDrive

Definition at line 617 of file dataman.h.

Referenced by pFindDrive().

RigidBodyKinematics* DataManager::pRBK
protected

Definition at line 129 of file dataman.h.

Referenced by pGetRBK(), ReadControl(), SetTime(), and ~DataManager().

Solver* DataManager::pSolver
protected
VariableSubMatrixHandler* DataManager::pWorkMat
protected

Definition at line 632 of file dataman.h.

Referenced by AssConstrJac(), AssJac(), and ElemAssInit().

VariableSubMatrixHandler* DataManager::pWorkMatA
protected

Definition at line 630 of file dataman.h.

Referenced by AssMats(), ElemAssInit(), and ElemManagerDestructor().

VariableSubMatrixHandler* DataManager::pWorkMatB
protected

Definition at line 631 of file dataman.h.

Referenced by AssMats(), ElemAssInit(), and ElemManagerDestructor().

MySubVectorHandler* DataManager::pWorkVec
protected

Definition at line 633 of file dataman.h.

Referenced by AssConstrRes(), AssRes(), ElemAssInit(), and ElemManagerDestructor().

VectorHandler* DataManager::pXPrimePrimeCurr
mutableprotected

Definition at line 112 of file dataman.h.

Referenced by AssConstrRes(), AssRes(), IDAfterConvergence(), LinkToSolution(), and Update().

int DataManager::ResMode
protected

Definition at line 201 of file dataman.h.

Referenced by bOutput(), and ReadControl().

eRestart DataManager::RestartEvery
protected

Definition at line 164 of file dataman.h.

Referenced by AfterConvergence(), MakeRestart(), ReadControl(), and ~DataManager().

bool DataManager::saveXSol
protected

Definition at line 175 of file dataman.h.

Referenced by MakeRestart(), and ReadControl().

char* DataManager::solArrFileName
protected

Definition at line 176 of file dataman.h.

Referenced by ReadControl(), and SetValue().

char* DataManager::sSimulationTitle
protected

Definition at line 158 of file dataman.h.

Referenced by MakeRestart(), ReadControl(), and ~DataManager().

unsigned DataManager::uPrintFlags
protected

Definition at line 156 of file dataman.h.

Referenced by DofOwnerInit(), InitialJointAssembly(), and ReadControl().


The documentation for this class was generated from the following files: