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

#include <DepthAxis.h>

Public Member Functions

 DepthAxis (std::vector< double > depths)
 
DepthInterval Locate (double z) const
 
const std::vector< double > & Depths () const
 The layer depths.
 
std::size_t Size () const
 Number of layers, at least 2.
 

Detailed Description

Layer depths of a depth profile, validated: finite, at least two, strictly increasing (owner ruling R122, MENV-0053).

Shared by the depth profiles of marenv (DepthProfile, DepthVaryingCurrentField, the depth axis of CurrentField3DArray), so that every profile accepts the same layers and ends the same way: linear between layers, clamped to the first or the last layer outside them with Status::OUT_OF_RANGE_INACCURATE.

Constructor & Destructor Documentation

◆ DepthAxis()

marenv::calc::DepthAxis::DepthAxis ( std::vector< double >  depths)
explicit
Parameters
[in]depthsLayer depths, m (or any vertical coordinate), strictly increasing.
Exceptions
std::invalid_argumentfor fewer than two layers, a depth that is not finite, or depths that do not strictly increase.

Member Function Documentation

◆ Locate()

DepthInterval marenv::calc::DepthAxis::Locate ( double  z) const

Returns the interval of z and the weight of its deeper layer.

Parameters
[in]zDepth, in the measure of the layers.
Returns
For depths[0] <= z <= depths.back() the interval with depths[upper] <= z, the last one at the deepest layer, weight (z - depths[upper]) / (depths[upper + 1] - depths[upper]) and Status::OK, so a layer depth gives the layer's value; above the first layer (z < depths[0]) upper 0 and weight 0, below the last layer upper Size() - 2 and weight 1, both with Status::OUT_OF_RANGE_INACCURATE; for a NaN z upper 0, weight 0 and Status::ERROR_NOT_SET.

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