Block-Structured AMR Software Framework
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
6
namespace
amrex
{
7
8
template
<
class
T >
9
struct
is_soa_particle
10
: std::integral_constant<
11
bool,
12
T::is_soa_particle
13
> {};
14
15
16
template
<
typename
T_ParticleType>
17
struct
make_particle
18
{
19
template
<
typename
PTD>
20
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
21
auto
&
22
operator()
(PTD
const
& ptd,
int
i)
23
{
24
// legacy Particle (AoS)
25
return
ptd.m_aos[i];
26
}
27
};
28
29
template
<
typename
T_ParticleType>
30
requires
(is_soa_particle<T_ParticleType>::value)
31
struct
make_particle<T_ParticleType>
32
{
33
template
<
typename
PTD>
34
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
35
auto
36
operator() (PTD
const
& ptd,
int
index)
37
{
38
// SoAParticle
39
return
T_ParticleType(ptd, index);
40
}
41
};
42
43
}
44
45
#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
amrex
Definition
AMReX_Amr.cpp:50
amrex::is_soa_particle
Definition
AMReX_MakeParticle.H:13
amrex::make_particle
Definition
AMReX_MakeParticle.H:18
amrex::make_particle::operator()
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto & operator()(PTD const &ptd, int i)
Definition
AMReX_MakeParticle.H:22
Src
Particle
AMReX_MakeParticle.H
Generated by
1.9.8