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 >
7
struct
is_soa_particle
8
: std::integral_constant<
9
bool,
10
T::is_soa_particle
11
> {};
12
13
14
template
<
typename
T_ParticleType,
class
Enable =
void
>
15
struct
make_particle
16
{
17
template
<
typename
PTD>
18
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
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>
31
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
32
auto
33
operator()
(PTD
const
& ptd,
int
index)
34
{
35
// SoAParticle
36
return
T_ParticleType(ptd, index);
37
}
38
};
39
40
#endif
AMREX_FORCE_INLINE
#define AMREX_FORCE_INLINE
Definition:
AMReX_Extension.H:119
AMREX_GPU_HOST_DEVICE
#define AMREX_GPU_HOST_DEVICE
Definition:
AMReX_GpuQualifiers.H:20
is_soa_particle
Definition:
AMReX_MakeParticle.H:11
make_particle
Definition:
AMReX_MakeParticle.H:16
make_particle::operator()
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto & operator()(PTD const &ptd, int i)
Definition:
AMReX_MakeParticle.H:20
Src
Particle
AMReX_MakeParticle.H
Generated by
1.9.1