FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
DepthAxis.h
1#pragma once
4
5#include <marenv/marenv.h>
6
7#include <cstddef>
8#include <vector>
9
10namespace marenv::calc
11{
20{
21 std::size_t upper;
22 double weight;
24
26 double Interpolate(const std::vector<double>& values) const { return values[upper] * (1 - weight) + values[upper + 1] * weight; }
27};
28
38{
39public:
42 explicit DepthAxis(std::vector<double> depths);
43
54 DepthInterval Locate(double z) const;
55
57 const std::vector<double>& Depths() const { return m_depths; }
58
60 std::size_t Size() const { return m_depths.size(); }
61
62private:
63 std::vector<double> m_depths;
64};
65} // namespace marenv::calc
Definition DepthAxis.h:38
DepthInterval Locate(double z) const
DepthAxis(std::vector< double > depths)
std::size_t Size() const
Number of layers, at least 2.
Definition DepthAxis.h:60
const std::vector< double > & Depths() const
The layer depths.
Definition DepthAxis.h:57
Status
Definition marenv.h:40
Definition DepthAxis.h:20
double weight
Weight of the deeper layer upper + 1, in [0, 1].
Definition DepthAxis.h:22
std::size_t upper
Index of the shallower layer of the interval, 0 to Size() - 2.
Definition DepthAxis.h:21
double Interpolate(const std::vector< double > &values) const
values[upper] (1 - weight) + values[upper + 1] weight; values has one entry per layer of the axis.
Definition DepthAxis.h:26
Status status
OK inside the axis and at its layers; OUT_OF_RANGE_INACCURATE when clamped to the first or the last l...
Definition DepthAxis.h:23