WarpX
Loading...
Searching...
No Matches
ablastr::math Namespace Reference

Namespaces

namespace  anyfft
 

Functions

amrex::Vector< amrex::Real > getFornbergStencilCoefficients (int n_order, ablastr::utils::enums::GridType a_grid_type)
 Returns an array of coefficients (Fornberg coefficients), corresponding to the weight of each point in a finite-difference approximation of a derivative (up to order n_order).
 
void ReorderFornbergCoefficients (amrex::Vector< amrex::Real > &ordered_coeffs, const amrex::Vector< amrex::Real > &unordered_coeffs, int order)
 Re-orders the Fornberg coefficients so that they can be used more conveniently for finite-order centering operations. For example, for finite-order centering of order 6, the Fornberg coefficients (c_0,c_1,c_2) are re-ordered as (c_2,c_1,c_0,c_0,c_1,c_2).
 
template<typename TCoord, typename TVal>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE constexpr auto linear_interp (TCoord x0, TCoord x1, TVal f0, TVal f1, TCoord x)
 Performs a linear interpolation.
 
template<typename TCoord, typename TVal>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE constexpr 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.
 
template<typename TCoord, typename TVal>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE constexpr 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.
 

Function Documentation

◆ bilinear_interp()

template<typename TCoord, typename TVal>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE constexpr auto ablastr::math::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).

◆ getFornbergStencilCoefficients()

amrex::Vector< amrex::Real > ablastr::math::getFornbergStencilCoefficients ( int n_order,
ablastr::utils::enums::GridType a_grid_type )
nodiscard

Returns an array of coefficients (Fornberg coefficients), corresponding to the weight of each point in a finite-difference approximation of a derivative (up to order n_order).

Parameters
[in]n_orderorder of the finite-difference approximation
[in]a_grid_typetype of grid (collocated or not)

◆ linear_interp()

template<typename TCoord, typename TVal>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE constexpr auto ablastr::math::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)

◆ ReorderFornbergCoefficients()

void ablastr::math::ReorderFornbergCoefficients ( amrex::Vector< amrex::Real > & ordered_coeffs,
const amrex::Vector< amrex::Real > & unordered_coeffs,
int order )

Re-orders the Fornberg coefficients so that they can be used more conveniently for finite-order centering operations. For example, for finite-order centering of order 6, the Fornberg coefficients (c_0,c_1,c_2) are re-ordered as (c_2,c_1,c_0,c_0,c_1,c_2).

Parameters
[in,out]ordered_coeffshost vector where the re-ordered Fornberg coefficients will be stored
[in]unordered_coeffshost vector storing the original sequence of Fornberg coefficients
[in]orderorder of the finite-order centering along a given direction

◆ trilinear_interp()

template<typename TCoord, typename TVal>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE constexpr auto ablastr::math::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)