1 #ifndef AMREX_PARTICLE_CONTAINER_H_
2 #define AMREX_PARTICLE_CONTAINER_H_
3 #include <AMReX_Config.H>
65 #include <type_traits>
71 #ifdef AMREX_USE_HDF5_ASYNC
72 extern hid_t es_par_g;
114 template<
int NStructReal,
int NStructInt,
int NArrayReal,
int NArrayInt>
123 template <
bool is_const,
typename T_ParticleType,
int NArrayReal,
int NArrayInt,
124 template<
class>
class Allocator,
class CellAssignor>
140 template <
typename T_ParticleType,
int T_NArrayReal,
int T_NArrayInt,
167 template <
typename T>
174 #ifdef AMREX_SINGLE_PRECISION_PARTICLES
388 const IntVect* Nrep =
nullptr);
504 void Redistribute (
int lev_min = 0,
int lev_max = -1,
int nGrow = 0,
int local=0,
505 bool remove_negative=
true);
519 template <
class index_type>
561 bool OK (
int lev_min = 0,
int lev_max = -1,
int nGrow = 0)
const;
676 template <
class PCType,
677 std::enable_if_t<IsParticleContainer<PCType>::value,
int> foo = 0>
687 template <
class PCType,
688 std::enable_if_t<IsParticleContainer<PCType>::value,
int> foo = 0>
705 template <
class F,
class PCType,
706 std::enable_if_t<IsParticleContainer<PCType>::value,
int> foo = 0,
707 std::enable_if_t<! std::is_integral_v<F>,
int> bar = 0>
723 template <
class F,
class PCType,
724 std::enable_if_t<IsParticleContainer<PCType>::value,
int> foo = 0,
725 std::enable_if_t<! std::is_integral_v<F>,
int> bar = 0>
755 void Checkpoint (
const std::string& dir,
const std::string& name,
759 Checkpoint(dir, name,
true, real_comp_names, int_comp_names);
767 void Checkpoint (
const std::string& dir,
const std::string& name,
bool is_checkpoint,
787 const std::string& name,
792 F&&
f,
bool is_checkpoint=
false)
const;
804 void Restart (
const std::string& dir,
const std::string& file);
813 void Restart (
const std::string& dir,
const std::string& file,
bool is_checkpoint);
821 void WritePlotFile (
const std::string& dir,
const std::string& name)
const;
834 template <
class F, std::enable_if_t<!std::is_same_v<std::decay_t<F>, Vector<std::
string>>>* =
nullptr>
835 void WritePlotFile (
const std::string& dir,
const std::string& name, F&&
f)
const;
845 void WritePlotFile (
const std::string& dir,
const std::string& name,
875 void WritePlotFile (
const std::string& dir,
const std::string& name,
891 template <
class F, std::enable_if_t<!std::is_same_v<std::decay_t<F>, Vector<std::
string>>>* =
nullptr>
905 const std::string& name,
925 const std::string& name,
943 const std::string& name,
969 const std::string& name,
1047 {
return m_particles[lev].at(std::make_pair(grid, tile)); }
1072 {
return m_particles[lev].at(std::make_pair(grid, tile)); }
1095 template <
class Iterator>
1097 {
return ParticlesAt(lev, iter.index(), iter.LocalTileIndex()); }
1120 template <
class Iterator>
1122 {
return ParticlesAt(lev, iter.index(), iter.LocalTileIndex()); }
1174 template <
class Iterator>
1177 auto index = std::make_pair(iter.index(), iter.LocalTileIndex());
1193 Vector<std::unique_ptr<MultiFab> >& mf_to_be_filled,
1194 int lev_min,
int ncomp,
int finest_level,
int ngrow=2)
const;
1197 int ncomp=1,
int particle_lvl_offset = 0)
const;
1199 template <
typename P,
typename Assignor=CellAssignor>
1219 template <
typename P>
1244 void RedistributeCPU (
int lev_min = 0,
int lev_max = -1,
int nGrow = 0,
int local=0,
1245 bool remove_negative=
true);
1247 void RedistributeGPU (
int lev_min = 0,
int lev_max = -1,
int nGrow = 0,
int local=0,
1248 bool remove_negative=
true);
1263 for (
int lev = 0; lev <
numLevels(); ++lev) {
1266 auto np = tile.numParticles();
1268 auto& soa = tile.GetStructOfArrays();
1291 for (
int lev = 0; lev <
numLevels(); ++lev) {
1294 auto np = tile.numParticles();
1296 auto& soa = tile.GetStructOfArrays();
1389 template <
typename P>
1391 int lev_min = 0,
int lev_max = -1,
int nGrow=0,
int local_grid=-1)
const;
1404 template <
typename P>
1406 int lev_min = 0,
int lev_max = -1,
int local_grid=-1)
const;
1413 const Vector<std::map<std::pair<int, int>,
IntVector>>& particle_io_flags,
bool is_checkpoint)
const;
1414 #ifdef AMREX_USE_HDF5
1419 void SetSoACompileTimeNames (std::vector<std::string>
const & rdata_name, std::vector<std::string>
const & idata_name);
1429 template <
class RTYPE>
1430 void ReadParticles (
int cnt,
int grd,
int lev, std::ifstream& ifs,
int finest_level_in_file,
bool convert_ids);
1444 int lev_min = 0,
int lev_max = 0,
int nGrow = 0,
int local=0);
1446 template <
typename P>
1448 int lev_min,
int lev_max,
int nGrow,
int local_grid=-1)
const;
1465 template <
int T_NStructReal,
int T_NStructInt,
int T_NArrayReal,
int T_NArrayInt,
template<
class>
class Allocator,
class CellAssignor>
1476 #ifdef AMREX_USE_HDF5
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
Definition: AMReX_GpuAllocators.H:114
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:550
A container for storing items in a set of bins.
Definition: AMReX_DenseBins.H:77
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
static const RealDescriptor & Native64RealDescriptor()
Definition: AMReX_FPC.cpp:137
static const RealDescriptor & Native32RealDescriptor()
NativeRealDescriptor is equivalent to Native32RealDescriptor if BL_FLOAT is used. Otherwise,...
Definition: AMReX_FPC.cpp:124
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
Definition: AMReX_MFIter.H:57
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition: AMReX_MFIter.H:141
A collection (stored as an array) of FArrayBox objects.
Definition: AMReX_MultiFab.H:38
Definition: AMReX_PODVector.H:246
Definition: AMReX_ParIter.H:142
Definition: AMReX_ParGDB.H:13
Definition: AMReX_ParIter.H:32
Definition: AMReX_ParIter.H:113
Definition: AMReX_ParticleContainerBase.H:23
ParGDBBase * m_gdb
Definition: AMReX_ParticleContainerBase.H:269
void Define(ParGDBBase *gdb)
Definition: AMReX_ParticleContainerBase.H:83
int numLevels() const
the number of defined levels in the ParticleContainer
Definition: AMReX_ParticleContainerBase.H:222
A distributed container for Particles sorted onto the levels, grids, and tiles of a block-structured ...
Definition: AMReX_ParticleContainer.H:145
void AssignDensity(int rho_index, Vector< std::unique_ptr< MultiFab > > &mf_to_be_filled, int lev_min, int ncomp, int finest_level, int ngrow=2) const
Functions depending the layout of the data. Use with caution.
Definition: AMReX_AmrParticles.H:17
void SetUseUnlink(bool tf) const
Definition: AMReX_ParticleContainer.H:1236
Vector< ParticleLevel > m_particles
Definition: AMReX_ParticleContainer.H:1458
Vector< Long > nParticlesAtLevelPrePost
Definition: AMReX_ParticleContainer.H:1367
void WriteBinaryParticleData(const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F &&f, bool is_checkpoint=false) const
Writes particle data to disk in the AMReX native format.
void InitFromBinaryFile(const std::string &file, int extradata)
Definition: AMReX_ParticleInit.H:483
bool GetLevelDirectoriesCreated() const
Definition: AMReX_ParticleContainer.H:1224
size_t superparticle_size
Definition: AMReX_ParticleContainer.H:1456
void AddIntComp(std::string const &name, int communicate=1)
Definition: AMReX_ParticleContainer.H:1280
std::array< Long, 3 > ByteSpread() const
Definition: AMReX_ParticleContainerI.H:501
void clearParticles()
Clear all the particles in this container. This does not free memory.
Definition: AMReX_ParticleContainerI.H:1010
void copyParticles(const PCType &other, bool local=false)
Copy particles from other to this ParticleContainer. Will clear all the particles from this container...
bool doUnlink
Definition: AMReX_ParticleContainer.H:1363
Vector< Vector< int > > whichPrePost
Definition: AMReX_ParticleContainer.H:1368
void WriteParticleRealData(void *data, size_t size, std::ostream &os) const
Write a contiguous chunk of real particle data to an ostream.
Definition: AMReX_ParticleIO.H:11
const ParticleTileType & ParticlesAt(int lev, const Iterator &iter) const
Return the ParticleTile for level "lev" and Iterator "iter". Const version.
Definition: AMReX_ParticleContainer.H:1096
ParticleContainer_impl(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
Same as the above, but accepts different refinement ratios in each direction.
Definition: AMReX_ParticleContainer.H:277
std::string HdrFileNamePrePost
Definition: AMReX_ParticleContainer.H:1371
Vector< Vector< Long > > wherePrePost
Definition: AMReX_ParticleContainer.H:1370
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, F &&f) const
This version of WritePlotFile writes all components and allows the user to specify the names of the c...
RealDescriptor ParticleRealDescriptor
Definition: AMReX_ParticleContainer.H:177
ParticleTileType & DefineAndReturnParticleTile(int lev, int grid, int tile)
Define and return the ParticleTile for level "lev", grid "grid" and tile "tile.".
Definition: AMReX_ParticleContainer.H:1146
int nOutFilesPrePost
Definition: AMReX_ParticleContainer.H:1365
int maxnextidPrePost
Definition: AMReX_ParticleContainer.H:1364
void WritePlotFile(const std::string &dir, const std::string &name, F &&f) const
This version of WritePlotFile writes all components and assigns component names.
ParticleContainer_impl(ParticleContainer_impl &&) noexcept=default
void Checkpoint(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names=Vector< std::string >(), const Vector< std::string > &int_comp_names=Vector< std::string >()) const
Writes a particle checkpoint to file, suitable for restarting.
Definition: AMReX_ParticleContainer.H:755
void addParticles(const PCType &other, bool local=false)
Add particles from other to this ParticleContainer. local controls whether or not to call Redistribut...
std::map< std::pair< int, int >, ParticleTileType > ParticleLevel
Definition: AMReX_ParticleContainer.H:186
bool levelDirectoriesCreated
Variables for i/o optimization saved for pre and post checkpoint.
Definition: AMReX_ParticleContainer.H:1361
ContainerLike< NewAllocator > make_alike() const
Definition: AMReX_ParticleContainer.H:1344
void WriteAsciiFile(const std::string &file)
Definition: AMReX_ParticleIO.H:1104
std::vector< std::string > m_soa_idata_names
Definition: AMReX_ParticleContainer.H:1462
static constexpr int NArrayInt
Number of extra integer components stored in struct-of-array form.
Definition: AMReX_ParticleContainer.H:158
void Initialize()
Definition: AMReX_ParticleContainerI.H:37
static constexpr int NArrayReal
Number of extra Real components stored in struct-of-array form.
Definition: AMReX_ParticleContainer.H:156
int GetMaxNextIDPrePost() const
Definition: AMReX_ParticleContainer.H:1233
std::array< Long, 3 > PrintCapacity() const
Definition: AMReX_ParticleContainerI.H:545
bool GetUsePrePost() const
Definition: AMReX_ParticleContainer.H:1229
ParticleContainer_impl & operator=(const ParticleContainer_impl &)=delete
bool PeriodicShift(P &p) const
Returns true if the particle was shifted.
typename ParticleTileType::AoS AoS
Definition: AMReX_ParticleContainer.H:187
ParticleInitType< NStructReal, NStructInt, NArrayReal, NArrayInt > ParticleInitData
Definition: AMReX_ParticleContainer.H:182
typename SoA::RealVector RealVector
Definition: AMReX_ParticleContainer.H:190
typename ParticleType::ConstType ConstParticleType
Definition: AMReX_ParticleContainer.H:148
ParticleContainer_impl(const ParticleContainer_impl &)=delete
void WriteParticles(int level, std::ofstream &ofs, int fnum, Vector< int > &which, Vector< int > &count, Vector< Long > &where, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::map< std::pair< int, int >, IntVector >> &particle_io_flags, bool is_checkpoint) const
Definition: AMReX_ParticleIO.H:556
ParticleContainer_impl(const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
Construct a particle container using a given Geometry, DistributionMapping, and BoxArray....
Definition: AMReX_ParticleContainer.H:233
Long NumberOfParticlesAtLevel(int level, bool only_valid=true, bool only_local=false) const
Returns # of particles at specified the level.
Definition: AMReX_ParticleContainerI.H:455
void AssignCellDensitySingleLevel(int rho_index, MultiFab &mf, int level, int ncomp=1, int particle_lvl_offset=0) const
Definition: AMReX_ParticleContainerI.H:2401
void Increment(MultiFab &mf, int level)
Definition: AMReX_ParticleContainerI.H:605
void SetLevelDirectoriesCreated(bool tf)
Definition: AMReX_ParticleContainer.H:1222
void ReorderParticles(int lev, const MFIter &mfi, const index_type *permutations)
Reorder particles on the tile given by lev and mfi using a the permutations array.
typename AoS::ParticleVector ParticleVector
Definition: AMReX_ParticleContainer.H:192
const ParticleLevel & GetParticles(int lev) const
Return the ParticleLevel for level "lev". Const version.
Definition: AMReX_ParticleContainer.H:1007
void Define(const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
Define a default-constructed ParticleContainer using a ParGDB object. Single-level version.
Definition: AMReX_ParticleContainer.H:321
static constexpr int NStructInt
Number of extra integer components in the particle struct.
Definition: AMReX_ParticleContainer.H:154
ParticleContainer_impl()
Default constructor - construct an empty particle container that has no concept of a level hierarchy....
Definition: AMReX_ParticleContainer.H:199
void SetUsePrePost(bool tf) const
Definition: AMReX_ParticleContainer.H:1226
int NumRealComps() const
Definition: AMReX_ParticleContainer.H:1311
void WritePlotFilePre()
Definition: AMReX_ParticleIO.H:536
bool EnforcePeriodicWhere(P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int local_grid=-1) const
Checks whether the particle has crossed a periodic boundary in such a way that it is on levels lev_mi...
void RemoveParticlesAtLevel(int level)
The Following methods are for managing Virtual and Ghost Particles.
Definition: AMReX_ParticleContainerI.H:642
void InitFromAsciiFile(const std::string &file, int extradata, const IntVect *Nrep=nullptr)
Definition: AMReX_ParticleInit.H:37
ParticleTileType & DefineAndReturnParticleTile(int lev, const Iterator &iter)
Define and return the ParticleTile for level "lev", and Iterator "iter".
Definition: AMReX_ParticleContainer.H:1175
Long TotalNumberOfParticles(bool only_valid=true, bool only_local=false) const
Returns # of particles at all levels.
Definition: AMReX_ParticleContainerI.H:385
Vector< int > h_redistribute_int_comp
Definition: AMReX_ParticleContainer.H:1358
std::vector< std::string > m_soa_rdata_names
Definition: AMReX_ParticleContainer.H:1461
typename ParticleTileType::SoA SoA
Definition: AMReX_ParticleContainer.H:188
virtual void correctCellVectors(int, int, int, const ParticleType &)
Definition: AMReX_ParticleContainer.H:1440
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F &&f) const
This version of WritePlotFile writes all components and allows the user to specify the names of the c...
bool OK(int lev_min=0, int lev_max=-1, int nGrow=0) const
OK checks that all particles are in the right places (for some value of right)
Definition: AMReX_ParticleContainerI.H:2340
void locateParticle(P &p, ParticleLocData &pld, int lev_min, int lev_max, int nGrow, int local_grid=-1) const
int NumRuntimeIntComps() const
Definition: AMReX_ParticleContainer.H:1309
Long GetNParticlesPrePost() const
Definition: AMReX_ParticleContainer.H:1234
void InitRandom(Long icount, ULong iseed, const ParticleInitData &pdata, bool serialize=false, RealBox bx=RealBox())
This initializes the particle container with icount randomly distributed particles....
Definition: AMReX_ParticleInit.H:968
void ResizeRuntimeRealComp(int new_size, bool communicate)
Definition: AMReX_ParticleContainerI.H:2541
T_CellAssignor CellAssignor
Definition: AMReX_ParticleContainer.H:149
void RemoveParticlesNotAtFinestLevel()
Definition: AMReX_ParticleContainerI.H:656
DenseBins< typename ParticleTileType::ParticleTileDataType > m_bins
Definition: AMReX_ParticleContainer.H:1434
void ReadParticleRealData(void *data, size_t size, std::istream &is)
Read a contiguous chunk of real particle data from an istream.
Definition: AMReX_ParticleIO.H:25
void RedistributeCPU(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Definition: AMReX_ParticleContainerI.H:1479
int m_num_runtime_int
Definition: AMReX_ParticleContainer.H:1454
ParticleContainer_impl(ParGDBBase *gdb)
Construct a particle container using a ParGDB object. The container will track changes in the grid st...
Definition: AMReX_ParticleContainer.H:215
void Restart(const std::string &dir, const std::string &file)
Restart from checkpoint.
Definition: AMReX_ParticleIO.H:620
void WritePlotFilePost()
Definition: AMReX_ParticleIO.H:546
void Define(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
Define a default-constructed ParticleContainer using a ParGDB object. Multi-level version.
Definition: AMReX_ParticleContainer.H:358
void ReadParticles(int cnt, int grd, int lev, std::ifstream &ifs, int finest_level_in_file, bool convert_ids)
void CreateVirtualParticles(int level, AoS &virts) const
Creates virtual particles for a given level that represent in some capacity all particles at finer le...
Definition: AMReX_ParticleContainerI.H:723
int NumRuntimeRealComps() const
Definition: AMReX_ParticleContainer.H:1308
void Checkpoint(const std::string &dir, const std::string &name, bool is_checkpoint, const Vector< std::string > &real_comp_names=Vector< std::string >(), const Vector< std::string > &int_comp_names=Vector< std::string >()) const
Writes a particle checkpoint to file, suitable for restarting. This version allows the particle compo...
void AddIntComp(int communicate=1)
Definition: AMReX_ParticleContainer.H:1303
Long nparticlesPrePost
Definition: AMReX_ParticleContainer.H:1366
void InitNRandomPerCell(int n_per_cell, const ParticleInitData &pdata)
This initializes the particle container with n_per_cell randomly distributed particles per cell,...
Definition: AMReX_ParticleInit.H:1547
void WritePlotFile(const std::string &dir, const std::string &name) const
This version of WritePlotFile writes all components and assigns component names.
Definition: AMReX_ParticleIO.H:93
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, F &&f) const
This version of WritePlotFile assigns component names, but allows the user to pass in a vector of int...
int m_num_runtime_real
Definition: AMReX_ParticleContainer.H:1453
void copyParticles(const PCType &other, F &&f, bool local=false)
Copy particles from other to this ParticleContainer. Will clear all the particles from this container...
void CheckpointPre()
Definition: AMReX_ParticleIO.H:423
ParticleLocData Reset(ParticleType &prt, bool update, bool verbose=true, ParticleLocData pld=ParticleLocData()) const
Updates a particle's location (Where), tries to periodic shift any particles that have left the domai...
Definition: AMReX_ParticleContainerI.H:296
Vector< std::string > filePrefixPrePost
Definition: AMReX_ParticleContainer.H:1372
void RedistributeGPU(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Definition: AMReX_ParticleContainerI.H:1283
int numLocalTilesAtLevel(int lev) const
The total number of tiles on this rank on this level.
Definition: AMReX_ParticleContainer.H:369
void reserveData() override
This reserves data in the vector of dummy MultiFabs used by the ParticleContainer for the maximum num...
Definition: AMReX_ParticleContainerI.H:330
void WritePlotFile(const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, F &&f) const
This is the most general version of WritePlotFile, which takes component names and flags for whether ...
std::vector< std::string > GetRealSoANames() const
Definition: AMReX_ParticleContainer.H:1422
static constexpr int NStructReal
Number of extra Real components in the particle struct.
Definition: AMReX_ParticleContainer.H:152
Vector< int > h_redistribute_real_comp
Definition: AMReX_ParticleContainer.H:1357
std::vector< std::string > GetIntSoANames() const
Definition: AMReX_ParticleContainer.H:1425
typename Particle< NStructReal, NStructInt >::RealType RealType
The type of the Real data.
Definition: AMReX_ParticleContainer.H:172
bool GetUseUnlink() const
Definition: AMReX_ParticleContainer.H:1240
Vector< Long > NumberOfParticlesInGrid(int level, bool only_valid=true, bool only_local=false) const
Definition: AMReX_ParticleContainerI.H:400
int NumIntComps() const
Definition: AMReX_ParticleContainer.H:1312
Allocator< T > AllocatorType
The memory allocator in use.
Definition: AMReX_ParticleContainer.H:168
void RedistributeMPI(std::map< int, Vector< char > > ¬_ours, int lev_min=0, int lev_max=0, int nGrow=0, int local=0)
Definition: AMReX_ParticleContainerI.H:1993
ParticleLevel & GetParticles(int lev)
Return the ParticleLevel for level "lev". Non-const version.
Definition: AMReX_ParticleContainer.H:1022
void CreateGhostParticles(int level, int ngrow, ParticleTileType &ghosts) const
Create ghost particles for a given level that are copies of particles near coarse->fine boundaries in...
void AddParticlesAtLevel(ParticleTileType &particles, int level, int nGrow=0)
Add particles from a pbox to the grid at this level.
void ShrinkToFit()
Definition: AMReX_ParticleContainerI.H:585
void addParticles(const PCType &other, F const &f, bool local=false)
Add particles from other to this ParticleContainer. local controls whether or not to call Redistribut...
Vector< ParticleLevel > & GetParticles()
Return the underlying Vector (over AMR levels) of ParticleLevels. Non-const version.
Definition: AMReX_ParticleContainer.H:992
bool Where(const P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int nGrow=0, int local_grid=-1) const
Checks a particle's location on levels lev_min and higher. Returns false if the particle does not exi...
void Restart(const std::string &dir, const std::string &file, bool is_checkpoint)
Older version, for backwards compatibility.
void Define(ParGDBBase *gdb)
Define a default-constructed ParticleContainer using a ParGDB object. The container will track change...
Definition: AMReX_ParticleContainer.H:307
ParticleContainer_impl(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
Construct a particle container using a given Geometry, DistributionMapping, BoxArray and Vector of re...
Definition: AMReX_ParticleContainer.H:255
Long superParticleSize() const
Definition: AMReX_ParticleContainer.H:1250
typename SoA::IntVector IntVector
Definition: AMReX_ParticleContainer.H:191
int num_int_comm_comps
Definition: AMReX_ParticleContainer.H:1457
size_t particle_size
Definition: AMReX_ParticleContainer.H:1456
void SortParticlesByBin(IntVect bin_size)
Sort the particles on each tile by groups of cells, given an IntVect bin_size.
Definition: AMReX_ParticleContainerI.H:1220
virtual void particlePostLocate(ParticleType &, const ParticleLocData &, const int)
Definition: AMReX_ParticleContainer.H:1437
void CreateGhostParticles(int level, int ngrow, AoS &ghosts) const
Create ghost particles for a given level that are copies of particles near coarse->fine boundaries in...
void Define(const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
Define a default-constructed ParticleContainer using a ParGDB object. Multi-level version.
Definition: AMReX_ParticleContainer.H:339
void SetSoACompileTimeNames(std::vector< std::string > const &rdata_name, std::vector< std::string > const &idata_name)
Definition: AMReX_ParticleContainerI.H:84
void AddParticlesAtLevel(AoS &particles, int level, int nGrow=0)
Add particles from a pbox to the grid at this level.
void SortParticlesByCell()
Sort the particles on each tile by cell, using Fortran ordering.
Definition: AMReX_ParticleContainerI.H:1211
ParticleTileType & ParticlesAt(int lev, int grid, int tile)
Return the ParticleTile for level "lev", grid "grid" and tile "tile." Non-const version.
Definition: AMReX_ParticleContainer.H:1071
void ResizeRuntimeIntComp(int new_size, bool communicate)
Definition: AMReX_ParticleContainerI.H:2567
void InitFromBinaryMetaFile(const std::string &file, int extradata)
Definition: AMReX_ParticleInit.H:929
void resizeData() override
This resizes the vector of dummy MultiFabs used by the ParticleContainer for the current number of le...
Definition: AMReX_ParticleContainerI.H:339
void AddRealComp(std::string const &name, int communicate=1)
Definition: AMReX_ParticleContainer.H:1252
int num_real_comm_comps
Definition: AMReX_ParticleContainer.H:1457
ParticleTileType & ParticlesAt(int lev, const Iterator &iter)
Return the ParticleTile for level "lev" and Iterator "iter". Non-const version.
Definition: AMReX_ParticleContainer.H:1121
IntVect Index(const P &p, int lev) const
void Redistribute(int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
Redistribute puts all the particles back in the right places (for some value of right)
Definition: AMReX_ParticleContainerI.H:1100
Long IncrementWithTotal(MultiFab &mf, int level, bool local=false)
Definition: AMReX_ParticleContainerI.H:632
const Vector< ParticleLevel > & GetParticles() const
Return the underlying Vector (over AMR levels) of ParticleLevels. Const version.
Definition: AMReX_ParticleContainer.H:986
void InitOnePerCell(Real x_off, Real y_off, Real z_off, const ParticleInitData &pdata)
This initializes the particle container with one particle per cell, where the other particle data and...
Definition: AMReX_ParticleInit.H:1463
const ParticleTileType & ParticlesAt(int lev, int grid, int tile) const
Return the ParticleTile for level "lev", grid "grid" and tile "tile." Const version.
Definition: AMReX_ParticleContainer.H:1046
void SortParticlesForDeposition(IntVect idx_type)
Sort particles on each tile such that particles adjacent in memory are likely to map to adjacent cell...
Definition: AMReX_ParticleContainerI.H:1253
void AddRealComp(int communicate=1)
Definition: AMReX_ParticleContainer.H:1275
~ParticleContainer_impl() override=default
void CheckpointPost()
Definition: AMReX_ParticleIO.H:480
T_ParticleType ParticleType
Definition: AMReX_ParticleContainer.H:147
bool m_runtime_comps_defined
Definition: AMReX_ParticleContainer.H:1452
Vector< Vector< int > > countPrePost
Definition: AMReX_ParticleContainer.H:1369
void InitRandomPerBox(Long icount, ULong iseed, const ParticleInitData &pdata)
This initializes the container with icount randomly distributed particles per box,...
Definition: AMReX_ParticleInit.H:1362
bool usePrePost
Definition: AMReX_ParticleContainer.H:1362
void SetParticleSize()
Definition: AMReX_ParticleContainerI.H:11
A Box with real dimensions. A RealBox is OK iff volume >= 0.
Definition: AMReX_RealBox.H:21
A Descriptor of the Real Type.
Definition: AMReX_FabConv.H:105
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
Long size() const noexcept
Definition: AMReX_Vector.H:50
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
static constexpr int P
Definition: AMReX_OpenBC.H:14
Definition: AMReX_Amr.cpp:49
amrex::ArenaAllocator< T > DefaultAllocator
Definition: AMReX_GpuAllocators.H:194
int verbose
Definition: AMReX_DistributionMapping.cpp:36
Definition: AMReX_ParticleUtil.H:432
A struct used for communicating particle data across processes during multi-level operations.
Definition: AMReX_ParticleContainer.H:79
ParticleReal RealType
Definition: AMReX_ParticleContainer.H:80
int m_grid
Definition: AMReX_ParticleContainer.H:82
RealType m_data[1+AMREX_SPACEDIM]
Definition: AMReX_ParticleContainer.H:84
IntVect m_cell
Definition: AMReX_ParticleContainer.H:83
int m_lev
Definition: AMReX_ParticleContainer.H:81
A struct used to pass initial data into the various Init methods. This struct is used to pass initial...
Definition: AMReX_ParticleContainer.H:116
std::array< int, NStructInt > int_struct_data
Definition: AMReX_ParticleContainer.H:118
std::array< int, NArrayInt > int_array_data
Definition: AMReX_ParticleContainer.H:120
std::array< double, NArrayReal > real_array_data
Definition: AMReX_ParticleContainer.H:119
std::array< double, NStructReal > real_struct_data
Definition: AMReX_ParticleContainer.H:117
A struct used for storing a particle's position in the AMR hierarchy.
Definition: AMReX_ParticleContainer.H:91
Box m_grown_gridbox
Definition: AMReX_ParticleContainer.H:98
IntVect m_cell
Definition: AMReX_ParticleContainer.H:95
int m_grid
Definition: AMReX_ParticleContainer.H:93
int m_tile
Definition: AMReX_ParticleContainer.H:94
int m_lev
Definition: AMReX_ParticleContainer.H:92
Box m_tilebox
Definition: AMReX_ParticleContainer.H:97
Box m_gridbox
Definition: AMReX_ParticleContainer.H:96
Definition: AMReX_ParticleTile.H:693
std::conditional_t< ParticleType::is_soa_particle, StructOfArrays< NArrayReal, NArrayInt, Allocator, true >, StructOfArrays< NArrayReal, NArrayInt, Allocator, false > > SoA
Definition: AMReX_ParticleTile.H:716
std::conditional_t< ParticleType::is_soa_particle, ThisParticleTileHasNoAoS, ArrayOfStructs< ParticleType, Allocator > > AoS
Definition: AMReX_ParticleTile.H:710
The struct used to store particles.
Definition: AMReX_Particle.H:295
ParticleReal RealType
The floating point type used for the particles.
Definition: AMReX_Particle.H:307