23 #include "mbsim/links/link.h"
24 #include <mbsim/functions/function.h>
26 #include <mbsim/utils/boost_parameters.h>
27 #include <mbsim/utils/openmbv_utils.h>
34 class GeneralizedForceLaw;
35 class GeneralizedImpactLaw;
38 namespace MBSimHydraulics {
40 BOOST_PARAMETER_NAME(size)
41 BOOST_PARAMETER_NAME(minimalPressure)
42 BOOST_PARAMETER_NAME(maximalPressure)
43 BOOST_PARAMETER_NAME(position)
58 HNode(
const std::string &name);
60 void calcSize()
override;
62 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBVSphere, tag, (optional (size,(
double),1)(minimalPressure,(
double),0e5)(maximalPressure,(
double),10e5)(position,(
const fmatvec::Vec3&),fmatvec::Vec3()))) {
63 enableOpenMBV(size,minimalPressure,maximalPressure,position);
65 virtual void enableOpenMBV(
double size,
double pMin,
double pMax,
const fmatvec::Vec3 &WrON);
67 void addInFlow(
HLine * in);
68 void addOutFlow(
HLine * out);
70 void calcgdSize(
int j)
override {gdSize=1; }
72 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
74 void updateWRef(
const fmatvec::Mat& WRef,
int i=0)
override;
75 void updateVRef(
const fmatvec::Mat& VRef,
int i=0)
override;
76 void updatehRef(
const fmatvec::Vec& hRef,
int i=0)
override;
77 void updaterRef(
const fmatvec::Vec& rRef,
int i=0)
override;
78 void updatedhdqRef(
const fmatvec::Mat& dhdqRef,
int i=0);
80 void updatedhdtRef(
const fmatvec::Vec& dhdtRef,
int i=0);
82 double evalQHyd() {
if(updQHyd) updateQHyd();
return QHyd; }
83 double getQHyd(
bool check=
true)
const { assert((not check) or (not updQHyd));
return QHyd; }
84 virtual void updateQHyd();
86 void updateh(
int j=0)
override;
88 void updategd()
override;
89 bool isActive()
const override {
return false; }
90 bool gActiveChanged()
override {
return false; }
94 void initializeUsingXML(xercesc::DOMElement *element)
override;
96 void resetUpToDate()
override { MBSim::Link::resetUpToDate(); updQHyd =
true; }
99 std::vector<connectedLinesStruct> connectedLines;
100 std::vector<connectedLinesStruct> connected0DOFLines;
101 std::vector<std::string> refInflowString;
102 std::vector<std::string> refOutflowString;
106 std::shared_ptr<OpenMBV::Group> openMBVGrp;
107 std::shared_ptr<OpenMBV::Sphere> openMBVSphere;
120 pFun->setParent(
this);
124 void updateGeneralizedForces()
override;
125 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
126 void initializeUsingXML(xercesc::DOMElement *element)
override;
127 bool isSingleValued()
const override {
return true;}
139 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
141 bool isSingleValued()
const override {
return true;}
151 void setVolume(
double V_) {V=V_; }
152 void setFracAir(
double fracAir_) {fracAir=fracAir_; }
153 void setp0(
double p0_) {p0=p0_; }
155 void calcxSize()
override {xSize=1; }
157 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
158 void initializeUsingXML(xercesc::DOMElement *element)
override;
160 void updateGeneralizedForces()
override;
162 void updatexd()
override;
164 void plot()
override;
166 bool isSingleValued()
const override {
return true;}
182 bool isSetValued()
const override {
return true; }
183 bool isActive()
const override {
return true; }
185 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
187 void calclaSize(
int j)
override {laSize=1; }
189 void calcrFactorSize(
int j)
override {rFactorSize=1; }
191 void updateGeneralizedForces()
override;
193 void updategd()
override;
194 void updateW(
int j=0)
override;
196 void updaterFactors()
override;
197 void solveImpactsFixpointSingle()
override;
198 void solveConstraintsFixpointSingle()
override;
199 void solveImpactsGaussSeidel()
override;
200 void solveConstraintsGaussSeidel()
override;
201 void solveImpactsRootFinding()
override;
202 void solveConstraintsRootFinding()
override;
203 void jacobianImpacts()
override;
204 void jacobianConstraints()
override;
205 void checkImpactsForTermination()
override;
206 void checkConstraintsForTermination()
override;
207 const double& evalgdn();
208 const double& evalgdd();
222 void setCavitationPressure(
double pCav_) {pCav=pCav_; }
224 bool isSetValued()
const override {
return true; }
225 bool isSingleValued()
const override {
return true; }
226 bool isActive()
const override {
return active; }
228 void calcxSize()
override {xSize=1; }
229 void calcgSize(
int j)
override {gSize=1; }
231 void calclaSize(
int j)
override {laSize=1; }
233 void calcrFactorSize(
int j)
override {rFactorSize=1; }
234 void calcsvSize()
override {svSize=1; }
236 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
237 void initializeUsingXML(xercesc::DOMElement *element)
override;
238 void plot()
override;
240 void checkActive(
int j)
override;
242 bool gActiveChanged()
override;
244 void updateGeneralizedForces()
override;
245 void updateg()
override;
246 void updateW(
int j=0)
override;
247 void updatexd()
override;
248 void updateStopVector()
override;
249 void checkRoot()
override;
251 void updaterFactors()
override;
252 void solveImpactsFixpointSingle()
override;
253 void solveConstraintsFixpointSingle()
override;
254 void solveImpactsGaussSeidel()
override;
255 void solveConstraintsGaussSeidel()
override;
256 void solveImpactsRootFinding()
override;
257 void solveConstraintsRootFinding()
override;
258 void jacobianImpacts()
override;
259 void jacobianConstraints()
override;
260 void checkImpactsForTermination()
override;
261 void checkConstraintsForTermination()
override;
262 const double& evalgdn();
263 const double& evalgdd();
268 bool active, active0;
280 void setpFunction(
MBSim::Function<
double(
double)> *pFunction_) { pFunction=pFunction_; }
282 void init(InitStage stage,
const MBSim::InitConfigSet &config)
override;
284 void updateGeneralizedForces()
override;
285 void initializeUsingXML(xercesc::DOMElement *element)
override;
Definition: environment.h:97