FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
HydroBall.h
1#ifndef HYDRO_BALL_H
2#define HYDRO_BALL_H
3
4#include "sfh/constants.h"
5#include "sfh/math.h"
6#include "sfh/text.h"
7#include "sfh/util.h"
8#include <string>
9
10#include <Eigen/Dense>
11
12#include <fhsim/simobject/SimObject.h>
13#include <fhsim_environment/hydrodynamics/SphereHydro.h>
14#include <memory>
15
81class HydroBall : public SimObject
82{
83 public:
84 HydroBall(const std::string& simObjectName, ISimObjectCreator* const creator);
85 void OdeFcn(const double T, const double* const X, double* const XDot) const;
86
87 bool HasJacobians() const override;
88 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
89 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
90
91 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
92
93#ifdef FH_VISUALIZATION
94 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
95 void RenderUpdate(const double T, const double* const X);
96#endif
97
98 protected:
99 void SetOutputPortValues(const double T, const double* const X) const;
100 const double* Position(const double T, const double* const X);
101 const double* Velocity(const double T, const double* const X);
102
103 ICommonComputation* m_SetOutputPortValues;
104 ISignalPort* m_ForceExt;
105 ISignalPort* m_Current;
106 int m_PositionIndex, m_VelocityIndex;
107 mutable double m_Position[3];
108 mutable double m_Velocity[3];
109
110 double m_Mass, m_Radius, m_RhoBall;
111 environment::sphere_hydro::Sphere m_Sphere;
112
113#ifdef FH_VISUALIZATION
114 Ogre::SceneNode* m_RenderNode;
115 std::string m_MaterialName;
116 std::string m_MeshName;
117 double m_Scale;
118#endif
119};
120
121#endif
Definition HydroBall.h:82
environment::sphere_hydro::Sphere m_Sphere
The ball as the environment's sphere law sees it: default density and Cd.
Definition HydroBall.h:111