1 #ifndef AMREX_STRUCTOFARRAYS_H_
2 #define AMREX_STRUCTOFARRAYS_H_
3 #include <AMReX_Config.H>
17 template <
int NReal,
int NInt,
19 bool use64BitIdCpu=
false>
27 int a_num_runtime_real,
28 int a_num_runtime_int,
29 std::vector<std::string>* soa_rdata_names=
nullptr,
30 std::vector<std::string>* soa_idata_names=
nullptr
62 return std::vector<std::string>();
73 return std::vector<std::string>();
83 if constexpr (NReal == 0) {
102 if constexpr (NReal == 0) {
124 int const index = std::distance(
m_rdata_names->begin(), pos);
137 int const index = std::distance(
m_rdata_names->begin(), pos);
147 if constexpr (NInt == 0) {
167 if constexpr (NInt == 0) {
190 int const index = std::distance(
m_idata_names->begin(), pos);
204 int const index = std::distance(
m_idata_names->begin(), pos);
212 [[nodiscard]] std::size_t
size ()
const
214 if constexpr (use64BitIdCpu ==
true) {
216 }
else if constexpr (NReal > 0) {
218 }
else if constexpr (NInt > 0) {
235 [[nodiscard]]
bool empty ()
const {
return this->
size() == 0; }
265 resize(nrp + num_neighbors);
272 if constexpr (use64BitIdCpu ==
true) {
275 if constexpr (NReal > 0) {
276 for (
int i = 0; i < NReal; ++i) {
m_rdata[i].resize(count); }
278 if constexpr (NInt > 0) {
279 for (
int i = 0; i < NInt; ++i) {
m_idata[i].resize(count); }
286 if constexpr (use64BitIdCpu ==
true) {
296 for (
int i = 0; i < NReal; ++i)
306 for (
int i = 0; i < NInt; ++i)
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition: AMReX_BLassert.H:49
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
Definition: AMReX_PODVector.H:246
size_type size() const noexcept
Definition: AMReX_PODVector.H:575
void resize(size_type a_new_size)
Definition: AMReX_PODVector.H:625
T * dataPtr() noexcept
Definition: AMReX_PODVector.H:597
Definition: AMReX_Amr.cpp:49
amrex::ArenaAllocator< T > DefaultAllocator
Definition: AMReX_GpuAllocators.H:194
const int[]
Definition: AMReX_BLProfiler.cpp:1664
Definition: AMReX_Array.H:34
Definition: AMReX_StructOfArrays.H:20
std::array< IntVector, NInt > m_idata
Definition: AMReX_StructOfArrays.H:319
void setNumNeighbors(int num_neighbors)
Definition: AMReX_StructOfArrays.H:261
int getNumNeighbors() const
Definition: AMReX_StructOfArrays.H:268
IdCPU & GetIdCPUData()
Definition: AMReX_StructOfArrays.H:44
std::vector< IntVector > m_runtime_idata
Definition: AMReX_StructOfArrays.H:323
int numTotalParticles() const
Returns the total number of particles (real and neighbor)
Definition: AMReX_StructOfArrays.H:259
const IntVector & GetIntData(const int index) const
Definition: AMReX_StructOfArrays.H:165
std::vector< RealVector > m_runtime_rdata
Definition: AMReX_StructOfArrays.H:322
bool empty() const
Returns whether the SoA is empty (i.e. has size() == 0)
Definition: AMReX_StructOfArrays.H:235
std::array< IntVector, NInt > & GetIntData()
Definition: AMReX_StructOfArrays.H:46
bool m_defined
whether the runtime components are sized correctly
Definition: AMReX_StructOfArrays.H:330
std::vector< std::string > GetIntNames() const
Definition: AMReX_StructOfArrays.H:67
const std::array< IntVector, NInt > & GetIntData() const
Definition: AMReX_StructOfArrays.H:53
const RealVector & GetRealData(std::string const &name) const
Definition: AMReX_StructOfArrays.H:132
std::array< RealVector, NReal > & GetRealData()
Definition: AMReX_StructOfArrays.H:45
void resize(size_t count)
Definition: AMReX_StructOfArrays.H:270
uint64_t * idcpuarray()
Definition: AMReX_StructOfArrays.H:285
GpuArray< ParticleReal *, NReal > realarray()
Definition: AMReX_StructOfArrays.H:293
RealVector & GetRealData(std::string const &name)
Definition: AMReX_StructOfArrays.H:119
IdCPU m_idcpu
Definition: AMReX_StructOfArrays.H:317
int NumRealComps() const noexcept
Definition: AMReX_StructOfArrays.H:40
IntVector & GetIntData(std::string const &name)
Definition: AMReX_StructOfArrays.H:185
std::vector< std::string > GetRealNames() const
Definition: AMReX_StructOfArrays.H:56
const IntVector & GetIntData(std::string const &name) const
Definition: AMReX_StructOfArrays.H:199
int numParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_StructOfArrays.H:241
const std::array< RealVector, NReal > & GetRealData() const
Definition: AMReX_StructOfArrays.H:51
int m_num_neighbor_particles
Definition: AMReX_StructOfArrays.H:313
GpuArray< int *, NInt > intarray()
Definition: AMReX_StructOfArrays.H:303
std::vector< std::string > * m_rdata_names
Definition: AMReX_StructOfArrays.H:326
const IdCPU & GetIdCPUData() const
Definition: AMReX_StructOfArrays.H:49
std::array< RealVector, NReal > m_rdata
Definition: AMReX_StructOfArrays.H:318
IntVector & GetIntData(const int index)
Definition: AMReX_StructOfArrays.H:145
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_StructOfArrays.H:26
std::vector< std::string > * m_idata_names
Definition: AMReX_StructOfArrays.H:327
RealVector & GetRealData(const int index)
Definition: AMReX_StructOfArrays.H:81
const RealVector & GetRealData(const int index) const
Definition: AMReX_StructOfArrays.H:100
int numRealParticles() const
Returns the number of real particles (excluding neighbors)
Definition: AMReX_StructOfArrays.H:247
std::size_t size() const
Returns the total number of particles (real and neighbor)
Definition: AMReX_StructOfArrays.H:212
int NumIntComps() const noexcept
Definition: AMReX_StructOfArrays.H:42
int numNeighborParticles() const
Returns the number of neighbor particles (excluding reals)
Definition: AMReX_StructOfArrays.H:253