24 #include "mbsim/utils/function.h"
26 #ifdef HAVE_OPENMBVCPPINTERFACE
34 class GeneralizedForceLaw;
35 class GeneralizedImpactLaw;
38 namespace MBSimHydraulics {
47 bool considerVolumeChange;
55 bool considerVolumeChange;
63 virtual std::string getType()
const {
return "HNodeMec"; }
65 #ifdef HAVE_OPENMBVCPPINTERFACE
66 void enableOpenMBVArrows(
double size=1.);
69 void setInitialVolume(
double V0_) {V0=V0_; }
70 unsigned int addTransMecArea(MBSim::Frame * f, fmatvec::Vec fN,
double area,
bool considerVolumeChange=
true);
71 unsigned int addRotMecArea(MBSim::Frame * f, fmatvec::Vec fN,
double area, MBSim::Frame * frameOfReference,
bool considerVolumeChange=
true);
72 void setTransMecArea(
unsigned int i,
double area) {connectedTransFrames[i].area=area; }
74 void calcxSize() {xSize=1; }
76 void init(MBSim::InitStage stage);
77 void initializeUsingXML(TiXmlElement *element);
79 virtual void updateWRef(
const fmatvec::Mat& Wref,
int i=0);
80 virtual void updateVRef(
const fmatvec::Mat& Vref,
int i=0);
81 virtual void updatehRef(
const fmatvec::Vec& href,
int i=0);
82 virtual void updatedhdqRef(
const fmatvec::Mat& dhdqRef,
int i=0);
83 virtual void updatedhduRef(
const fmatvec::SqrMat& dhduRef,
int i=0);
84 virtual void updatedhdtRef(
const fmatvec::Vec& dhdtRef,
int i=0);
85 virtual void updaterRef(
const fmatvec::Vec& ref,
int i=0);
87 void updateh(
double t,
int j=0);
88 void updatedhdz(
double t);
89 virtual void updater(
double t,
int j=0);
90 void updategd(
double t);
91 void updatexd(
double t);
92 void updatedx(
double t,
double dt);
94 void plot(
double t,
double dt);
97 std::vector<connectedTransFrameStruct> connectedTransFrames;
98 std::vector<connectedRotFrameStruct> connectedRotFrames;
99 double QMecTrans, QMecRot, QMec;
101 unsigned int nTrans, nRot;
102 #ifdef HAVE_OPENMBVCPPINTERFACE
103 std::vector<OpenMBV::Arrow *> openMBVArrows;
104 double openMBVArrowSize;
108 std::vector<std::string> saved_translatorial_frameOfReference, saved_rotatorial_frameOfReference, saved_rotatorial_frameOfRotationCenter;
109 std::vector<fmatvec::Vec> saved_translatorial_normal, saved_rotatorial_normal;
110 std::vector<double> saved_translatorial_area, saved_rotatorial_area;
111 std::vector<bool> saved_translatorial_noVolumeChange, saved_rotatorial_noVolumeChange;
119 virtual std::string getType()
const {
return "ConstrainedNodeMec"; }
121 void setpFunction(MBSim::Function1<double,double> * pFun_) {pFun=pFun_; }
123 void init(MBSim::InitStage stage);
124 void initializeUsingXML(TiXmlElement *element);
126 void updateg(
double t);
129 MBSim::Function1<double,double> * pFun;
137 virtual std::string getType()
const {
return "EnvironmentNodeMec"; }
139 void init(MBSim::InitStage stage);
148 virtual std::string getType()
const {
return "ElasticNode"; }
150 void setFracAir(
double fracAir_) {fracAir=fracAir_; }
151 void setp0(
double p0_) {p0=p0_; }
153 void calcxSize() {xSize=2; }
155 void init(MBSim::InitStage stage);
156 void initializeUsingXML(TiXmlElement *element);
158 void updatexRef(
const fmatvec::Vec &xParent);
160 void updatexd(
double t);
161 void updatedx(
double t,
double dt);
163 void plot(
double t,
double dt);
180 virtual std::string getType()
const {
return "RigidNodeMec"; }
182 bool isSetValued()
const {
return true; }
183 bool isActive()
const {
return true; }
185 void calclaSize(
int j) {laSize=1; }
187 void calcrFactorSize(
int j) {rFactorSize=1; }
189 void init(MBSim::InitStage stage);
191 void updatewbRef(
const fmatvec::Vec& wbParent);
193 void updategd(
double t);
194 void updateW(
double t,
int j=0);
196 void updaterFactors();
197 void solveImpactsFixpointSingle(
double dt);
198 void solveConstraintsFixpointSingle();
199 void solveImpactsGaussSeidel(
double dt);
200 void solveConstraintsGaussSeidel();
201 void solveImpactsRootFinding(
double dt);
202 void solveConstraintsRootFinding();
203 void jacobianImpacts();
204 void jacobianConstraints();
205 void checkImpactsForTermination(
double dt);
206 void checkConstraintsForTermination();
209 MBSim::GeneralizedForceLaw * gfl;
210 MBSim::GeneralizedImpactLaw * gil;