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