FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Dynamics.h
1#pragma once
2
8#include "Random.h"
9
10#include <array>
11#include <fhsim_environment/AggregationField.h>
12#include <fhsim_environment/AggregationSpec.h>
13#include <string>
14#include <vector>
15
16namespace environment::field::aggregation
17{
18
23struct Member
24{
25 Aggregation shape;
26 VerticalReference reference = VerticalReference::Surface;
27 double height = 0.0;
28 std::array<double, 3> velocity {0.0, 0.0, 0.0};
29};
30
39double Reflect(double x, double low, double high, bool& flipped);
40
43{
44 std::vector<std::array<double, 2>> centres;
45 std::vector<std::size_t> indices;
46};
47
57std::vector<Member> Generate(const AggregationSpec& spec, Random& random, const DepthFunction& depth, PatchStructure* patches = nullptr);
58
60void DrawVelocities(std::vector<Member>& members, const AggregationSpec& spec, Random& random);
61
71bool Step(std::vector<Member>& members, const AggregationSpec& spec, Random& random, const DepthFunction& depth);
72
77std::vector<Member> ReadState(const std::string& path);
78
80void PlaceOnSeabed(std::vector<Member>& members, const DepthFunction& depth);
81
83void WriteState(const std::string& path, const std::vector<Member>& members);
84
85} // namespace environment::field::aggregation
One random stream. Not thread-safe.
Definition Random.h:22
std::array< double, 3 > velocity
{north, east, down} [m/s].
Definition Dynamics.h:28
double height
Height above the seabed [m], positive up. Used for the seabed reference.
Definition Dynamics.h:27
The patch centres of the Thomas process and the patch each aggregation was drawn around (D15).
Definition Dynamics.h:43
std::vector< std::array< double, 2 > > centres
{north, east} [m].
Definition Dynamics.h:44
std::vector< std::size_t > indices
Per aggregation, an index into centres.
Definition Dynamics.h:45