WarpX
Functions
utils::algorithms Namespace Reference

Functions

template<typename TV , typename TE , class = typename std::enable_if<std::is_convertible<TE,TV>::value>::type>
bool is_in (const std::vector< TV > &vect, const TE &elem)
 Returns true if an item of type TE is in a vector of TV objects (provided that TE can be converted into TV), false otherwise. More...
 
template<typename TV , typename TE , class = typename std::enable_if<std::is_convertible<TE,TV>::value>::type>
bool any_of_is_in (const std::vector< TV > &vect, const std::vector< TE > &elems)
 Returns true if any of the items of a vector<TE> is contained in another vector<TV> (provided that TE can be converted into TV) More...
 
template<typename TCoord , typename TVal >
AMREX_GPU_DEVICE constexpr AMREX_FORCE_INLINE auto linear_interp (TCoord x0, TCoord x1, TVal f0, TVal f1, TCoord x)
 Performs a linear interpolation. More...
 
template<typename TCoord , typename TVal >
AMREX_GPU_DEVICE constexpr AMREX_FORCE_INLINE auto bilinear_interp (TCoord x0, TCoord x1, TCoord y0, TCoord y1, TVal f00, TVal f01, TVal f10, TVal f11, TCoord x, TCoord y)
 Performs a bilinear interpolation. More...
 
template<typename TCoord , typename TVal >
AMREX_GPU_DEVICE constexpr AMREX_FORCE_INLINE auto trilinear_interp (TCoord x0, TCoord x1, TCoord y0, TCoord y1, TCoord z0, TCoord z1, TVal f000, TVal f001, TVal f010, TVal f011, TVal f100, TVal f101, TVal f110, TVal f111, TCoord x, TCoord y, TCoord z)
 Performs a trilinear interpolation. More...
 

Function Documentation

◆ any_of_is_in()

template<typename TV , typename TE , class = typename std::enable_if<std::is_convertible<TE,TV>::value>::type>
bool utils::algorithms::any_of_is_in ( const std::vector< TV > &  vect,
const std::vector< TE > &  elems 
)

Returns true if any of the items of a vector<TE> is contained in another vector<TV> (provided that TE can be converted into TV)

Template Parameters
TVthe typename of the first vector elements
TVthe typename of the second vector elements
Parameters
vecta vector of TV objects
elemsa vector of TE objects
Returns
true if any element of elems is in vect, false otherwise

◆ bilinear_interp()

template<typename TCoord , typename TVal >
AMREX_GPU_DEVICE constexpr AMREX_FORCE_INLINE auto utils::algorithms::bilinear_interp ( TCoord  x0,
TCoord  x1,
TCoord  y0,
TCoord  y1,
TVal  f00,
TVal  f01,
TVal  f10,
TVal  f11,
TCoord  x,
TCoord  y 
)
constexpr

Performs a bilinear interpolation.

Performs a bilinear interpolation at (x,y) given the 4 points (x0, y0, f00), (x0, y1, f01), (x1, y0, f10), (x1, y1, f11).

◆ is_in()

template<typename TV , typename TE , class = typename std::enable_if<std::is_convertible<TE,TV>::value>::type>
bool utils::algorithms::is_in ( const std::vector< TV > &  vect,
const TE &  elem 
)

Returns true if an item of type TE is in a vector of TV objects (provided that TE can be converted into TV), false otherwise.

Template Parameters
TVthe typename of the vector elements
TEthe typename of the item
Parameters
vecta vector of TV objects
eleman object of type TE
Returns
true if elem is in vect, false otherwise

◆ linear_interp()

template<typename TCoord , typename TVal >
AMREX_GPU_DEVICE constexpr AMREX_FORCE_INLINE auto utils::algorithms::linear_interp ( TCoord  x0,
TCoord  x1,
TVal  f0,
TVal  f1,
TCoord  x 
)
constexpr

Performs a linear interpolation.

Performs a linear interpolation at x given the 2 points (x0, f0) and (x1, f1)

◆ trilinear_interp()

template<typename TCoord , typename TVal >
AMREX_GPU_DEVICE constexpr AMREX_FORCE_INLINE auto utils::algorithms::trilinear_interp ( TCoord  x0,
TCoord  x1,
TCoord  y0,
TCoord  y1,
TCoord  z0,
TCoord  z1,
TVal  f000,
TVal  f001,
TVal  f010,
TVal  f011,
TVal  f100,
TVal  f101,
TVal  f110,
TVal  f111,
TCoord  x,
TCoord  y,
TCoord  z 
)
constexpr

Performs a trilinear interpolation.

Performs a trilinear interpolation at (x,y,z) given the 8 points (x0, y0, z0, f000), (x0, y0, z1, f001), (x0, y1, z0, f010), (x0, y1, z1, f011), (x1, y0, z0, f100), (x1, y0, z1, f101), (x1, y1, z0, f110), (x1, y1, z1, f111)