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