Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Multidimensional Interpolation

Interpolators allow to retrieve a data value from a multidimensional array between the index points, i.e. More...

Classes

class  Fiber::CubicIpol< T >
 Cubic interpolation using Hermite polynoms. More...
struct  Fiber::DeriveArray< Interpol, DerivativeDimension, Delimiter >
 Compute the partial derivative of a multidimensional array. More...
class  Fiber::FastCubicIpol< T >
 Fast cubic interpolation which requires the same number of sampling points as the linear interpolation, but provides a smooth derivative at the cost that this derivative is always zero at the samplint points. More...
class  Fiber::IpolDerivative< T, Interpol1D, Derive >
 Internal intermediate template which computes a one-dimensionally interpolated value, and optionally its derivative. More...
class  Fiber::IpolDerivative< T, Interpol1D, true >
 Internal intermediate template which computes a one-dimensional interpolation of a derivation. More...
struct  Fiber::Interpolate< N, Type, Interpol, CoordinateType, Delimiter, DerivativeDimension >
 The interpolator template. More...
struct  Fiber::Interpolate< 1, Type, Interpol, CoordinateType, Delimiter, DerivativeDimension >
 One-dimensional interpolation, basically a wrapper for the Interpol argument. More...
struct  Fiber::Interpolate< 2, Type, Interpol, CoordinateType, Delimiter, DerivativeDimension >
 Two-dimensional interpolation. More...
class  Fiber::NoDelimiter< Type >
struct  Fiber::LinearIpolZeroDerivativeTrait< T >
 Helper class (type trait) for class LinerIpol, which for a given type T provides a static member function zero() returning the value for out-of-bound derivatives. More...
class  Fiber::LinearIpol< T, Vectorial >
 Linear interpolation. More...
class  Fiber::NearestNeighborIpol< T >
 Nearest-Neighbor interpolation, just fast and wrong. More...

Functions

 Fiber::Interpolate (const MultiArray_t &m, const Point_t &point)
 Recursive multidimensional interpolator of arbitrary degree.

Detailed Description

Interpolators allow to retrieve a data value from a multidimensional array between the index points, i.e.

via floating point indices. The Interpolate<> template class allows to extend an interpolator, which is defined only in one dimension, into as many dimensions as the multidimensional array on which it is applied. This is useful for interpolators which are non-trivial in even one dimension.

Optionally the interpolator allows to modify the source values during interpolation. This is important e.g. when interpolating eigenvector fields which are undefined in their orientation, such that the interpolator can flip the data values during interpolation.

Function Documentation

◆ Interpolate()

Fiber::Interpolate ( const MultiArray_t & m,
const Point_t & point )

Recursive multidimensional interpolator of arbitrary degree.

The purpose of this class is to push the definition of a one-dimensional interpolator, defined in the `Interpol' argument, to a n-dimensional regular grid in a recursive manner.

The interpolator is initialized with a reference to a interpolation point and a multidimensional array. The interpolated value is retrieved through the eval() function. For subsequent interpolation requests, the references interpolation point may be modified and the eval() function called again:

point = 5.5, 6.7, 8.8;
double value = DataField.eval();
point = 2.3, 4.5, 9.2;
value = DataField.eval();
Definition MultiArray.hpp:371
The interpolator template.
Definition Interpolate.hpp:63

At the same time, an Interpolator<> class instance looks like a one-dimensional vector<>, i.e. it provides the [] operator and a size() member function. Calling these functions allows to traverse an interpolated one-dimensional line which has its coordinates fixed to those of the current interpolation point.

Parameters
DerivativeDimensionThe interpolator may also compute the derivative by the nth coordinate during interpolation. This parameter specifies the coordinate for which the derivation should be performed. It is straightforward to compute the derivative during interpolation since then derivative of the interpolation formulas can be employed. The derivative dimension is a compile-time parameter because the resulting Interpolate object is intended to conform to the concept of an array, i.e. it shall provide an [] operator which is indiced with a single index only. There is no way to specify another parameter through this interface. As this parameter is required only locally within operator[], technically it were also possible to provide the derivative dimension as a runtime parameter (e.g. as a member variable or a different interface), if the actual reason indeed arises somewhen. For usual interpolation with no derivative, set this parameter to a negative value.
DelimiterAn object that is forwarded to the one-dimensional interpolator from the uppermost level. Its layout is not used by the Interpolate class, but the one-dimensional interpolators may use it to e.g. perform local alignment of eigenvector fields on all interpolation vertices. With no special needs, class NoDelimiter<Type> may be used here.
InterpolA one-dimensional interpolator type. Currently implemented one-dimensional interpolators are
  1. NearestNeighborIpol (fastest, but nothing really precise)
  2. LinearIpol (speedy, providing fair results)
  3. FastCubicIpol (nearly same speed as LinearIpol, but with smooth derivatives)
  4. CubicIpol (slower than linear, but very accurate)
  5. CatMullRomSpline (advanced, but apparently same as cubic, little slower)
CoordinateTypeExplicit specification on which coordinates are to be used for interpolation. This type is used for storing the local point of interest, which is actually a reference to an external variable. There is not much need to specify something else than float or double here. In conjunction with the dimensionality parameter N it defines the coordinates on the underlying manifold. The actual interpolation type is then of type FixedArray<N,CoordinateType>.
NThe dimensionality of the underlying manifold. This interpolator is good for MultiArrays of same dimension.
TypeThe type of the field defined on each element of a MultiArray to be interpolated. The result of the interpolation will be of same type. Note that this type does not need to be the same as the value type of the Storage: It may be double, whereas the Storage contains unsigned char's, thereby yielding interpolated doubles from unsigned char values (which is of course more precise).

*/ template <int N, class Type, class Interpol, class CoordinateType, class Delimiter, int DerivativeDimension> struct Interpolate { enum { Dims = N };

typedef Type value_type; typedef MultiArray<N, Type> MultiArray_t; typedef typename MultiArray_t::Hyperslab_t SliceStorage_t; typedef FixedArray<CoordinateType, N> Point_t; typedef FixedArray<CoordinateType, N-1> SubPoint_t;

private: const MultiArray<N, Type>&M; const Point_t&Point;

public: Delimiter myDelimiter;

const MultiArray<N, Type>&MArray() { return M; }

/** Basic constructor.

Parameters
mThe multidimensional array which provides the data for a multidimensional index.
pointThe fractional index location where the data value is to be computed.