Block-Structured AMR Software Framework
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 
6 template< class T >
8  : std::integral_constant<
9  bool,
10  T::is_soa_particle
11  > {};
12 
13 
14 template <typename T_ParticleType, class Enable = void>
16 {
17  template <typename PTD>
19  auto&
20  operator() (PTD const& ptd, int i)
21  {
22  // legacy Particle (AoS)
23  return ptd.m_aos[i];
24  }
25 };
26 
27 template <typename T_ParticleType>
28 struct make_particle<T_ParticleType, std::enable_if_t<is_soa_particle<T_ParticleType>::value>>
29 {
30  template <typename PTD>
32  auto
33  operator() (PTD const& ptd, int index)
34  {
35  // SoAParticle
36  return T_ParticleType(ptd, index);
37  }
38 };
39 
40 #endif
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Definition: AMReX_MakeParticle.H:11
Definition: AMReX_MakeParticle.H:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto & operator()(PTD const &ptd, int i)
Definition: AMReX_MakeParticle.H:20