FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
marenv::calc::DepthProfile Class Reference

#include <DepthProfile.h>

Public Member Functions

 DepthProfile (std::vector< double > depths, std::vector< double > values)
 
Status Evaluate (double z, double &value) const
 
const DepthAxis & Axis () const
 The depth axis.
 
const std::vector< double > & Values () const
 The value at each layer.
 

Detailed Description

One quantity tabulated at depth layers: linear between the layers, clamped at both ends (owner ruling R122, MENV-0053).

Outside the layers the value is that of the nearest layer, with Status::OUT_OF_RANGE_INACCURATE, a usable value (marenv::IsUsable()); a current of zero below the deepest layer, or a linear extrapolation above the first, would be a guess with no data behind it.

Example usage:

const marenv::calc::DepthProfile temperature({0.0, 50.0, 200.0}, {12.0, 8.0, 6.5});
double value = 0.0;
marenv::Status status = temperature.Evaluate(25.0, value); // 10.0, OK
status = temperature.Evaluate(300.0, value); // 6.5, OUT_OF_RANGE_INACCURATE
Definition DepthProfile.h:28
Status Evaluate(double z, double &value) const
Status
Definition marenv.h:40

Constructor & Destructor Documentation

◆ DepthProfile()

marenv::calc::DepthProfile::DepthProfile ( std::vector< double >  depths,
std::vector< double >  values 
)
Parameters
[in]depthsLayer depths, strictly increasing (DepthAxis).
[in]valuesThe value at each layer, finite.
Exceptions
std::invalid_argumentas DepthAxis, and if the sizes differ or a value is not finite.

Member Function Documentation

◆ Evaluate()

Status marenv::calc::DepthProfile::Evaluate ( double  z,
double &  value 
) const

Returns the value at a depth.

Parameters
[in]zDepth, in the measure of the layers.
[out]valueThe interpolated value (DepthAxis::Locate(), DepthInterval::Interpolate()); 0 for Status::ERROR_NOT_SET.
Returns
Status::OK inside the layers and at every layer depth (the layer's value); Status::OUT_OF_RANGE_INACCURATE above the first or below the last layer (the value clamped to it); Status::ERROR_NOT_SET for a NaN z.

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