GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
Utilities::Interpolator< T > Class Template Reference

Bilinear interpolation class for interpolating from a 2D uniform grid. More...

#include <Tree.h>

Public Member Functions

 Interpolator (PosType const *x, int Npixels, PosType my_range, PosType *my_center)
 
 Interpolator (PosType const *x, int my_Nx, PosType my_range_x, int my_Ny, PosType my_range_y, PosType *my_center)
 
 Interpolator (int Npixels, PosType my_range, PosType *my_center, const T *map)
 
PosType interpolate (T &map)
 
PosType interpolate (PosType *x, T &map)
 reinitializes to a new position
 
PosType operator() (PosType *x)
 
void test (void)
 

Detailed Description

template<typename T>
class Utilities::Interpolator< T >

Bilinear interpolation class for interpolating from a 2D uniform grid.

Out of bounds points return 0. map is a i dimensional array representing a 2 dimensional map.

Later calls can use interpolator(map) for the same point in the same coordinate system to save time in calculating the indexes.

Constructor & Destructor Documentation

◆ Interpolator() [1/3]

template<typename T >
Utilities::Interpolator< T >::Interpolator ( PosType const * x,
int Npixels,
PosType my_range,
PosType * my_center )
inline
Parameters
xposition of point
NpixelsNumber of pixels in one dimension
my_rangeRange of map in same units as x[]
my_centerCenter of map in same units as x[]

◆ Interpolator() [2/3]

template<typename T >
Utilities::Interpolator< T >::Interpolator ( PosType const * x,
int my_Nx,
PosType my_range_x,
int my_Ny,
PosType my_range_y,
PosType * my_center )
inline

Constructor for case when region is a rectangle and not a square. Array must be indexed i = ix + iy * Nx

Parameters
xposition of point
my_NxNumber of pixels in x dimension
my_range_xRange of map in x in same units as x[]
my_NyNumber of pixels in y dimension
my_range_yRange of map in y in same units as x[]
my_centerCenter of map in same units as x[]

◆ Interpolator() [3/3]

template<typename T >
Utilities::Interpolator< T >::Interpolator ( int Npixels,
PosType my_range,
PosType * my_center,
const T * map )
inline

This constructor takes the map as a pointer to an array of values and stores it. The resulting object can then be used with the () operator as a function. Warning: Be sure to distroy the object before distroying map.

Parameters
NpixelsNumber of pixels in one dimension
my_rangeRange of map in same units as x[]
my_centerCenter of map in same units as x[]
mapOne dimensional array of fundamental type

Member Function Documentation

◆ interpolate() [1/2]

template<typename T >
PosType Utilities::Interpolator< T >::interpolate ( PosType * x,
T & map )
inline

reinitializes to a new position

Parameters
xposition of point
mapmap that supports the [] operator

◆ interpolate() [2/2]

template<typename T >
PosType Utilities::Interpolator< T >::interpolate ( T & map)
inline

Does interpolation of map at point that object was constructed with or last called with. Can use any map type that has a [] operator that returns a PosType.

Parameters
mapmap that supports the [] operator

◆ operator()()

template<typename T >
PosType Utilities::Interpolator< T >::operator() ( PosType * x)
inline

Does interpolation of store map at point x. Only for use with the second constructor.


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