Block-Structured AMR Software Framework
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
AMReX_MakeParticle.H
Go to the documentation of this file.
1#ifndef AMREX_MAKEPARTICLE_H_
2#define AMREX_MAKEPARTICLE_H_
3
4#include <type_traits>
5
6namespace amrex {
7
8template< class T >
10 : std::integral_constant<
11 bool,
12 T::is_soa_particle
13 > {};
14
15
16template <typename T_ParticleType, class Enable = void>
18{
19 template <typename PTD>
21 auto&
22 operator() (PTD const& ptd, int i)
23 {
24 // legacy Particle (AoS)
25 return ptd.m_aos[i];
26 }
27};
28
29template <typename T_ParticleType>
30struct make_particle<T_ParticleType, std::enable_if_t<is_soa_particle<T_ParticleType>::value>>
31{
32 template <typename PTD>
34 auto
35 operator() (PTD const& ptd, int index)
36 {
37 // SoAParticle
38 return T_ParticleType(ptd, index);
39 }
40};
41
42}
43
44#endif
#define AMREX_FORCE_INLINE
Definition AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
Definition AMReX_Amr.cpp:49
Definition AMReX_MakeParticle.H:13
Definition AMReX_MakeParticle.H:18
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto & operator()(PTD const &ptd, int i)
Definition AMReX_MakeParticle.H:22