DiFfRG
Loading...
Searching...
No Matches
DiFfRG::LinearInterpolator2D< NT, Coordinates > Class Template Reference

A linear interpolator for 2D data, both on GPU and CPU. More...

#include <linear_interpolation_2D.hh>

Public Member Functions

 LinearInterpolator2D (const std::vector< NT > &data, const Coordinates &coordinates)
 Construct a LinearInterpolator2D object from a vector of data and a coordinate system.
 
 LinearInterpolator2D (const NT *data, const Coordinates &coordinates)
 Construct a LinearInterpolator2D object from a pointer to data and a coordinate system.
 
 LinearInterpolator2D (const Coordinates &coordinates)
 Construct a LinearInterpolator2D with internal, zeroed data and a coordinate system.
 
 LinearInterpolator2D (const LinearInterpolator2D &other)
 Construct a copy of a LinearInterpolator2D object.
 
template<typename NT2 >
void update (const NT2 *data)
 
void update ()
 
NT * data () const
 
__device__ __host__ NT operator() (const typename Coordinates::ctype x, const typename Coordinates::ctype y) const
 Interpolate the data at a given point.
 
NT & operator[] (const uint i)
 
const NT & operator[] (const uint i) const
 
const Coordinates & get_coordinates () const
 Get the coordinate system of the data.
 

Private Attributes

const uint size
 
const std::array< uint, 2 > shape
 
const Coordinates coordinates
 
std::shared_ptr< NT[]> m_data
 
std::shared_ptr< thrust::device_vector< NT > > device_data
 
const NT * device_data_ptr
 
const bool owner
 

Detailed Description

template<typename NT, typename Coordinates>
class DiFfRG::LinearInterpolator2D< NT, Coordinates >

A linear interpolator for 2D data, both on GPU and CPU.

Template Parameters
NTinput data type
Coordinatescoordinate system of the input data

Constructor & Destructor Documentation

◆ LinearInterpolator2D() [1/4]

template<typename NT , typename Coordinates >
DiFfRG::LinearInterpolator2D< NT, Coordinates >::LinearInterpolator2D ( const std::vector< NT > & data,
const Coordinates & coordinates )

Construct a LinearInterpolator2D object from a vector of data and a coordinate system.

Parameters
datavector containing the data
coordinatescoordinate system of the data

◆ LinearInterpolator2D() [2/4]

template<typename NT , typename Coordinates >
DiFfRG::LinearInterpolator2D< NT, Coordinates >::LinearInterpolator2D ( const NT * data,
const Coordinates & coordinates )

Construct a LinearInterpolator2D object from a pointer to data and a coordinate system.

Parameters
datapointer to the data
sizesize of the data
coordinatescoordinate system of the data

◆ LinearInterpolator2D() [3/4]

template<typename NT , typename Coordinates >
DiFfRG::LinearInterpolator2D< NT, Coordinates >::LinearInterpolator2D ( const Coordinates & coordinates)

Construct a LinearInterpolator2D with internal, zeroed data and a coordinate system.

Parameters
sizesize of the internal data
coordinatescoordinate system of the data

◆ LinearInterpolator2D() [4/4]

template<typename NT , typename Coordinates >
DiFfRG::LinearInterpolator2D< NT, Coordinates >::LinearInterpolator2D ( const LinearInterpolator2D< NT, Coordinates > & other)

Construct a copy of a LinearInterpolator2D object.

Parameters
otherthe object to copy

Member Function Documentation

◆ data()

template<typename NT , typename Coordinates >
NT * DiFfRG::LinearInterpolator2D< NT, Coordinates >::data ( ) const

◆ get_coordinates()

template<typename NT , typename Coordinates >
const Coordinates & DiFfRG::LinearInterpolator2D< NT, Coordinates >::get_coordinates ( ) const
inline

Get the coordinate system of the data.

Returns
const Coordinates& the coordinate system

◆ operator()()

template<typename NT , typename Coordinates >
__device__ __host__ NT DiFfRG::LinearInterpolator2D< NT, Coordinates >::operator() ( const typename Coordinates::ctype x,
const typename Coordinates::ctype y ) const
inline

Interpolate the data at a given point.

Parameters
xthe point at which to interpolate
Returns
NT the interpolated value

◆ operator[]() [1/2]

template<typename NT , typename Coordinates >
NT & DiFfRG::LinearInterpolator2D< NT, Coordinates >::operator[] ( const uint i)

◆ operator[]() [2/2]

template<typename NT , typename Coordinates >
const NT & DiFfRG::LinearInterpolator2D< NT, Coordinates >::operator[] ( const uint i) const

◆ update() [1/2]

template<typename NT , typename Coordinates >
void DiFfRG::LinearInterpolator2D< NT, Coordinates >::update ( )

◆ update() [2/2]

template<typename NT , typename Coordinates >
template<typename NT2 >
void DiFfRG::LinearInterpolator2D< NT, Coordinates >::update ( const NT2 * data)
inline

Member Data Documentation

◆ coordinates

template<typename NT , typename Coordinates >
const Coordinates DiFfRG::LinearInterpolator2D< NT, Coordinates >::coordinates
private

◆ device_data

template<typename NT , typename Coordinates >
std::shared_ptr<thrust::device_vector<NT> > DiFfRG::LinearInterpolator2D< NT, Coordinates >::device_data
private

◆ device_data_ptr

template<typename NT , typename Coordinates >
const NT* DiFfRG::LinearInterpolator2D< NT, Coordinates >::device_data_ptr
private

◆ m_data

template<typename NT , typename Coordinates >
std::shared_ptr<NT[]> DiFfRG::LinearInterpolator2D< NT, Coordinates >::m_data
private

◆ owner

template<typename NT , typename Coordinates >
const bool DiFfRG::LinearInterpolator2D< NT, Coordinates >::owner
private

◆ shape

template<typename NT , typename Coordinates >
const std::array<uint, 2> DiFfRG::LinearInterpolator2D< NT, Coordinates >::shape
private

◆ size

template<typename NT , typename Coordinates >
const uint DiFfRG::LinearInterpolator2D< NT, Coordinates >::size
private

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