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
12namespace environment
13{
14class EnvironmentProvider;
15}
16
17namespace util
18{
19
21enum class FieldQuantity
22{
23 Speed,
24 Component,
25 Deficit,
26 Pressure,
28 Elevation,
29 Scalar,
30};
31
39
42
49
57class EnvironmentQuantityField : public environment::field::ScalarField
58{
59public:
68 EnvironmentQuantityField(environment::EnvironmentProvider& environment, FieldQuantity quantity, const marenv::WaterVelocityParts& terms, const double axis[3]);
69
77 marenv::Status GetValue(double time, const double position[3], double& value) const override;
78
85 void GetValues(double time, std::span<const std::array<double, 3>> positions, std::span<double> values, std::span<marenv::Status> statuses) const override;
86
88 [[nodiscard]] bool IsThreadSafe() const override { return true; }
89
90private:
92 [[nodiscard]] double Reduce(const double velocity[3]) const;
93
94 environment::EnvironmentProvider& m_environment;
95 FieldQuantity m_quantity;
97 double m_axis[3];
98};
99
100} // namespace util
Definition EnvironmentQuantityField.h:58
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:88
Status
Definition marenv.h:40
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:22
@ 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