UFO
src/ufo/utils/PiecewiseLinearInterpolation.h
Go to the documentation of this file.
1
/*
2
* (C) Copyright 2020 Met Office UK
3
*
4
* This software is licensed under the terms of the Apache Licence Version 2.0
5
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6
*/
7
8
#ifndef UFO_UTILS_PIECEWISELINEARINTERPOLATION_H_
9
#define UFO_UTILS_PIECEWISELINEARINTERPOLATION_H_
10
11
#include <vector>
12
13
namespace
ufo
{
14
15
/// \brief Represents a piecewise linear interpolation of a set of data points.
16
class
PiecewiseLinearInterpolation
17
{
18
public
:
19
/// \brief Create an object representing a piecewise linear interpolation of the data points
20
/// (sortedAbscissas[i], ordinates[i]).
21
///
22
/// Both arguments must have the same length and be non-empty. The elements of \p sortedAbscissas
23
/// must be sorted.
24
PiecewiseLinearInterpolation
(std::vector<double> sortedAbscissas,
25
std::vector<double> ordinates);
26
27
/// \brief Evaluate the interpolated function at \p abscissa.
28
double
operator()
(
double
abscissa)
const
;
29
30
/// \brief Convenience function interpolating the data points (sortedAbscissas[i], ordinates[i])
31
/// at \p abscissa without creating a PiecewiseLinearInterpolation object.
32
static
double
interpolate
(
const
std::vector<double> &sortedAbscissas,
33
const
std::vector<double> &ordinates,
34
double
abscissa);
35
36
private
:
37
std::vector<double>
abscissas_
;
38
std::vector<double>
ordinates_
;
39
};
40
41
}
// namespace ufo
42
43
#endif // UFO_UTILS_PIECEWISELINEARINTERPOLATION_H_
ufo::PiecewiseLinearInterpolation::interpolate
static double interpolate(const std::vector< double > &sortedAbscissas, const std::vector< double > &ordinates, double abscissa)
Convenience function interpolating the data points (sortedAbscissas[i], ordinates[i]) at abscissa wit...
Definition:
PiecewiseLinearInterpolation.cc:32
ufo
Definition:
RunCRTM.h:27
ufo::PiecewiseLinearInterpolation
Represents a piecewise linear interpolation of a set of data points.
Definition:
src/ufo/utils/PiecewiseLinearInterpolation.h:17
ufo::PiecewiseLinearInterpolation::PiecewiseLinearInterpolation
PiecewiseLinearInterpolation(std::vector< double > sortedAbscissas, std::vector< double > ordinates)
Create an object representing a piecewise linear interpolation of the data points (sortedAbscissas[i]...
Definition:
PiecewiseLinearInterpolation.cc:16
ufo::PiecewiseLinearInterpolation::ordinates_
std::vector< double > ordinates_
Definition:
src/ufo/utils/PiecewiseLinearInterpolation.h:38
ufo::PiecewiseLinearInterpolation::abscissas_
std::vector< double > abscissas_
Definition:
src/ufo/utils/PiecewiseLinearInterpolation.h:37
ufo::PiecewiseLinearInterpolation::operator()
double operator()(double abscissa) const
Evaluate the interpolated function at abscissa.
Definition:
PiecewiseLinearInterpolation.cc:28
fv3-bundle
ufo
src
ufo
utils
PiecewiseLinearInterpolation.h
Generated on Sat Oct 24 2020 19:14:55 for UFO by
1.8.18