FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
TrawlRig.h
1#pragma once
2
22#include "DoorAndClumpWakeBodies.h"
23#include "TrawlCableConstraintSets.h"
24
25#include <fhsim/simobject/ISimObjectCreator.h>
26#include <fhsim_coribo/ConstraintSolver.h>
27#include <fhsim_environment/BodyWake.h>
28#include <fhsim_environment/EnvironmentProvider.h>
29#include <memory>
30#include <optional>
31#include <string>
32
33class ITrawlCable;
34
35namespace trawl_mooring
36{
40inline bool TakesSymplecticStep(const std::string& method)
41{
42 return method == "Euler_i" || method == "Heun_i";
43}
44
54
57{
58public:
66 TrawlRig(const std::string& ownerName, double frequencyCoefficient, std::optional<double> collisionFrequencyCoefficient, ISimObjectCreator& creator);
67
69 TrawlRig(const std::string& ownerName, CoRiBoDynamics::ConstraintSolver& solver, double frequencyCoefficient, std::optional<double> collisionFrequencyCoefficient, ISimObjectCreator& creator);
70
71 ~TrawlRig();
72 TrawlRig(const TrawlRig&) = delete;
73 TrawlRig& operator=(const TrawlRig&) = delete;
74
76 const RigParts& Parts() const { return m_parts; }
77
79 void Register(ISimObjectCreator& creator);
80
82 void Register(environment::EnvironmentProvider& environment, ISimObjectCreator& creator);
83
85 void Step(double T, const double* X);
86
88 environment::wake::SourceSetBodyWake& BodyWake() { return *m_bodyWake; }
89
92
93private:
94 void Build(CoRiBoDynamics::ConstraintSolver& solver, std::optional<double> collisionFrequencyCoefficient, ISimObjectCreator& creator);
95
96 std::string m_ownerName;
97 RigParts m_parts;
98 std::unique_ptr<environment::wake::SourceSetBodyWake> m_bodyWake;
99 std::unique_ptr<CoRiBoDynamics::DoorAndClumpWakeBodies> m_wakeBodies;
100 bool m_ownsSolver = false;
101};
102
104bool OwnsRig(ISimObjectCreator& creator);
105
112ITrawlCable& JoinedRig(ISimObjectCreator& creator);
113} // namespace trawl_mooring
Definition DoorAndClumpWakeBodies.h:46
Definition TrawlCableConstraintSets.h:134
Definition TrawlCableConstraintSets.h:72
Definition TrawlCableConstraintSets.h:14
What a TrawlCable that owns a rig offers the cables that join it (a TrawlCable with TrawlCable,...
Definition ITrawlCable.h:18
The rig of the object that owns the solver (a TrawlCable without TrawlCable, or a RundDorg).
Definition TrawlRig.h:57
const RigParts & Parts() const
The solver and its shared parts.
Definition TrawlRig.h:76
TrawlRig(const std::string &ownerName, CoRiBoDynamics::ConstraintSolver &solver, double frequencyCoefficient, std::optional< double > collisionFrequencyCoefficient, ISimObjectCreator &creator)
Builds a rig on solver, which it does not own (test support).
environment::wake::SourceSetBodyWake & BodyWake()
The BodyWake of the doors and clump weights.
Definition TrawlRig.h:88
void Step(double T, const double *X)
The owner's PreOdeFcn at the step start T: the BodyWake's update over the doors and clump weights,...
CoRiBoDynamics::DoorAndClumpWakeBodies & WakeBodies()
The doors and clump weights as the BodyWake casts them.
Definition TrawlRig.h:91
void Register(environment::EnvironmentProvider &environment, ISimObjectCreator &creator)
Registration without an integrator (test support): the BodyWake on environment, then the environment ...
void Register(ISimObjectCreator &creator)
The owner's FinalSetup, after every cable has added its elements: the symplectic step from the integr...
TrawlRig(const std::string &ownerName, double frequencyCoefficient, std::optional< double > collisionFrequencyCoefficient, ISimObjectCreator &creator)
The parts of one constraint solver that every cable on it uses.
Definition TrawlRig.h:47
CoRiBoDynamics::ConstraintSolver * solver
6-DOF rigid body constrained dynamic solver.
Definition TrawlRig.h:48
CoRiBoDynamics::EnvironmentForces * environmentForces
Water, wake and seabed forces; owned by the solver.
Definition TrawlRig.h:51
CoRiBoDynamics::TrawlCableCollisionManager * collisions
Collision constraints; owned by the solver; null in a RundDorg rig.
Definition TrawlRig.h:50
double frequencyCoefficient
The owner's regulator frequency coefficient.
Definition TrawlRig.h:52
CoRiBoDynamics::TrawlCableJointConstraint * joints
Structural joint constraints; owned by the solver.
Definition TrawlRig.h:49