FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Sphere.h
1#ifndef CSphere_h__
2#define CSphere_h__
3
87#include "SphereBase.h"
88
89#include <fhsim/simobject/SimObject.h>
90#include <fhsim_environment/BodyFlowInteraction.h>
91#include <fhsim_environment/hydrodynamics/SphereHydro.h>
92
93#include <optional>
94
95class Sphere : public SimObject
96{
97
98public:
99 Sphere(std::string SimObjectName, ISimObjectCreator* Creator);
100 ~Sphere() override;
101 void OdeFcn(const double T, const double* const X, double* const XDot) const;
102 void FinalSetup(const double T, const double* const X, ISimObjectCreator* const Creator);
104 void PreOdeFcn(double T, const double* X, IStateUpdater* updater) override;
105 const double* Position(const double T, const double* const X);
106 const double* Velocity(const double T, const double* const X);
107
108 bool HasJacobians() const override;
109 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
110 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
111
113 const environment::wake::BodyWake* Wake() const { return m_flow.Wake(); }
114
115private:
116 ISignalPort* m_IForce;
117
118 int m_PosIdx;
119 int m_VelIdx;
120
121 double m_sphereD;
122 double m_sphereMass;
123 double m_Rho;
124 double m_lift;
125 double m_inertia;
126
128 const environment::sphere_hydro::Sphere& Shape() const { return m_caster->Shape(); }
129
130 std::optional<environment::sphere_hydro::SphereCaster> m_caster;
131 environment::wake::BodyFlowInteraction m_flow;
132
133#ifdef FH_VISUALIZATION
134public:
135 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
136 void RenderUpdate(const double dT, const double* const adX);
137
138private:
139 Ogre::SceneNode* m_Node;
140 Ogre::Entity* m_Entity;
141 Ogre::String m_Material;
142 std::string m_SphereMesh;
143#endif
144};
145#endif // CSphere_h__
Definition Sphere.h:96
void PreOdeFcn(double T, const double *X, IStateUpdater *updater) override
With CastWake: rebuilds the wake when due.
const environment::wake::BodyWake * Wake() const
The wake: null without an Environment or before FinalSetup.
Definition Sphere.h:113