Template Function Acts::interpolate¶
Defined in File Interpolation.hpp
Function Documentation¶
-
template<typename
T
, size_tN
, classPoint1
, classPoint2
= Point1, classPoint3
= Point2, typename = std::enable_if_t<detail::can_interpolate<Point1, Point2, Point3, T>::value>>
TActs
::
interpolate
(const Point1 &position, const Point2 &lowerCorner, const Point3 &upperCorner, const std::array<T, N> &values)¶ performs linear interpolation inside a hyper box
- Return
interpolated value at given position
- Pre
position
must describe a position inside the given hyper box, that is \(\text{lowerCorner}[i] \le \text{position}[i] \le \text{upperCorner}[i] \quad \forall i=0, \dots, d-1\).- Note
Given
U
andV
of value typeT
as well as twodouble
a
andb
, then the following must be a valid expressiona * U + b * V
yielding an object which is (implicitly) convertible toT
.All
Point
types must represent d-dimensional positions and support coordinate access usingoperator
[] which should return adouble
(or a value which is implicitly convertible). Coordinate indices must start at 0.N
is the number of hyper box corners which is \(2^d\) where \(d\) is the dimensionality of the hyper box. The dimensionality must be consistent with the providedPoint
types.Definition of the canonical order for sorting the field values: The hyper box corners are numbered according to the following scheme. Each corner is defined by the set of lower/upper boundary limits in each dimension
i
. This can be represented by a binary code (from left to right) where a0
stands for a lower bound along this axis and a1
stand for the upper bound along this axis. The left most bit corresponds to the first dimension and the bits to the left correspond to the 2nd, 3rd… dimension. The binary code can be interpreted as integer which gives the number of the corresponding hyper box corner. The field values are ordered according to ascending hyper box corner numbers.As an example assume we have a 3D box with
lowerCorner
= (1,2,3) andupperCorner
= (4,5,6). The eight corners with their bit patterns and corner numbers are:(1,2,3): 000 = 0
(1,2,6): 001 = 1
(1,5,3): 010 = 2
(1,5,6): 011 = 3
(4,2,3): 100 = 4
(4,2,6): 101 = 5
(4,5,3): 110 = 6
(4,5,6): 111 = 7
- Template Parameters
T
: type of values to be interpolatedN
: number of hyper box cornersPoint1
: type specifying geometric positionsPoint2
: type specifying geometric positionsPoint3
: type specifying geometric positions
- Parameters
[in] position
: position to which to interpolate[in] lowerCorner
: generalized lower-left corner of hyper box (containing the minima of the hyper box along each dimension)[in] upperCorner
: generalized upper-right corner of hyper box (containing the maxima of the hyper box along each dimension)[in] values
: field values at the hyper box corners sorted in the canonical order defined below.