FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
util::EnvironmentQuantityField Class Reference

#include <EnvironmentQuantityField.h>

+ Inheritance diagram for util::EnvironmentQuantityField:
+ Collaboration diagram for util::EnvironmentQuantityField:

Public Member Functions

 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
 
void GetValues (double time, std::span< const std::array< double, 3 > > positions, std::span< double > values, std::span< marenv::Status > statuses) const override
 
bool IsThreadSafe () const override
 True: the marenv fields allow concurrent readers.
 

Detailed Description

A quantity of the environment (any FieldQuantity but Scalar) as an unregistered scalar field.

So the baking of util::BakeScalarField serves the flow, the waves and the wakes as it serves the registered scalar fields. Thread-safe by the reader contract of the marenv fields (CurrentField::GetCurrent(), WaveField, WakeField::Sample()): the visualisers sample it in parallel while the simulation waits. Never time-invariant.

Constructor & Destructor Documentation

◆ EnvironmentQuantityField()

util::EnvironmentQuantityField::EnvironmentQuantityField ( environment::EnvironmentProvider &  environment,
FieldQuantity  quantity,
const marenv::WaterVelocityParts &  terms,
const double  axis[3] 
)

Construct the field.

Parameters
[in]environmentEnvironment sampled; must outlive the field.
[in]quantityQuantity to sample; not Scalar.
[in]termsThe velocity parts of Speed and Component; ignored otherwise.
[in]axisDirection of Component, normalised here; ignored otherwise.
Exceptions
std::invalid_argumentfor Scalar, or for Component with a zero axis.

Member Function Documentation

◆ GetValue()

marenv::Status util::EnvironmentQuantityField::GetValue ( double  time,
const double  position[3],
double &  value 
) const
override

The quantity at a point.

Parameters
[in]timeSimulation time [s].
[in]positionPosition in the NED frame [m].
[out]valueThe quantity.
Returns
The status of the environment's query; Deficit is always OK.

◆ GetValues()

void util::EnvironmentQuantityField::GetValues ( double  time,
std::span< const std::array< double, 3 > >  positions,
std::span< double >  values,
std::span< marenv::Status >  statuses 
) const
override

The quantity at many points: GetValue() at each, bit for bit, the wake and jet fields loaded once per call.

Speed, Component and Deficit go through the environment's batch queries (marenv::EnvironmentFacade::GetWaterVelocities(), EnvironmentProvider::GetWakeDeficits()); the wave quantities point by point.


The documentation for this class was generated from the following file: