ImpactX
Loading...
Searching...
No Matches
impactx::elements::mixin::detail Namespace Reference

Classes

struct  PushSingleParticle
 
struct  PushSingleParticleSpin
 

Functions

template<typename T, typename IndexType>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE decltype(auto) load_pdata (T *ptr, IndexType const i)
 
template<auto P_Method, int N, typename T, typename IndexType, typename ValType>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void store_pdata (ValType const &AMREX_RESTRICT val, T *const AMREX_RESTRICT ptr, IndexType const i)
 
template<typename T_Element>
void push_all_particles (ImpactXParticleContainer::iterator &pti, RefPart &AMREX_RESTRICT ref_part, T_Element &element, bool spin)
 

Function Documentation

◆ load_pdata()

template<typename T, typename IndexType>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE decltype(auto) impactx::elements::mixin::detail::load_pdata ( T * ptr,
IndexType const i )

Load particle data from array pointers

On GPU and CPU w/o SIMD, this dereferences a particle property at the index position i. On CPU with SIMD, this loads a SIMD register at the IndexType::width SIMD-wide index position i.

Template Parameters
Tdata type (amrex::ParticleReal or uint64_t)
IndexTypeint or amrex::SIMDindex<SIMD_WIDTH, int>
Parameters
ptrpointer to the array data
iindex or SIMD index
Returns
a reference to the data (scalar) or a SIMD register (SIMD)

◆ push_all_particles()

template<typename T_Element>
void impactx::elements::mixin::detail::push_all_particles ( ImpactXParticleContainer::iterator & pti,
RefPart &AMREX_RESTRICT ref_part,
T_Element & element,
bool spin )

This pushes all particles on a particle iterator tile/box

◆ store_pdata()

template<auto P_Method, int N, typename T, typename IndexType, typename ValType>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void impactx::elements::mixin::detail::store_pdata ( ValType const &AMREX_RESTRICT val,
T *const AMREX_RESTRICT ptr,
IndexType const i )

Store particle data back to array pointers

On GPU and CPU without SIMD, this does nothing because we already modified the (global) RAM directly via pointer.

On CPU with SIMD, this performs a conditional writeback of a SIMD register to RAM (index in pointer array), but only if the argument was not passed as const and thus was likely changed.

Good optimizing compilers can eliminate writebacks of unchanged values themselves, but we better help a little for robustness. Background: https://github.com/AMReX-Codes/amrex/pull/4520#issuecomment-3064064215

Template Parameters
P_Methodpointer to the push method (for is_nth_arg_non_const)
Nthe argument index (for is_nth_arg_non_const)
Tdata type
IndexTypeint or SIMD index
ValTypethe type of the value to store
Parameters
valthe value to store
ptrpointer to the SoA data
iindex or SIMD index