FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WakeGroupCaster.h
1#pragma once
2
13#include <fhsim/ISimObjectLogger.h>
14#include <fhsim_environment/WakeCaster.h>
15#include <fhsim_environment/WakeSourceSet.h>
16#include <limits>
17#include <memory>
18#include <string>
19#include <vector>
20
21namespace environment
22{
23class EnvironmentProvider;
24} // namespace environment
25
26namespace environment::wake::detail
27{
28
54class WakeGroupCaster final : public IndexedWakeCastingObject
55{
56public:
61 WakeGroupCaster(std::string name, const SourceSetWakeSettings& settings, ISimObjectLogger& logger);
62 ~WakeGroupCaster() override;
63
68 void Register(EnvironmentProvider& environment);
69
78 int Join(const std::string& member, double rho);
79
87 void Attach(int member, const WakeCastingObject& body, double T);
88
97 void Update(double T, const double* X);
98
102 const WakeCaster* Caster() const { return m_caster.get(); }
104 const std::string& Name() const { return m_name; }
106 const SourceSetWakeSettings& Settings() const { return m_settings; }
107
109 int NumBodies() const override { return static_cast<int>(m_members.size()); }
111 WakeCastState Body(const double* X, int body) const override { return m_bodies[body]->Reference(X); }
113 double BodyRadius(int body) const override { return m_bodies[body]->Radius(); }
115 SourceLoad BodyLoad(const double* X, int body, const double bodyVel[3], const double waterVel[3]) const override { return m_bodies[body]->BodyLoad(X, bodyVel, waterVel); }
116
117private:
119 void LogNoMembers(double T);
121 void LogMembersWithoutABody(double T);
123 std::string MembersWithoutABody() const;
124
125 std::string m_name;
126 SourceSetWakeSettings m_settings;
127 ISimObjectLogger& m_logger;
128 EnvironmentProvider* m_environment = nullptr;
129 std::unique_ptr<WakeCaster> m_caster;
130 double m_rho = 0.0;
131 std::vector<std::string> m_members;
132 std::vector<const WakeCastingObject*> m_bodies;
133 double m_completeAt = std::numeric_limits<double>::quiet_NaN();
134 double m_lastUpdate = std::numeric_limits<double>::quiet_NaN();
135 double m_firstUpdate = std::numeric_limits<double>::quiet_NaN();
136 bool m_noMembersLogged = false;
137 bool m_membersWithoutABodyLogged = false;
138};
139
140} // namespace environment::wake::detail
Definition WakeGroupCaster.h:55
double BodyRadius(int body) const override
The member body's Radius().
Definition WakeGroupCaster.h:113
const std::string & Name() const
The group's name.
Definition WakeGroupCaster.h:104
void Register(EnvironmentProvider &environment)
const WakeCaster * Caster() const
The caster; null before the first Join().
Definition WakeGroupCaster.h:102
const SourceSetWakeSettings & Settings() const
The group's wake parameters.
Definition WakeGroupCaster.h:106
WakeGroupCaster(std::string name, const SourceSetWakeSettings &settings, ISimObjectLogger &logger)
int NumBodies() const override
Number of members.
Definition WakeGroupCaster.h:109
marenv::wake::WakeQuery Query() const
The members' query: the group's lumped field skipped, its private field composed in; empty before the...
void Attach(int member, const WakeCastingObject &body, double T)
SourceLoad BodyLoad(const double *X, int body, const double bodyVel[3], const double waterVel[3]) const override
The member body's BodyLoad().
Definition WakeGroupCaster.h:115
void Update(double T, const double *X)
WakeCastState Body(const double *X, int body) const override
The member body's Reference().
Definition WakeGroupCaster.h:111
int Join(const std::string &member, double rho)
Definition WakeRegistry.h:24