23 #include "fmatvec/fmatvec.h"
24 #include "fmatvec/atom.h"
25 #include "mbsim/objectfactory.h"
27 #include <hdf5serie/vectorserie.h>
28 #include <mbxmlutilshelper/dom.h>
30 #include "mbsim_event.h"
49 class DynamicSystemSolver;
127 virtual std::string
getType()
const {
return "Element"; }
166 void setPath(
const std::string &str) {
path=str; }
222 PlotFeature initializePlotFeatureUsingXML(xercesc::DOMElement *e);
223 virtual void initializeUsingXML(xercesc::DOMElement *element);
225 const std::vector<MBXMLUtils::EmbedDOMLocator>& getLocationStack()
const {
return locationStack; }
231 template<
class T> T*
getByPath(
const std::string &
path,
bool initialCaller=
true)
const;
238 std::string
getPath(
const Element *relTo=NULL, std::string sep=
"/")
const;
244 THROW_MBSIMERROR(
"This element has no containers with childs.");
248 static double getDouble(xercesc::DOMElement *e);
249 static int getInt(xercesc::DOMElement *e);
250 static bool getBool(xercesc::DOMElement *e);
251 static fmatvec::Vec3 getVec3(xercesc::DOMElement *e);
252 static fmatvec::Vec getVec(xercesc::DOMElement *e,
int rows=0);
253 static fmatvec::Mat3xV getMat3xV(xercesc::DOMElement *e,
int cols=0);
254 static fmatvec::Mat getMat(xercesc::DOMElement *e,
int rows=0,
int cols=0);
255 static fmatvec::SqrMat3 getSqrMat3(xercesc::DOMElement *e);
257 static fmatvec::SymMat3 getSymMat3(xercesc::DOMElement *e);
260 virtual std::shared_ptr<OpenMBV::Group> getOpenMBVGrp() {
return std::shared_ptr<OpenMBV::Group>();}
262 virtual Element* getParent() {
return parent;}
263 virtual const Element* getParent()
const {
return parent;}
264 virtual void setParent(
Element* parent_) {parent = parent_;}
281 virtual void updatePositions(Frame *frame) { }
282 virtual void updateVelocities(Frame *frame) { }
283 virtual void updateAccelerations(Frame *frame) { }
284 virtual void updateJacobians(Frame *frame,
int j=0) { }
285 virtual void updateGyroscopicAccelerations(Frame *frame) { }
287 virtual void resetUpToDate() {}
289 const double& getTime()
const;
290 double getStepSize()
const;
307 std::vector<MBXMLUtils::EmbedDOMLocator> locationStack;
334 void updatePlotFeatures();
351 if(path.substr(0, 1) ==
"/") {
355 return getByPath<T>(path.substr(1),
false);
357 else if (path.substr(0, 3) ==
"../")
358 return parent->
getByPath<T>(path.substr(3),
false);
361 size_t idx=path.find(
'/');
362 std::string first=path.substr(0, idx);
364 if(idx!=std::string::npos)
365 rest=path.substr(idx+1);
367 size_t pos0=first.find(
'[');
368 if(pos0==std::string::npos)
369 THROW_MBSIMERROR(
"Syntax error in subreference '"+first+
"': no [ found.");
370 std::string container=first.substr(0, pos0);
371 if(first[first.size()-1]!=
']')
372 THROW_MBSIMERROR(
"Syntax error in subreference '"+first+
"': not ending with ].");
373 std::string
name=first.substr(pos0+1, first.size()-pos0-2);
379 T *t=
dynamic_cast<T*
>(e);
383 THROW_MBSIMERROR(
"Cannot cast this element to type "+container+
".");
388 THROW_MBSIMERROR(
"Evaluation of refernece '"+path+
"' failed: Message from "+
389 ex.getPath()+
": "+ex.getErrorMessage());
std::vector< Element * > getDependencies() const
checks dependency on other elements.
Definition: element.h:270
virtual void createPlotGroup()
creates the plotGroup for H5-output
Definition: element.cc:103
virtual void plot()
plots time dependent data
Definition: element.cc:54
virtual Element * getChildByContainerAndName(const std::string &container, const std::string &name) const
Get the Element named name in the container named container.
Definition: element.h:243
Definition: element.h:101
DynamicSystemSolver * getDynamicSystemSolver()
Definition: element.h:171
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:48
virtual void setPlotFeature(PlotFeature pf, PlotFeatureStatus value)
Set a plot feature.
Definition: element.h:195
std::vector< Element * > dependency
vector containing all dependencies.
Definition: element.h:339
virtual void plotAtSpecialEvent()
plots time dependent data at special events
Definition: element.h:147
std::string getPath(const Element *relTo=NULL, std::string sep="/") const
Return the path of this object. If relativeTo is not NULL return a relative path to relativeTo...
Definition: element.cc:133
H5::VectorSerie< double > * plotVectorSerie
time series
Definition: element.h:317
basic class of MBSim mainly for plotting
Definition: element.h:58
virtual void initDataInterfaceBase(DynamicSystemSolver *parentds)
TODO.
Definition: element.h:122
std::string path
The path of this object. Is set during the init stage reorganizeHierarchy. Before this the path is ca...
Definition: element.h:305
DynamicSystemSolver * ds
dynamic system
Definition: element.h:312
H5::GroupBase * getPlotGroup()
Definition: element.h:187
virtual std::string getType() const
Definition: element.h:127
std::vector< std::string > plotColumns
columns of time series
Definition: element.h:327
Definition: element.h:103
Definition: element.h:102
void setPlotFeatureRecursive(PlotFeature pf, PlotFeatureStatus value)
Set a plot feature for this object and the children of this object.
Definition: element.h:209
virtual void closePlot()
closes plot file
Definition: element.cc:65
InitStage
The stages of the initialization.
Definition: element.h:97
T * getByPath(const std::string &path, bool initialCaller=true) const
Get the object of type T represented by the path path. Do not set any argurment other than path! ...
Definition: element.h:349
std::vector< double > plotVector
one entry of time series
Definition: element.h:322
PlotFeatureStatus getPlotFeature(PlotFeature pf)
Definition: element.h:214
std::string name
name of element
Definition: element.h:298
Definition: element.h:100
virtual void init(InitStage stage)
plots time series header
Definition: element.cc:70
virtual ~Element()
destructor
Definition: element.cc:51
const std::string & getName() const
Definition: element.h:158
virtual void setDynamicSystemSolver(DynamicSystemSolver *sys)
sets the used dynamics system solver to the element
Definition: element.h:133
Definition: element.h:104
H5::GroupBase * plotGroup
associated plot group
Definition: element.h:332
void setPlotFeatureForChildren(PlotFeature pf, PlotFeatureStatus value)
Set a plot feature for the children of this object.
Definition: element.h:202
void setName(const std::string &str)
Definition: element.h:163
PlotFeatureStatus plotFeature[LASTPLOTFEATURE]
plot feature
Definition: element.h:345
basic error class for mbsim
Definition: mbsim_event.h:38
int computeLevel()
computes the length of the pathes in the graph that represents the dependencies between all elements...
Definition: element.cc:368
PlotFeatureStatus
Plot feature status.
Definition: element.h:61
Element(const std::string &name)
constructor
Definition: element.cc:44
PlotFeature
Plot Features.
Definition: element.h:74
PlotFeatureStatus getPlotFeatureForChildren(PlotFeature pf)
Definition: element.h:219