23#include "mbsim/element.h"
25#include "mbsim/utils/boost_parameters.h"
26#include "mbsim/utils/openmbv_utils.h"
30 extern const PlotFeatureEnum position, angle, velocity, angularVelocity, acceleration, angularAcceleration;
53 void init(
InitStage stage,
const InitConfigSet &config)
override;
61 int gethSize(
int i=0)
const {
return hSize[i]; }
62 int gethInd(
int i=0)
const {
return hInd[i]; }
63 void sethSize(
int size,
int i=0) {
hSize[i] = size; }
64 void sethInd(
int ind,
int i=0) { hInd[i] = ind; }
66 const fmatvec::Vec3& getPosition(
bool check=
true)
const { assert((not check) or (not updPos));
return WrOP; }
67 fmatvec::Vec3& getPosition(
bool check=
true) { assert((not check) or (not updPos));
return WrOP; }
68 void setPosition(
const fmatvec::Vec3 &v) {
WrOP = v; }
69 const fmatvec::Vec3& evalPosition() {
if(updPos) updatePositions();
return WrOP; }
71 const fmatvec::SqrMat3& getOrientation(
bool check=
true)
const { assert((not check) or (not updPos));
return AWP; }
72 fmatvec::SqrMat3& getOrientation(
bool check=
true) { assert((not check) or (not updPos));
return AWP; }
73 void setOrientation(
const fmatvec::SqrMat3 &AWP_) {
AWP = AWP_; }
74 const fmatvec::SqrMat3& evalOrientation() {
if(updPos) updatePositions();
return AWP; }
76 const fmatvec::Vec3& getVelocity(
bool check=
true)
const { assert((not check) or (not updVel));
return WvP; }
77 fmatvec::Vec3& getVelocity(
bool check=
true) { assert((not check) or (not updVel));
return WvP; }
78 void setVelocity(
const fmatvec::Vec3 &v) {
WvP = v; }
79 const fmatvec::Vec3& evalVelocity() {
if(updVel) updateVelocities();
return WvP; }
81 const fmatvec::Vec3& getAngularVelocity(
bool check=
true)
const { assert((not check) or (not updVel));
return WomegaP; }
82 fmatvec::Vec3& getAngularVelocity(
bool check=
true) { assert((not check) or (not updVel));
return WomegaP; }
83 void setAngularVelocity(
const fmatvec::Vec3 &omega) { WomegaP = omega; }
84 const fmatvec::Vec3& evalAngularVelocity() {
if(updVel) updateVelocities();
return WomegaP; }
86 const fmatvec::Vec3& getAcceleration(
bool check=
true)
const { assert((not check) or (not updAcc));
return WaP; }
87 fmatvec::Vec3& getAcceleration(
bool check=
true) { assert((not check) or (not updAcc));
return WaP; }
88 void setAcceleration(
const fmatvec::Vec3 &a) {
WaP = a; }
89 const fmatvec::Vec3& evalAcceleration() {
if(updAcc) updateAccelerations();
return WaP; }
91 const fmatvec::Vec3& getAngularAcceleration(
bool check=
true)
const { assert((not check) or (not updAcc));
return WpsiP; }
92 fmatvec::Vec3& getAngularAcceleration(
bool check=
true) { assert((not check) or (not updAcc));
return WpsiP; }
93 void setAngularAcceleration(
const fmatvec::Vec3 &psi) { WpsiP = psi; }
94 const fmatvec::Vec3& evalAngularAcceleration() {
if(updAcc) updateAccelerations();
return WpsiP; }
96 const fmatvec::Mat3xV& getJacobianOfTranslation(
int j=0,
bool check=
true)
const { assert((not check) or (not updJac[j]));
return WJP[j]; }
97 fmatvec::Mat3xV& getJacobianOfTranslation(
int j=0,
bool check=
true) { assert((not check) or (not updJac[j]));
return WJP[j]; }
98 void setJacobianOfTranslation(
const fmatvec::Mat3xV &WJP_,
int j=0) {
WJP[j] = WJP_; }
99 const fmatvec::Mat3xV& evalJacobianOfTranslation(
int j=0) {
if(updJac[j]) updateJacobians(j);
return WJP[j]; }
101 const fmatvec::Mat3xV& getJacobianOfRotation(
int j=0,
bool check=
true)
const { assert((not check) or (not updJac[j]));
return WJR[j]; }
102 fmatvec::Mat3xV& getJacobianOfRotation(
int j=0,
bool check=
true) { assert((not check) or (not updJac[j]));
return WJR[j]; }
103 void setJacobianOfRotation(
const fmatvec::Mat3xV &WJR_,
int j=0) { WJR[j] = WJR_; }
104 const fmatvec::Mat3xV& evalJacobianOfRotation(
int j=0) {
if(updJac[j]) updateJacobians(j);
return WJR[j]; }
106 const fmatvec::Vec3& getGyroscopicAccelerationOfTranslation(
bool check=
true)
const { assert((not check) or (not updGA));
return WjP; }
107 fmatvec::Vec3& getGyroscopicAccelerationOfTranslation(
bool check=
true) { assert((not check) or (not updGA));
return WjP; }
108 void setGyroscopicAccelerationOfTranslation(
const fmatvec::Vec3 &WjP_) {
WjP = WjP_; }
109 const fmatvec::Vec3& evalGyroscopicAccelerationOfTranslation() {
if(updGA) updateGyroscopicAccelerations();
return WjP; }
111 const fmatvec::Vec3& getGyroscopicAccelerationOfRotation(
bool check=
true)
const { assert((not check) or (not updGA));
return WjR; }
112 fmatvec::Vec3& getGyroscopicAccelerationOfRotation(
bool check=
true) { assert((not check) or (not updGA));
return WjR; }
113 void setGyroscopicAccelerationOfRotation(
const fmatvec::Vec3 &WjR_) { WjR = WjR_; }
114 const fmatvec::Vec3& evalGyroscopicAccelerationOfRotation() {
if(updGA) updateGyroscopicAccelerations();
return WjR; }
116 void initializeUsingXML(xercesc::DOMElement *element)
override;
118 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBV, tag, (optional (size,(
double),1)(offset,(
double),1)(
path,(
bool),
false)(transparency,(
double),0)(pointSize,(
double),0)(lineWidth,(
double),0))) {
119 OpenMBVFrame ombv(size,offset,
path,fmatvec::Vec3(std::vector<double>{-1,1,1}),transparency,pointSize,lineWidth);
120 openMBVFrame=ombv.createOpenMBV();
122 void setOpenMBVFrame(
const std::shared_ptr<OpenMBV::Frame> &frame) { openMBVFrame = frame; }
123 std::shared_ptr<OpenMBV::Frame> &getOpenMBVFrame() {
return openMBVFrame; }
125 void resetUpToDate()
override;
126 virtual void resetPositionsUpToDate();
127 virtual void resetVelocitiesUpToDate();
128 virtual void resetJacobiansUpToDate();
129 virtual void resetGyroscopicAccelerationsUpToDate();
130 virtual void updatePositions() { parent->updatePositions(
this); updPos =
false; }
131 virtual void updateVelocities() { parent->updateVelocities(
this); updVel =
false; }
132 virtual void updateAccelerations() { parent->updateAccelerations(
this); updAcc =
false; }
133 virtual void updateJacobians(
int j=0) { parent->updateJacobians(
this,j); updJac[j] =
false; }
134 virtual void updateGyroscopicAccelerations() { parent->updateGyroscopicAccelerations(
this); updGA =
false; }
157 fmatvec::Vec3
WvP, WomegaP;
162 fmatvec::Mat3xV
WJP[3], WJR[3];
174 std::shared_ptr<OpenMBV::Frame> openMBVFrame;
basic class of MBSim mainly for plotting
Definition: element.h:56
InitStage
The stages of the initialization.
Definition: element.h:62
std::string path
The path of this object. Is set during the init stage reorganizeHierarchy. Before this the path is ca...
Definition: element.h:267
std::string name
name of element
Definition: element.h:260
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
void createPlotGroup() override
creates the plotGroup for H5-output
Definition: frame.cc:159
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: frame.cc:90
int hSize[2]
size and index of right hand side
Definition: frame.h:142
Frame(const std::string &name="dummy")
constructor
Definition: frame.cc:48
fmatvec::SqrMat3 AWP
transformation matrix in inertial frame of reference
Definition: frame.h:152
void plot() override
plots time dependent data
Definition: frame.cc:59
fmatvec::Vec3 WrOP
position of coordinate system in inertial frame of reference
Definition: frame.h:147
fmatvec::Vec3 WaP
acceleration and angular acceleration of coordinate system in inertial frame of reference
Definition: frame.h:172
~Frame() override=default
destructor
fmatvec::Vec3 WvP
velocity and angular velocity of coordinate system in inertial frame of reference
Definition: frame.h:157
fmatvec::Vec3 WjP
Definition: frame.h:167
fmatvec::Mat3xV WJP[3]
Jacobians of translation and rotation from coordinate system to inertial frame.
Definition: frame.h:162
namespace MBSim
Definition: bilateral_constraint.cc:30