Hipace
Classes | Functions
ShapeFactors.H File Reference
#include <AMReX_Math.H>

Go to the source code of this file.

Classes

struct  shape_factor_result
 
struct  derivative_shape_factor_result
 

Functions

template<int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor (amrex::Real *const sx, amrex::Real xint)
 
template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 0 > (amrex::Real *const sx, amrex::Real xmid)
 
template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 1 > (amrex::Real *const sx, amrex::Real xmid)
 
template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 2 > (amrex::Real *const sx, amrex::Real xmid)
 
template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 3 > (amrex::Real *const sx, amrex::Real xmid)
 
template<bool branchless, int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE shape_factor_result compute_single_shape_factor (amrex::Real xmid, int ix) noexcept
 Compute a single shape factor and return the index of the cell where the particle writes. More...
 
template<int derivative_type, int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE derivative_shape_factor_result single_derivative_shape_factor (amrex::Real xmid, int ix) noexcept
 Compute a single derivative shape factor and return the index of the cell where the particle writes. More...
 

Function Documentation

◆ compute_shape_factor()

template<int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor ( amrex::Real *const  sx,
amrex::Real  xint 
)

Compute shape factor and return index of leftmost cell where particle writes. Specialized templates are defined below for orders 0 to 3.

◆ compute_shape_factor< 0 >()

template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 0 > ( amrex::Real *const  sx,
amrex::Real  xmid 
)

Compute shape factor and return index of leftmost cell where particle writes. Specialization for order 0

◆ compute_shape_factor< 1 >()

template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 1 > ( amrex::Real *const  sx,
amrex::Real  xmid 
)

Compute shape factor and return index of leftmost cell where particle writes. Specialization for order 1

◆ compute_shape_factor< 2 >()

template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 2 > ( amrex::Real *const  sx,
amrex::Real  xmid 
)

Compute shape factor and return index of leftmost cell where particle writes. Specialization for order 2

◆ compute_shape_factor< 3 >()

template<>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int compute_shape_factor< 3 > ( amrex::Real *const  sx,
amrex::Real  xmid 
)

Compute shape factor and return index of leftmost cell where particle writes. Specialization for order 3

◆ compute_single_shape_factor()

template<bool branchless, int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE shape_factor_result compute_single_shape_factor ( amrex::Real  xmid,
int  ix 
)
noexcept

Compute a single shape factor and return the index of the cell where the particle writes.

Template Parameters
branchlesswhether to use a branchless calculation or one with branches depending in ix
depos_orderOrder of the shape factor
Parameters
[in]xmidexact position of the particle in index space
[in]ixindex of the shape factor, must be 0 <= ix <= depos_order

◆ single_derivative_shape_factor()

template<int derivative_type, int depos_order>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE derivative_shape_factor_result single_derivative_shape_factor ( amrex::Real  xmid,
int  ix 
)
noexcept

Compute a single derivative shape factor and return the index of the cell where the particle writes.

Template Parameters
derivative_typewhich type of derivative to use
depos_orderOrder of the shape factor
Parameters
[in]xmidexact position of the particle in index space
[in]ixindex of the shape factor, must be 0 <= ix <= (depos_order + derivative_type)