mbsim 4.0.0 MBSim Kernel

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
MBSim::Element Class Reference

basic class of MBSim mainly for plotting More...

`#include <element.h>`

Inheritance diagram for MBSim::Element:
[legend]

## Public Types

enum | InitStage { resolveStringRef =0, preInit, plotting, unknownStage, LASTINITSTAGE }
| The stages of the initialization. More...

## Public Member Functions

| Element (const std::string &name)
| constructor
| ~Element () override=default
| destructor
void | throwError (const std::string &msg) const
virtual void | setDynamicSystemSolver (DynamicSystemSolver *sys)
| sets the used dynamics system solver to the element More...
virtual void | plot ()
| plots time dependent data More...
virtual void | plotAtSpecialEvent ()
| plots time dependent data at special events More...
const std::string & | getName () const
void | setName (const std::string &str)
void | setPath (const std::string &str)
DynamicSystemSolver * | getDynamicSystemSolver ()
virtual void | init (InitStage stage, const InitConfigSet &config)
| plots time series header More...
virtual void | createPlotGroup ()
| creates the plotGroup for H5-output
H5::GroupBase * | getPlotGroup ()
virtual H5::GroupBase * | getFramesPlotGroup ()
virtual H5::GroupBase * | getContoursPlotGroup ()
virtual H5::GroupBase * | getGroupsPlotGroup ()
virtual H5::GroupBase * | getObjectsPlotGroup ()
virtual H5::GroupBase * | getLinksPlotGroup ()
virtual H5::GroupBase * | getConstraintsPlotGroup ()
virtual H5::GroupBase * | getObserversPlotGroup ()
bool | getPlotFeature (const PlotFeatureEnum &pf)
virtual void | setPlotFeature (const PlotFeatureEnum &pf, bool value)
| Set a plot feature. More...
void | setPlotFeatureForChildren (const PlotFeatureEnum &pf, bool value)
| Set a plot feature for the children of this object. More...
void | setPlotFeatureRecursive (const PlotFeatureEnum &pf, bool value)
| Set a plot feature for this object and the children of this object. More...
template<class T >
void | setPlotAttribute (const std::string &name, const T &value)
| Set a plot attribute: static data attached as key/value pairs to the plot datasets/groups.
void | setPlotAttribute (const std::string &name)
virtual void | initializeUsingXML (xercesc::DOMElement *element)
template<class T >
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!
std::string | getPath (const Element *relTo=nullptr, std::string sep="/") const
| Return the path of this object. If relativeTo is not NULL return a relative path to relativeTo. Do not set any argurment other than relTo and sep!
virtual Element * | getChildByContainerAndName (const std::string &container, const std::string &name) const
| Get the Element named name in the container named container.
virtual std::shared_ptr< OpenMBV::Group > | getOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getFramesOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getContoursOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getGroupsOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getObjectsOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getLinksOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getConstraintsOpenMBVGrp ()
virtual std::shared_ptr< OpenMBV::Group > | getObserversOpenMBVGrp ()
virtual Element * | getParent ()
virtual const Element * | getParent () const
virtual void | setParent (Element *parent_)
std::vector< Element * > | getDependencies () const
| checks dependency on other elements. More...
void | addDependency (Element *ele)
int | computeLevel ()
| computes the length of the pathes in the graph that represents the dependencies between all elements. More...
virtual void | updatePositions (Frame *frame)
virtual void | updateVelocities (Frame *frame)
virtual void | updateAccelerations (Frame *frame)
virtual void | updateJacobians (Frame *frame, int j=0)
virtual void | updateGyroscopicAccelerations (Frame *frame)
virtual void | resetUpToDate ()
const double & | getTime () const
double | getStepSize () const
const MBXMLUtils::DOMEvalException & | getDOMEvalError () const

## Protected Member Functions

void | updatePlotFeatures ()
void | addToPlot (const std::string &name)
void | addToPlot (const std::string &name, int size)
void | addToPlot (const std::string &name, const std::vector< std::string > &iname)
template<class AT >
void | plot (const AT &x)
template<class Type , class AT >
void | plot (const fmatvec::Vector< Type, AT > &x)

## Protected Attributes

Element * | parent
std::string | name
| name of element
std::string | path
| The path of this object. Is set during the init stage reorganizeHierarchy. Before this the path is calculated dynamically using getPath() after this stage getPath just returns this value.
MBXMLUtils::DOMEvalException | domEvalError
| Special XML helper variable.
DynamicSystemSolver * | ds
| dynamic system
H5::VectorSerie< double > * | plotVectorSerie
| time series
std::vector< double > | plotVector
| one entry of time series
std::vector< std::string > | plotColumns
| columns of time series
H5::GroupBase * | plotGroup
| associated plot group
std::vector< Element * > | dependency
| vector containing all dependencies.
PlotFeatureMap | plotFeature
| plot feature
PlotFeatureMap | plotFeatureForChildren
std::map< std::string, std::variant< std::monostate, int, double, std::string, std::vector< int >, std::vector< double >, std::vector< std::vector< double > > > > | plotAttribute

