FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
marenv::current::CurrentField Class Referenceabstract

Defines the interface for a field relaying information about ocean currents.

#include <CurrentField.h>

+ Inheritance diagram for marenv::current::CurrentField:
+ Collaboration diagram for marenv::current::CurrentField:

Public Member Functions

virtual ~CurrentField ()=default
 Virtual destructor.
 
virtual Status GetCurrent (double time, const double position[3], double currentVelocity[3])=0
 

Member Function Documentation

◆ GetCurrent()

virtual Status marenv::current::CurrentField::GetCurrent ( double  time,
const double  position[3],
double  currentVelocity[3] 
)
pure virtual

Return the ocean current velocity in a given position and time.

Parameters
[in]timeTime stamp in simulation time.
[in]positionThe position to query for.
[out]currentVelocityThe velocity of the ocean current in the given time and position.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Threading contract, for every implementation: GetCurrent() may be called from several threads at once (a visualiser sampling in parallel while the simulation waits), so it must not change the field's state; it is non-const for historical reasons only. A field may read state the simulation writes between steps, so it need not be safe against a writer. Registration (EnvironmentFacade::AddCurrentField()) happens during setup.

Order rule (owner ruling D46): the answer depends only on time, position and state that is fixed during a step. A field that depends on simulation state (a propeller jet that follows its propeller) reads its own copy of that state, written between steps (for example in AcceptedStep), never members that port functions or OdeFcn write during the step. Such a field lags the simulation by one step, the same for any number of threads.

Implemented in VirtualCurrentField, artificial::VirtualCurrentField, VirtualCurrentFieldInDir, marenv::current::NullCurrentField, Ship::PropulsorWakeField< State >, marenv::current::ConstantCurrent, marenv::current::CurrentField3DArray, and marenv::current::DepthVaryingCurrentField.


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