1 #ifndef AMREX_PARTICLETILE_H_
2 #define AMREX_PARTICLETILE_H_
3 #include <AMReX_Config.H>
15 #include <type_traits>
22 template <
int NArrayReal,
int NArrayInt>
23 struct ConstSoAParticle;
24 template <
int NArrayReal,
int NArrayInt>
27 template <
typename T_ParticleType,
int NArrayReal,
int NArrayInt>
28 struct ConstParticleTileData;
30 template <
typename T_ParticleType,
int NArrayReal,
int NArrayInt>
33 static constexpr
int NAR = NArrayReal;
34 static constexpr
int NAI = NArrayInt;
49 using AOS_PTR = std::conditional_t<T_ParticleType::is_soa_particle,
63 ParticleReal&
pos (
const int dir,
const int index)
const &
65 if constexpr(!ParticleType::is_soa_particle) {
66 return this->m_aos[index].pos(dir);
68 return this->m_rdata[dir][index];
73 decltype(
auto)
id (const
int index) const &
75 if constexpr(!ParticleType::is_soa_particle) {
76 return this->m_aos[index].id();
83 decltype(
auto)
cpu (const
int index) const &
85 if constexpr(!ParticleType::is_soa_particle) {
86 return this->m_aos[index].cpu();
93 decltype(
auto)
idcpu (const
int index) const &
95 if constexpr(ParticleType::is_soa_particle) {
96 return this->m_idcpu[index];
103 ParticleReal *
rdata (
const int attribute_index)
const
105 return this->m_rdata[attribute_index];
109 int *
idata (
const int attribute_index)
const
111 return this->m_idata[attribute_index];
115 decltype(
auto) operator[] (const
int index)
const
117 if constexpr (!ParticleType::is_soa_particle) {
126 const int* comm_real,
const int * comm_int)
const noexcept
129 auto* dst = buffer + dst_offset;
130 if constexpr (!ParticleType::is_soa_particle) {
135 dst +=
sizeof(uint64_t);
137 int array_start_index = AMREX_SPACEDIM +
NStructReal;
138 for (
int i = 0; i <
NAR; ++i)
140 if (comm_real[array_start_index + i])
143 dst +=
sizeof(ParticleReal);
149 if (comm_real[runtime_start_index + i])
152 dst +=
sizeof(ParticleReal);
156 for (
int i = 0; i <
NAI; ++i)
158 if (comm_int[array_start_index + i])
167 if (comm_int[runtime_start_index + i])
177 const int* comm_real,
const int* comm_int)
const noexcept
180 const auto* src = buffer + src_offset;
181 if constexpr (!ParticleType::is_soa_particle) {
186 src +=
sizeof(uint64_t);
188 int array_start_index = AMREX_SPACEDIM +
NStructReal;
189 for (
int i = 0; i <
NAR; ++i)
191 if (comm_real[array_start_index + i])
194 src +=
sizeof(ParticleReal);
200 if (comm_real[runtime_start_index + i])
203 src +=
sizeof(ParticleReal);
207 for (
int i = 0; i <
NAI; ++i)
209 if (comm_int[array_start_index + i])
218 if (comm_int[runtime_start_index + i])
226 template <
typename T = ParticleType, std::enable_if_t<!T::is_soa_particle,
int> = 0>
232 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
238 for (
int i = 0; i <
NAR; ++i) {
246 for (
int i = 0; i <
NAI; ++i) {
252 template <
typename T = ParticleType, std::enable_if_t<T::is_soa_particle,
int> = 0>
259 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {sp.
pos(i) =
m_rdata[i][index];}
260 for (
int i = 0; i <
NAR; ++i) {
263 for (
int i = 0; i <
NAI; ++i) {
269 template <
typename T = ParticleType, std::enable_if_t<!T::is_soa_particle,
int> = 0>
273 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
274 m_aos[index].pos(i) = sp.pos(i);
277 m_aos[index].rdata(i) = sp.rdata(i);
279 for (
int i = 0; i <
NAR; ++i) {
282 m_aos[index].id() = sp.id();
283 m_aos[index].cpu() = sp.cpu();
285 m_aos[index].idata(i) = sp.idata(i);
287 for (
int i = 0; i <
NAI; ++i) {
292 template <
typename T = ParticleType, std::enable_if_t<T::is_soa_particle,
int> = 0>
297 for (
int i = 0; i <
NAR; ++i) {
298 m_rdata[i][index] = sp.rdata(i);
300 for (
int i = 0; i <
NAI; ++i) {
301 m_idata[i][index] = sp.idata(i);
307 template <
int T_NArrayReal,
int T_NArrayInt>
369 template <
int T_NArrayReal,
int T_NArrayInt>
441 static void NextID (Long nextid);
454 template <
int NArrayReal,
int NArrayInt>
461 #if defined(AMREX_USE_OMP) && defined(_OPENMP) && _OPENMP < 201307
462 #pragma omp critical (amrex_particle_nextid)
463 #elif defined(AMREX_USE_OMP)
464 #pragma omp atomic capture
466 next = the_next_id++;
469 amrex::Abort(
"SoAParticle<NArrayReal, NArrayInt>::NextID() -- too many particles");
475 template <
int NArrayReal,
int NArrayInt>
479 Long next = the_next_id++;
481 amrex::Abort(
"SoAParticle<NArrayReal, NArrayInt>::NextID() -- too many particles");
486 template <
int NArrayReal,
int NArrayInt>
490 the_next_id = nextid;
493 template <
typename T_ParticleType,
int NArrayReal,
int NArrayInt>
496 static constexpr
int NAR = NArrayReal;
497 static constexpr
int NAI = NArrayInt;
510 using AOS_PTR = std::conditional_t<T_ParticleType::is_soa_particle,
519 const ParticleReal&
pos (
const int dir,
const int index)
const &
521 if constexpr(!ParticleType::is_soa_particle) {
522 return this->m_aos[index].pos(dir);
524 return this->m_rdata[dir][index];
529 decltype(
auto)
id (const
int index) const &
531 if constexpr(!ParticleType::is_soa_particle) {
532 return this->m_aos[index].id();
539 decltype(
auto)
cpu (const
int index) const &
541 if constexpr(!ParticleType::is_soa_particle) {
542 return this->m_aos[index].cpu();
549 decltype(
auto)
idcpu (const
int index) const &
551 if constexpr(ParticleType::is_soa_particle) {
552 return this->m_idcpu[index];
559 const ParticleReal *
rdata (
const int attribute_index)
const
561 return this->m_rdata[attribute_index];
565 const int *
idata (
const int attribute_index)
const
567 return this->m_idata[attribute_index];
571 decltype(
auto) operator[] (const
int index)
const
573 if constexpr (!ParticleType::is_soa_particle) {
587 const int* comm_real,
const int * comm_int)
const noexcept
590 auto* dst = buffer + dst_offset;
591 if constexpr (!ParticleType::is_soa_particle) {
596 dst +=
sizeof(uint64_t);
598 int array_start_index = AMREX_SPACEDIM +
NStructReal;
599 for (
int i = 0; i < NArrayReal; ++i)
601 if (comm_real[array_start_index + i])
604 dst +=
sizeof(ParticleReal);
607 int runtime_start_index = AMREX_SPACEDIM +
NStructReal + NArrayReal;
610 if (comm_real[runtime_start_index + i])
613 dst +=
sizeof(ParticleReal);
617 for (
int i = 0; i < NArrayInt; ++i)
619 if (comm_int[array_start_index + i])
625 runtime_start_index = 2 +
NStructInt + NArrayInt;
628 if (comm_int[runtime_start_index + i])
636 template <
typename T = ParticleType, std::enable_if_t<!T::is_soa_particle,
int> = 0>
642 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
648 if constexpr(NArrayReal > 0) {
649 for (
int i = 0; i < NArrayReal; ++i) {
658 if constexpr(NArrayInt > 0) {
659 for (
int i = 0; i < NArrayInt; ++i) {
666 template <
typename T = ParticleType, std::enable_if_t<T::is_soa_particle,
int> = 0>
672 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {sp.
pos(i) =
m_rdata[i][index];}
674 for (
int i = 0; i <
NAR; ++i) {
677 for (
int i = 0; i <
NAI; ++i) {
690 template <
typename T_ParticleType,
int NArrayReal,
int NArrayInt,
694 template <
typename T>
698 static constexpr
int NAR = NArrayReal;
699 static constexpr
int NAI = NArrayInt;
707 using AoS = std::conditional_t<
708 ParticleType::is_soa_particle,
713 using SoA = std::conditional_t<
714 ParticleType::is_soa_particle,
737 int a_num_runtime_real,
738 int a_num_runtime_int,
739 std::vector<std::string>* soa_rdata_names=
nullptr,
740 std::vector<std::string>* soa_idata_names=
nullptr
744 GetStructOfArrays().define(a_num_runtime_real, a_num_runtime_int, soa_rdata_names, soa_idata_names);
752 decltype(
auto)
id (
int index) & {
753 if constexpr (!ParticleType::is_soa_particle) {
761 decltype(
auto)
id (
int index) const & {
762 if constexpr (!ParticleType::is_soa_particle) {
770 decltype(
auto)
cpu (
int index) & {
771 if constexpr (!ParticleType::is_soa_particle) {
779 decltype(
auto)
cpu (
int index) const & {
780 if constexpr (!ParticleType::is_soa_particle) {
789 if constexpr (!ParticleType::is_soa_particle) {
792 static_assert(NArrayReal == ParticleType::PTD::NAR,
"ParticleTile mismatch in R");
793 static_assert(NArrayInt == ParticleType::PTD::NAI,
"ParticleTile mismatch in I");
794 static_assert(0 == ParticleType::StorageParticleType::NReal,
"ParticleTile 2 mismatch in R");
795 static_assert(0 == ParticleType::StorageParticleType::NInt,
"ParticleTile 2 mismatch in I");
797 return m_soa_tile.GetRealData(position_index)[index];
804 if constexpr (!ParticleType::is_soa_particle) {
807 return m_soa_tile.GetRealData(position_index)[index];
825 if constexpr (!ParticleType::is_soa_particle) {
838 if constexpr (!ParticleType::is_soa_particle) {
851 if constexpr (!ParticleType::is_soa_particle) {
864 if constexpr (!ParticleType::is_soa_particle) {
877 if constexpr (!ParticleType::is_soa_particle) {
886 if constexpr(!ParticleType::is_soa_particle) {
894 if constexpr (!ParticleType::is_soa_particle) {
904 if constexpr (!ParticleType::is_soa_particle) {
913 template <
typename T = ParticleType, std::enable_if_t<!T::is_soa_particle,
int> = 0>
919 template <
int NR = NArrayReal,
int NI = NArrayInt,
920 std::enable_if_t<NR != 0 || NI != 0, int> foo = 0>
925 if constexpr (!ParticleType::is_soa_particle) {
927 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
941 if constexpr (ParticleType::is_soa_particle) {
946 for (
int i = 0; i < NArrayReal; ++i) {
949 for (
int i = 0; i < NArrayInt; ++i) {
967 for (
int i = 0; i < NArrayReal; ++i) {
1002 auto new_size =
m_soa_tile.GetRealData(comp).size() + npar;
1003 m_soa_tile.GetRealData(comp).resize(new_size, v);
1019 for (
int i = 0; i < NArrayInt; ++i) {
1054 auto new_size =
m_soa_tile.GetIntData(comp).size() + npar;
1055 m_soa_tile.GetIntData(comp).resize(new_size, v);
1068 if constexpr (ParticleType::is_soa_particle) {
1076 rdata.shrink_to_fit();
1082 idata.shrink_to_fit();
1089 if constexpr (ParticleType::is_soa_particle) {
1097 nbytes += rdata.capacity() *
sizeof(ParticleReal);
1103 nbytes += idata.capacity()*
sizeof(
int);
1110 if constexpr (ParticleType::is_soa_particle) {
1111 GetStructOfArrays().GetIdCPUData().swap(other.GetStructOfArrays().GetIdCPUData());
1113 m_aos_tile().swap(other.GetArrayOfStructs()());
1118 rdata.swap(other.GetStructOfArrays().GetRealData(j));
1124 idata.swap(other.GetStructOfArrays().GetIntData(j));
1132 #ifdef AMREX_USE_GPU
1133 bool copy_real =
false;
1146 bool copy_int =
false;
1169 if constexpr (!ParticleType::is_soa_particle) {
1172 ptd.
m_aos =
nullptr;
1174 if constexpr (ParticleType::is_soa_particle) {
1179 if constexpr(NArrayReal > 0) {
1180 for (
int i = 0; i < NArrayReal; ++i) {
1184 if constexpr(NArrayInt > 0) {
1185 for (
int i = 0; i < NArrayInt; ++i) {
1195 #ifdef AMREX_USE_GPU
1196 if (copy_real || copy_int) {
1208 #ifdef AMREX_USE_GPU
1209 bool copy_real =
false;
1222 bool copy_int =
false;
1245 if constexpr (!ParticleType::is_soa_particle) {
1248 ptd.
m_aos =
nullptr;
1250 if constexpr (ParticleType::is_soa_particle) {
1255 if constexpr(NArrayReal > 0) {
1256 for (
int i = 0; i < NArrayReal; ++i) {
1260 if constexpr(NArrayInt > 0) {
1261 for (
int i = 0; i < NArrayInt; ++i) {
1271 #ifdef AMREX_USE_GPU
1272 if (copy_real || copy_int) {
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_RESTRICT
Definition: AMReX_Extension.H:37
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
Definition: AMReX_GpuAllocators.H:114
Definition: AMReX_ArrayOfStructs.H:13
Definition: AMReX_PODVector.H:246
A Real vector in SpaceDim-dimensional space.
Definition: AMReX_RealVect.H:32
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
void streamSynchronize() noexcept
Definition: AMReX_GpuDevice.H:237
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void * memcpy(void *dest, const void *src, std::size_t count)
Definition: AMReX_GpuUtility.H:214
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition: AMReX_GpuDevice.H:251
constexpr Long LastParticleID
Definition: AMReX_Particle.H:20
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 end(BoxND< dim > const &box) noexcept
Definition: AMReX_Box.H:1890
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
const int[]
Definition: AMReX_BLProfiler.cpp:1664
Definition: AMReX_Particle.H:222
Definition: AMReX_Particle.H:188
static constexpr bool is_particle_tile_data
Definition: AMReX_ParticleTile.H:506
static constexpr int NAI
Definition: AMReX_ParticleTile.H:497
GpuArray< const int *, NArrayInt > m_idata
Definition: AMReX_ParticleTile.H:516
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SuperParticleType getSuperParticle(int index) const noexcept
Definition: AMReX_ParticleTile.H:638
const ParticleReal *AMREX_RESTRICT *AMREX_RESTRICT m_runtime_rdata
Definition: AMReX_ParticleTile.H:582
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE id(const int index) const &
Definition: AMReX_ParticleTile.H:529
const int *AMREX_RESTRICT *AMREX_RESTRICT m_runtime_idata
Definition: AMReX_ParticleTile.H:583
Long m_size
Definition: AMReX_ParticleTile.H:508
T_ParticleType ParticleType
Definition: AMReX_ParticleTile.H:498
static constexpr int NStructReal
Definition: AMReX_ParticleTile.H:501
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const ParticleReal * rdata(const int attribute_index) const
Definition: AMReX_ParticleTile.H:559
int m_num_runtime_real
Definition: AMReX_ParticleTile.H:580
static constexpr int NStructInt
Definition: AMReX_ParticleTile.H:502
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const int * idata(const int attribute_index) const
Definition: AMReX_ParticleTile.H:565
int m_num_runtime_int
Definition: AMReX_ParticleTile.H:581
std::conditional_t< T_ParticleType::is_soa_particle, void const *AMREX_RESTRICT, ParticleType const *AMREX_RESTRICT > AOS_PTR
Definition: AMReX_ParticleTile.H:511
T_ParticleType const & ParticleRefType
Definition: AMReX_ParticleTile.H:499
static constexpr int NAR
Definition: AMReX_ParticleTile.H:496
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE idcpu(const int index) const &
Definition: AMReX_ParticleTile.H:549
AOS_PTR m_aos
Definition: AMReX_ParticleTile.H:512
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const ParticleReal & pos(const int dir, const int index) const &
Definition: AMReX_ParticleTile.H:519
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void packParticleData(char *buffer, int src_index, Long dst_offset, const int *comm_real, const int *comm_int) const noexcept
Definition: AMReX_ParticleTile.H:586
const uint64_t * m_idcpu
Definition: AMReX_ParticleTile.H:514
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE cpu(const int index) const &
Definition: AMReX_ParticleTile.H:539
GpuArray< const ParticleReal *, NArrayReal > m_rdata
Definition: AMReX_ParticleTile.H:515
Definition: AMReX_ParticleTile.H:309
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const RealType & pos(int position_index) const &
Definition: AMReX_ParticleTile.H:341
static constexpr int NArrayReal
Definition: AMReX_ParticleTile.H:310
ParticleReal RealType
Definition: AMReX_ParticleTile.H:317
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConstParticleCPUWrapper cpu() const
Definition: AMReX_ParticleTile.H:330
static constexpr int NArrayInt
Definition: AMReX_ParticleTile.H:311
ConstPTD m_constparticle_tile_data
Definition: AMReX_ParticleTile.H:363
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
Definition: AMReX_ParticleTile.H:338
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConstParticleIDWrapper id() const
Definition: AMReX_ParticleTile.H:333
static void NextID(Long nextid)
Reset on restart.
int m_index
Definition: AMReX_ParticleTile.H:366
static constexpr bool is_constsoa_particle
Definition: AMReX_ParticleTile.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConstSoAParticle(ConstPTD const &ptd, long i)
Definition: AMReX_ParticleTile.H:320
static Long UnprotectedNextID()
This version can only be used inside omp critical.
uint64_t m_idcpu
Definition: AMReX_Particle.H:252
Definition: AMReX_Particle.H:140
Definition: AMReX_Particle.H:37
Definition: AMReX_ParticleTile.H:32
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void unpackParticleData(const char *buffer, Long src_offset, int dst_index, const int *comm_real, const int *comm_int) const noexcept
Definition: AMReX_ParticleTile.H:176
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void setSuperParticle(const SuperParticleType &sp, int index) const noexcept
Definition: AMReX_ParticleTile.H:271
T_ParticleType & ParticleRefType
Definition: AMReX_ParticleTile.H:37
uint64_t * m_idcpu
Definition: AMReX_ParticleTile.H:53
GpuArray< ParticleReal *, NAR > m_rdata
Definition: AMReX_ParticleTile.H:54
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SuperParticleType getSuperParticle(int index) const noexcept
Definition: AMReX_ParticleTile.H:228
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE idcpu(const int index) const &
Definition: AMReX_ParticleTile.H:93
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleReal & pos(const int dir, const int index) const &
Definition: AMReX_ParticleTile.H:63
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleReal * rdata(const int attribute_index) const
Definition: AMReX_ParticleTile.H:103
static constexpr int NStructInt
Definition: AMReX_ParticleTile.H:41
GpuArray< int *, NAI > m_idata
Definition: AMReX_ParticleTile.H:55
T_ParticleType ParticleType
Definition: AMReX_ParticleTile.H:36
std::conditional_t< T_ParticleType::is_soa_particle, void *AMREX_RESTRICT, ParticleType *AMREX_RESTRICT > AOS_PTR
Definition: AMReX_ParticleTile.H:50
int m_num_runtime_int
Definition: AMReX_ParticleTile.H:58
Long m_size
Definition: AMReX_ParticleTile.H:47
static constexpr int NAR
Definition: AMReX_ParticleTile.H:33
ParticleReal *AMREX_RESTRICT *AMREX_RESTRICT m_runtime_rdata
Definition: AMReX_ParticleTile.H:59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void packParticleData(char *buffer, int src_index, std::size_t dst_offset, const int *comm_real, const int *comm_int) const noexcept
Definition: AMReX_ParticleTile.H:125
int m_num_runtime_real
Definition: AMReX_ParticleTile.H:57
static constexpr bool is_particle_tile_data
Definition: AMReX_ParticleTile.H:45
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE cpu(const int index) const &
Definition: AMReX_ParticleTile.H:83
AOS_PTR m_aos
Definition: AMReX_ParticleTile.H:51
int *AMREX_RESTRICT *AMREX_RESTRICT m_runtime_idata
Definition: AMReX_ParticleTile.H:60
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int * idata(const int attribute_index) const
Definition: AMReX_ParticleTile.H:109
static constexpr int NAI
Definition: AMReX_ParticleTile.H:34
static constexpr int NStructReal
Definition: AMReX_ParticleTile.H:40
AMREX_GPU_HOST_DEVICEdecltype(auto) AMREX_FORCE_INLINE id(const int index) const &
Definition: AMReX_ParticleTile.H:73
Definition: AMReX_ParticleTile.H:693
typename ParticleType::StorageParticleType StorageParticleType
Definition: AMReX_ParticleTile.H:719
int NumRealComps() const noexcept
Definition: AMReX_ParticleTile.H:1058
const AoS & GetArrayOfStructs() const
Definition: AMReX_ParticleTile.H:812
void push_back_real(int comp, amrex::Vector< amrex::ParticleReal > const &vec)
Definition: AMReX_ParticleTile.H:993
int NumIntComps() const noexcept
Definition: AMReX_ParticleTile.H:1060
typename ParticleType::RealType RealType
Definition: AMReX_ParticleTile.H:700
int getNumNeighbors() const
Definition: AMReX_ParticleTile.H:892
AoS & GetArrayOfStructs()
Definition: AMReX_ParticleTile.H:811
amrex::PODVector< const int *, Allocator< const int * > > m_runtime_i_cptrs
Definition: AMReX_ParticleTile.H:1291
void push_back(const ParticleType &p)
Definition: AMReX_ParticleTile.H:914
ParticleTile(ParticleTile const &)=delete
std::conditional_t< ParticleType::is_soa_particle, StructOfArrays< NArrayReal, NArrayInt, Allocator, true >, StructOfArrays< NArrayReal, NArrayInt, Allocator, false > > SoA
Definition: AMReX_ParticleTile.H:716
static constexpr int NAI
Definition: AMReX_ParticleTile.H:699
ParticleTile(ParticleTile &&) noexcept=default
void push_back_real(int comp, const ParticleReal *beg, const ParticleReal *end)
Definition: AMReX_ParticleTile.H:976
void define(int a_num_runtime_real, int a_num_runtime_int, std::vector< std::string > *soa_rdata_names=nullptr, std::vector< std::string > *soa_idata_names=nullptr)
Definition: AMReX_ParticleTile.H:736
static constexpr int NStructInt
Definition: AMReX_ParticleTile.H:703
amrex::Gpu::HostVector< const ParticleReal * > m_h_runtime_r_cptrs
Definition: AMReX_ParticleTile.H:1296
void setNumNeighbors(int num_neighbors)
Definition: AMReX_ParticleTile.H:884
amrex::Gpu::HostVector< int * > m_h_runtime_i_ptrs
Definition: AMReX_ParticleTile.H:1294
Long capacity() const
Definition: AMReX_ParticleTile.H:1086
int numTotalParticles() const
Returns the total number of particles, real and neighbor.
Definition: AMReX_ParticleTile.H:875
AoS m_aos_tile
Definition: AMReX_ParticleTile.H:1282
std::size_t size() const
Returns the total number of particles (real and neighbor)
Definition: AMReX_ParticleTile.H:823
ParticleTileDataType getParticleTileData()
Definition: AMReX_ParticleTile.H:1128
void push_back(const SuperParticleType &sp)
Definition: AMReX_ParticleTile.H:921
int numNeighborParticles() const
Returns the number of neighbor particles (excluding reals)
Definition: AMReX_ParticleTile.H:862
amrex::PODVector< ParticleReal *, Allocator< ParticleReal * > > m_runtime_r_ptrs
Definition: AMReX_ParticleTile.H:1287
static constexpr int NAR
Definition: AMReX_ParticleTile.H:698
ConstParticleTileDataType getConstParticleTileData() const
Definition: AMReX_ParticleTile.H:1204
void shrink_to_fit()
Definition: AMReX_ParticleTile.H:1066
T_ParticleType ParticleType
Definition: AMReX_ParticleTile.H:697
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:836
void push_back_int(int comp, amrex::Vector< int > const &vec)
Definition: AMReX_ParticleTile.H:1045
amrex::Gpu::HostVector< ParticleReal * > m_h_runtime_r_ptrs
Definition: AMReX_ParticleTile.H:1293
const SoA & GetStructOfArrays() const
Definition: AMReX_ParticleTile.H:815
void swap(ParticleTile< ParticleType, NArrayReal, NArrayInt, Allocator > &other) noexcept
Definition: AMReX_ParticleTile.H:1108
void push_back_int(int comp, amrex::Vector< int >::const_iterator beg, amrex::Vector< int >::const_iterator end)
Definition: AMReX_ParticleTile.H:1037
void push_back_real(const std::array< ParticleReal, NArrayReal > &v)
Definition: AMReX_ParticleTile.H:966
int NumRuntimeRealComps() const noexcept
Definition: AMReX_ParticleTile.H:1062
SoA & GetStructOfArrays()
Definition: AMReX_ParticleTile.H:814
amrex::Gpu::HostVector< const int * > m_h_runtime_i_cptrs
Definition: AMReX_ParticleTile.H:1297
amrex::PODVector< const ParticleReal *, Allocator< const ParticleReal * > > m_runtime_r_cptrs
Definition: AMReX_ParticleTile.H:1290
RealType & pos(int index, int position_index) &
Definition: AMReX_ParticleTile.H:788
void resize(std::size_t count)
Definition: AMReX_ParticleTile.H:902
typename SoA::IntVector IntVector
Definition: AMReX_ParticleTile.H:718
void push_back_int(const std::array< int, NArrayInt > &v)
Definition: AMReX_ParticleTile.H:1018
void push_back_real(int comp, amrex::Vector< amrex::ParticleReal >::const_iterator beg, amrex::Vector< amrex::ParticleReal >::const_iterator end)
Definition: AMReX_ParticleTile.H:985
Allocator< T > AllocatorType
Definition: AMReX_ParticleTile.H:695
int NumRuntimeIntComps() const noexcept
Definition: AMReX_ParticleTile.H:1064
bool empty() const
Definition: AMReX_ParticleTile.H:817
void push_back_int(int comp, int v)
Definition: AMReX_ParticleTile.H:1010
RealType pos(int index, int position_index) const &
Definition: AMReX_ParticleTile.H:802
decltype(auto) cpu(int index) &
Definition: AMReX_ParticleTile.H:770
SoA m_soa_tile
Definition: AMReX_ParticleTile.H:1283
void push_back_int(int comp, std::size_t npar, int v)
Definition: AMReX_ParticleTile.H:1053
bool m_defined
Definition: AMReX_ParticleTile.H:1285
void push_back_real(int comp, std::size_t npar, ParticleReal v)
Definition: AMReX_ParticleTile.H:1001
void push_back_int(int comp, const int *beg, const int *end)
Definition: AMReX_ParticleTile.H:1028
typename SoA::RealVector RealVector
Definition: AMReX_ParticleTile.H:717
amrex::PODVector< int *, Allocator< int * > > m_runtime_i_ptrs
Definition: AMReX_ParticleTile.H:1288
int numRealParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_ParticleTile.H:849
std::conditional_t< ParticleType::is_soa_particle, ThisParticleTileHasNoAoS, ArrayOfStructs< ParticleType, Allocator > > AoS
Definition: AMReX_ParticleTile.H:710
decltype(auto) id(int index) &
Definition: AMReX_ParticleTile.H:752
static constexpr int NStructReal
Definition: AMReX_ParticleTile.H:702
void push_back_real(int comp, ParticleReal v)
Definition: AMReX_ParticleTile.H:958
The struct used to store particles.
Definition: AMReX_Particle.H:295
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleIDWrapper id() &
Definition: AMReX_Particle.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
Definition: AMReX_Particle.H:338
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealType & rdata(int index) &
Definition: AMReX_Particle.H:356
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int & idata(int index) &
Definition: AMReX_Particle.H:427
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleCPUWrapper cpu() &
Definition: AMReX_Particle.H:312
Definition: AMReX_Particle.H:281
Definition: AMReX_ParticleTile.H:371
static constexpr int NArrayReal
Definition: AMReX_ParticleTile.H:372
static Long UnprotectedNextID()
This version can only be used inside omp critical.
Definition: AMReX_ParticleTile.H:477
PTD m_particle_tile_data
Definition: AMReX_ParticleTile.H:445
static Long the_next_id
Definition: AMReX_ParticleTile.H:388
static constexpr int NArrayInt
Definition: AMReX_ParticleTile.H:373
int m_index
Definition: AMReX_ParticleTile.H:448
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleCPUWrapper cpu() &
Definition: AMReX_ParticleTile.H:393
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const uint64_t & idcpu() const &
Definition: AMReX_ParticleTile.H:408
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConstParticleCPUWrapper cpu() const &
Definition: AMReX_ParticleTile.H:402
ParticleReal RealType
Definition: AMReX_ParticleTile.H:380
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealType pos(int position_index) const &
Definition: AMReX_ParticleTile.H:423
static constexpr bool is_constsoa_particle
Definition: AMReX_ParticleTile.H:377
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleIDWrapper id() &
Definition: AMReX_ParticleTile.H:396
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SoAParticle(PTD const &ptd, long i)
Definition: AMReX_ParticleTile.H:383
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
Definition: AMReX_ParticleTile.H:413
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealType & pos(int position_index) &
Definition: AMReX_ParticleTile.H:416
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConstParticleIDWrapper id() const &
Definition: AMReX_ParticleTile.H:405
static Long NextID()
Definition: AMReX_ParticleTile.H:456
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE uint64_t & idcpu() &
Definition: AMReX_ParticleTile.H:399
Definition: AMReX_StructOfArrays.H:20
Definition: AMReX_ParticleTile.H:686
Definition: AMReX_ParticleTile.H:684
Definition: AMReX_MakeParticle.H:11