FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
EnvironmentQuantityField.h
1#pragma once
2
8#include <fhsim_environment/ScalarField.h>
9#include <marenv/EnvironmentFacade.h>
10#include <string>
11#include <array>
12
13namespace environment
14{
15class EnvironmentProvider;
16}
17
18namespace util
19{
20
22enum class FieldQuantity
23{
24 Speed,
25 Component,
26 Deficit,
27 Pressure,
29 Elevation,
30 Scalar,
31};
32
40
43
50
58class EnvironmentQuantityField : public environment::field::ScalarField
59{
60public:
69 EnvironmentQuantityField(environment::EnvironmentProvider& environment, FieldQuantity quantity, const marenv::WaterVelocityParts& terms, const double axis[3]);
70
78 marenv::Status GetValue(double time, const double position[3], double& value) const override;
79
86 void GetValues(double time, std::span<const std::array<double, 3>> positions, std::span<double> values, std::span<marenv::Status> statuses) const override;
87
89 [[nodiscard]] bool IsThreadSafe() const override { return true; }
90
91private:
93 [[nodiscard]] double Reduce(const double velocity[3]) const;
94
95 environment::EnvironmentProvider& m_environment;
96 FieldQuantity m_quantity;
98 double m_axis[3];
99};
100
101} // namespace util
Definition EnvironmentQuantityField.h:59
void GetValues(double time, std::span< const std::array< double, 3 > > positions, std::span< double > values, std::span< marenv::Status > statuses) const override
EnvironmentQuantityField(environment::EnvironmentProvider &environment, FieldQuantity quantity, const marenv::WaterVelocityParts &terms, const double axis[3])
marenv::Status GetValue(double time, const double position[3], double &value) const override
bool IsThreadSafe() const override
True: the marenv fields allow concurrent readers.
Definition EnvironmentQuantityField.h:89
Status
Definition marenv.h:44
Utility functions for reading Environment parameters from XML.
Definition BathymetryDiagnostics.h:16
marenv::WaterVelocityParts ParseVelocityTerms(const std::string &text)
FieldQuantity
The quantity a field visualiser shows, its Quantity parameter.
Definition EnvironmentQuantityField.h:23
@ Elevation
Surface elevation of the waves at the point's x, y [m].
@ TotalPressure
Total pressure of the waves [Pa].
@ Component
Velocity of the selected parts along Axis [m/s].
@ Speed
Magnitude of the velocity of the selected parts (Terms) [m/s].
@ Pressure
Dynamic pressure of the waves [Pa].
@ Deficit
Combined deficit d_tot in [0, 1] of the registered wake fields; jets left out.
@ Scalar
A registered scalar field, FieldName.
bool IsVelocity(FieldQuantity quantity)
Whether the quantity is a velocity, the sum of Terms (Speed, Component).
bool ChangesWithWakesOnly(FieldQuantity quantity, const marenv::WaterVelocityParts &terms)
Definition WaterVelocity.h:33