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 <memory>
13
78class HydroBall : public SimObject
79{
80 public:
81 HydroBall(const std::string& simObjectName, ISimObjectCreator* const creator);
82 void OdeFcn(const double T, const double* const X, double* const XDot) const;
83
84 bool HasJacobians() const override;
85 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
86 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
87
88 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
89
90#ifdef FH_VISUALIZATION
91 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
92 void RenderUpdate(const double T, const double* const X);
93#endif
94
95 protected:
96 void SetOutputPortValues(const double T, const double* const X) const;
97 const double* Position(const double T, const double* const X);
98 const double* Velocity(const double T, const double* const X);
99
100 ICommonComputation* m_SetOutputPortValues;
101 ISignalPort* m_ForceExt;
102 ISignalPort* m_Current;
103 int m_PositionIndex, m_VelocityIndex;
104 mutable double m_Position[3];
105 mutable double m_Velocity[3];
106
107 double m_Mass, m_Radius, m_DragCoef, m_RhoWater, m_RhoBall;
108
109#ifdef FH_VISUALIZATION
110 Ogre::SceneNode* m_RenderNode;
111 std::string m_MaterialName;
112 std::string m_MeshName;
113 double m_Scale;
114#endif
115};
116
117#endif
Definition HydroBall.h:79