## Private Member Functions

Element * | getByPathElement (const std::string &path, bool initialCaller=true) const

## Detailed Description

basic class of MBSim mainly for plotting

Author
  Martin Foerg

Date
  2009-03-24 plot feature energy (Thorsten Schindler)
  2009-07-28 splitted interfaces (Thorsten Schindler)

## Member Enumeration Documentation

## ◆ InitStage

enum MBSim::Element::InitStage

The stages of the initialization.

see also DynamicSystemSolver::init()

Enumerator
resolveStringRef | resolve references given by a string path to the corrosponding pointer
preInit | Make some early initialization. TODO This should be split into detailed stages.
plotting | Build/initialize the plot structure
unknownStage | Init all the rest. TODO This should be split into detailed stages.

## Member Function Documentation

## ◆ computeLevel()

int MBSim::Element::computeLevel | ( |  | ) |

computes the length of the pathes in the graph that represents the dependencies between all elements.

Returns
  the length of the longest path in the graph.

## ◆ getDependencies()

std::vector<Element*> MBSim::Element::getDependencies | ( |  | ) | const

inline

checks dependency on other elements.

Returns
  a vector of elements the calling element depends on.

## ◆ getDynamicSystemSolver()

DynamicSystemSolver* MBSim::Element::getDynamicSystemSolver | ( |  | ) |

inline

Returns
  dynamic system solver

## ◆ getName()

const std::string& MBSim::Element::getName | ( |  | ) | const

inline

Returns
  element name

## ◆ getPlotFeature()

bool MBSim::Element::getPlotFeature | ( | const PlotFeatureEnum & | pf | ) |

inline

Get the state of the plot feature pf. Returns false if the plot feature pf is not set till now.

## ◆ getPlotGroup()

H5::GroupBase* MBSim::Element::getPlotGroup | ( |  | ) |

inline

Returns
  associated plot group

## ◆ init()

void MBSim::Element::init | ( | InitStage | stage,
|  | const InitConfigSet & | config
| ) |  |

virtual

plots time series header

Parameters

  invocing | parent class

Reimplemented in MBSim::Object, MBSim::InverseKineticsJoint, MBSim::TwoDimensionalPiecewisePolynomFunction< Ret(Arg1, Arg2)>, MBSim::DynamicSystemSolver, MBSim::DynamicSystem, MBSim::SingleContact, MBSim::CompositeFunction< Ret(Argo(Argi))>, MBSim::TwoDimensionalTabularFunction< Ret(Arg1, Arg2)>, MBSim::DiskContact, MBSim::RigidBody, MBSim::Contact, MBSim::PiecewiseDefinedFunction< Ret(Arg)>, MBSim::SymbolicFunction< Ret(Arg1, Arg2)>, MBSim::Link, MBSim::FourierFunction< Ret(Arg)>, MBSim::PiecewisePolynomFunction< Ret(Arg)>, MBSim::MaxwellContact, MBSim::TabularFunction< Ret(Arg)>, MBSim::Joint, MBSim::Body, MBSim::BidirectionalFunction< Ret(Arg)>, MBSim::RigidBodyLink, MBSim::VectorValuedFunction< Ret(Arg)>, MBSim::Point, MBSim::RigidBodyObserver, MBSim::MechanicalLink, MBSim::MagicFormula62, MBSim::DirectionalSpringDamper, MBSim::SingleContactObserver, MBSim::NonlinearSpringDamperForce, MBSim::PlanarNurbsContour, MBSim::SpatialNurbsContour, MBSim::GeneralizedClutch, MBSim::SpringDamper, MBSim::FrameObserver, MBSim::RigidContour, MBSim::ContinuedFunction< Ret(Arg)>, MBSim::GeneralizedFriction, MBSim::PlanarContour, MBSim::SpatialContour, MBSim::KineticExcitation, MBSim::CompoundContour, MBSim::LinearRegularizedStribeckFriction, MBSim::IsotropicRotationalSpringDamper, MBSim::PolynomialFrustum, MBSim::Frame, MBSim::MechanicalLinkObserver, MBSim::StateDependentFunction< Ret >, MBSim::MaxwellContactObserver, MBSim::TimeDependentFunction< Ret >, MBSim::ContactObserver, MBSim::InverseKinematicsConstraintObserver, MBSim::MechanicalConstraintObserver, MBSim::LineSegment, MBSim::Plate, MBSim::GeneralizedElasticStructure, MBSim::JointConstraint, MBSim::Frustum, MBSim::ElasticJoint, MBSim::ContourLink, MBSim::PlanarStribeckFriction, MBSim::PlanarStribeckImpact, MBSim::SpatialStribeckFriction, MBSim::SpatialStribeckImpact, MBSim::InverseKinematicsConstraint, MBSim::Circle, MBSim::LinearElasticFunction, MBSim::RegularizedConstraint, MBSim::BevelGear, MBSim::Cuboid, MBSim::PlanarGear, MBSim::Room, MBSim::FloatingFrameLink, MBSim::GeneralizedGear, MBSim::CylindricalGear, MBSim::Disk, MBSim::PlanarFrustum, MBSim::Rack, MBSim::Sphere, MBSim::TyreContactObserver, MBSim::GeneralizedConnection, MBSim::GeneralizedKinematicExcitation, MBSim::Tyre, MBSim::ContourQuad, MBSim::GeneralizedSpringDamper, MBSim::FrameLink, MBSim::GeneralizedElasticConnection, MBSim::RegularizedFriction, MBSim::Cylinder, MBSim::FixedFrameLink, MBSim::GeneralizedConstraint, MBSim::FixedRelativeFrame, MBSim::FloatingRelativeFrame, MBSim::GeneralizedAccelerationExcitation, MBSim::GeneralizedVelocityExcitation, MBSim::TyreContact, MBSim::GeneralizedDualConstraint, MBSim::PolynomFunction< Ret(Arg)>, MBSim::SymbolicFunction< Ret(Arg)>, MBSim::GeneralizedPositionExcitation, MBSim::GeneralizedAccelerationConstraint, MBSim::GeneralizedVelocityConstraint, MBSim::DualRigidBodyLink, MBSim::GeneralizedGearConstraint, MBSim::GeneralizedPositionConstraint, MBSim::PolarContourFunction, MBSim::Observer, and MBSim::GeneralizedConnectionConstraint.

