CubbyFlow::LinearArraySampler< T, N > Class Template Referencefinal

N-D array sampler using linear interpolation. More...

#include <Core/Array/ArraySamplers.hpp>

Public Types

using ScalarType = typename GetScalarType< T >::value
 
using VectorType = Vector< ScalarType, N >
 
using CoordIndexType = Vector< size_t, N >
 

Public Member Functions

 LinearArraySampler ()=default
 Default constructor. More...
 
 LinearArraySampler (const ArrayView< const T, N > &view, const VectorType &gridSpacing, const VectorType &gridOrigin)
 Constructs a sampler. More...
 
 ~LinearArraySampler ()=default
 Default destructor. More...
 
 LinearArraySampler (const LinearArraySampler &other)
 Copy constructor. More...
 
 LinearArraySampler (LinearArraySampler &&other) noexcept
 Move constructor. More...
 
LinearArraySampleroperator= (const LinearArraySampler &other)
 Copy assignment operator. More...
 
LinearArraySampleroperator= (LinearArraySampler &&other) noexcept
 Move assignment operator. More...
 
operator() (const VectorType &pt) const
 Returns sampled value at point pt. More...
 
void GetCoordinatesAndWeights (const VectorType &pt, std::array< CoordIndexType, FLAT_KERNEL_SIZE > &indices, std::array< ScalarType, FLAT_KERNEL_SIZE > &weights) const
 Returns the indices of points and their sampling weight for given point. More...
 
void GetCoordinatesAndGradientWeights (const VectorType &pt, std::array< CoordIndexType, FLAT_KERNEL_SIZE > &indices, std::array< VectorType, FLAT_KERNEL_SIZE > &weights) const
 
std::function< T(const VectorType &)> Functor () const
 Returns a std::function instance that wraps this instance. More...
 

Static Public Attributes

static constexpr size_t FLAT_KERNEL_SIZE = 1 << N
 

Detailed Description

template<typename T, size_t N>
class CubbyFlow::LinearArraySampler< T, N >

N-D array sampler using linear interpolation.

This class provides linear sampling interface for a given N-D array.

Template Parameters
T- The value type to sample.
N- Dimension.

Member Typedef Documentation

◆ CoordIndexType

template<typename T, size_t N>
using CubbyFlow::LinearArraySampler< T, N >::CoordIndexType = Vector<size_t, N>

◆ ScalarType

template<typename T, size_t N>
using CubbyFlow::LinearArraySampler< T, N >::ScalarType = typename GetScalarType<T>::value

◆ VectorType

template<typename T, size_t N>
using CubbyFlow::LinearArraySampler< T, N >::VectorType = Vector<ScalarType, N>

Constructor & Destructor Documentation

◆ LinearArraySampler() [1/4]

template<typename T, size_t N>
CubbyFlow::LinearArraySampler< T, N >::LinearArraySampler ( )
default

Default constructor.

◆ LinearArraySampler() [2/4]

template<typename T, size_t N>
CubbyFlow::LinearArraySampler< T, N >::LinearArraySampler ( const ArrayView< const T, N > &  view,
const VectorType gridSpacing,
const VectorType gridOrigin 
)
explicit

Constructs a sampler.

Parameters
[in]viewThe array view.
[in]gridSpacingThe grid spacing.
[in]gridOriginThe grid origin.

◆ ~LinearArraySampler()

template<typename T, size_t N>
CubbyFlow::LinearArraySampler< T, N >::~LinearArraySampler ( )
default

Default destructor.

◆ LinearArraySampler() [3/4]

template<typename T, size_t N>
CubbyFlow::LinearArraySampler< T, N >::LinearArraySampler ( const LinearArraySampler< T, N > &  other)

Copy constructor.

◆ LinearArraySampler() [4/4]

template<typename T, size_t N>
CubbyFlow::LinearArraySampler< T, N >::LinearArraySampler ( LinearArraySampler< T, N > &&  other)
noexcept

Move constructor.

Member Function Documentation

◆ Functor()

template<typename T , size_t N>
std::function< T(const typename LinearArraySampler< T, N >::VectorType &)> CubbyFlow::LinearArraySampler< T, N >::Functor ( ) const

Returns a std::function instance that wraps this instance.

◆ GetCoordinatesAndGradientWeights()

template<typename T , size_t N>
void CubbyFlow::LinearArraySampler< T, N >::GetCoordinatesAndGradientWeights ( const VectorType pt,
std::array< CoordIndexType, FLAT_KERNEL_SIZE > &  indices,
std::array< VectorType, FLAT_KERNEL_SIZE > &  weights 
) const

Returns the indices of points and their gradient of sampling weight for given point.

◆ GetCoordinatesAndWeights()

template<typename T , size_t N>
void CubbyFlow::LinearArraySampler< T, N >::GetCoordinatesAndWeights ( const VectorType pt,
std::array< CoordIndexType, FLAT_KERNEL_SIZE > &  indices,
std::array< ScalarType, FLAT_KERNEL_SIZE > &  weights 
) const

Returns the indices of points and their sampling weight for given point.

◆ operator()()

template<typename T , size_t N>
T CubbyFlow::LinearArraySampler< T, N >::operator() ( const VectorType pt) const

Returns sampled value at point pt.

◆ operator=() [1/2]

template<typename T , size_t N>
LinearArraySampler< T, N > & CubbyFlow::LinearArraySampler< T, N >::operator= ( const LinearArraySampler< T, N > &  other)

Copy assignment operator.

◆ operator=() [2/2]

template<typename T , size_t N>
LinearArraySampler< T, N > & CubbyFlow::LinearArraySampler< T, N >::operator= ( LinearArraySampler< T, N > &&  other)
noexcept

Move assignment operator.

Member Data Documentation

◆ FLAT_KERNEL_SIZE

template<typename T, size_t N>
constexpr size_t CubbyFlow::LinearArraySampler< T, N >::FLAT_KERNEL_SIZE = 1 << N
static

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