FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
AttractorNetBin.h
1
9
10#pragma once
11
12#include <functional>
13#include <string>
14
16{
17public:
19 struct Motion
20 {
21 double pos[3] = {0.0, 0.0, 0.0};
22 double vel[3] = {0.0, 0.0, 0.0};
23 double relStrength = 1.0;
24 };
25
27 using PosAndVelSource = std::function<void(double T, const double* X, double pos[3], double vel[3])>;
28
30 using StrengthSource = std::function<double(double T)>;
31
32 void SetParams(const double radius, const double springStiffness, const double damping);
33
36
39
44 Motion MotionAt(double T, const double* X) const;
45
51 void AddForce(const Motion& motion, double* const adForce, const double* const adNodePos, const double* const adNodeVel) const;
52
54 bool Contains(const Motion& motion, const double* const adNodePos) const;
55
56private:
57 double m_radius = 0.0;
58 double m_springStiffness = 0.0;
59 double m_damping = 0.0;
60 PosAndVelSource m_posAndVel;
61 StrengthSource m_strength;
62};
63
64class ISimObjectCreator;
65
71AttractorNetBin& FindAttractor(ISimObjectCreator* creator, const std::string& objectName, const std::string& parameter, const std::string& name);
The net bin of Seine/Vessel: a sphere that pulls the net and warp nodes inside it.
Definition AttractorNetBin.h:16
void AddForce(const Motion &motion, double *const adForce, const double *const adNodePos, const double *const adNodeVel) const
void SetPosAndVelSource(PosAndVelSource source)
Sets what moves the attractor (Seine/Vessel, when it creates it).
bool Contains(const Motion &motion, const double *const adNodePos) const
Whether adNodePos lies strictly inside the radius.
Motion MotionAt(double T, const double *X) const
std::function< double(double T)> StrengthSource
Gives the attractor's relative strength at time T.
Definition AttractorNetBin.h:30
void SetStrengthSource(StrengthSource source)
Sets what scales the attractor's pull (Seine/Operation, in its FinalSetup).
std::function< void(double T, const double *X, double pos[3], double vel[3])> PosAndVelSource
Gives the attractor's position and velocity at (T, X), X the model-global states.
Definition AttractorNetBin.h:27
Where the attractor is, how fast it moves, and how strongly it pulls.
Definition AttractorNetBin.h:20