## ◆ plot()

void MBSim::Element::plot | ( |  | ) |

virtual

plots time dependent data

Parameters

  simulation | time
  simulation | time step size for derivative calculation

Reimplemented in MBSim::DynamicSystemSolver, MBSim::Contact, MBSim::DynamicSystem, MBSim::MaxwellContact, MBSim::RigidBody, MBSim::Link, MBSim::KineticExcitation, MBSim::DirectionalSpringDamper, MBSim::Object, MBSim::SpringDamper, MBSim::Body, MBSim::RigidBodyObserver, MBSim::MechanicalLink, MBSim::SingleContactObserver, MBSim::GeneralizedClutch, MBSim::FrameObserver, MBSim::GeneralizedFriction, MBSim::RigidContour, MBSim::Frame, MBSim::MechanicalLinkObserver, MBSim::MaxwellContactObserver, MBSim::ContactObserver, MBSim::InverseKinematicsConstraintObserver, MBSim::MechanicalConstraintObserver, MBSim::CompoundContour, MBSim::TyreContactObserver, and MBSim::TyreContact.

## ◆ plotAtSpecialEvent()

virtual void MBSim::Element::plotAtSpecialEvent | ( |  | ) |

inline virtual

plots time dependent data at special events

Parameters

  simulation | time
  simulation | time step size for derivative calculation

Reimplemented in MBSim::DynamicSystem.

## ◆ setDynamicSystemSolver()

virtual void MBSim::Element::setDynamicSystemSolver | ( | DynamicSystemSolver * | sys | ) |

inline virtual

sets the used dynamics system solver to the element

Parameters

  pointer | to the dynamic system solver of which the element is part of

Reimplemented in MBSim::RigidBody, MBSim::Contact, MBSim::DynamicSystem, MBSim::MaxwellContact, MBSim::Body, MBSim::StateDependentFunction< Ret >, MBSim::TimeDependentFunction< Ret >, MBSim::MaxwellContactObserver, and MBSim::ContactObserver.

## ◆ setName()

void MBSim::Element::setName | ( | const std::string & | str | ) |

inline

Parameters

  element | name

## ◆ setPlotFeature()

void MBSim::Element::setPlotFeature | ( | const PlotFeatureEnum & | pf,
|  | bool | value
| ) |  |

virtual

Set a plot feature.

Set the plot feature pf of this object.

## ◆ setPlotFeatureForChildren()

void MBSim::Element::setPlotFeatureForChildren | ( | const PlotFeatureEnum & | pf,
|  | bool | value
| ) |  |

Set a plot feature for the children of this object.

Set the plot feature pf of all children for set plot features.

## ◆ setPlotFeatureRecursive()

void MBSim::Element::setPlotFeatureRecursive | ( | const PlotFeatureEnum & | pf,
|  | bool | value
| ) |  |

inline

Set a plot feature for this object and the children of this object.

This is a convenience function. It simply calls setPlotFeature and setPlotFeatureForChildren.

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

- /mbsim-env/mbsim/kernel/mbsim/element.h
- /mbsim-env/mbsim/kernel/mbsim/element.cc