From 843122b0a5ec60f1ba4679e94288a6f2ac73bb14 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 26 Apr 2023 19:52:15 -0700 Subject: [PATCH] One More Attempt --- Src/Particle/AMReX_MakeParticle.H | 48 +++++++++++++++++-------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/Src/Particle/AMReX_MakeParticle.H b/Src/Particle/AMReX_MakeParticle.H index 3cebe0bb502..eaa1f794e9c 100644 --- a/Src/Particle/AMReX_MakeParticle.H +++ b/Src/Particle/AMReX_MakeParticle.H @@ -1,39 +1,43 @@ #ifndef AMREX_MAKEPARTICLE_H_ #define AMREX_MAKEPARTICLE_H_ +#include "AMReX_ParticleTile.H" + #include -template< class T > -struct is_const_soa_particle - : std::integral_constant< - bool, - T::is_soa_particle && T::is_constsoa_particle - > {}; - -template -struct make_particle -{ - template + +namespace amrex { + +template +struct is_soa_particle + : std::integral_constant< + bool, + T::is_soa_particle + > { +}; + +template +struct make_particle { + template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - auto& - operator() (PTD const& ptd, int i) - { + auto & + operator()(PTD const &ptd, int i) { // legacy Particle (AoS) return ptd.m_aos[i]; } }; -template -struct make_particle::value>::type> -{ - template +template +struct make_particle::value>::type> { + template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto - operator() (PTD const& ptd, int index) - { - // ConstSoAParticle - return T_ParticleType(ptd, index); + operator()(PTD const &ptd, int index) { + // pure SoA particle (by value) + return ConstSoAParticle(ptd, index); } }; +} // namespace amrex + #endif