ImpactX
Loading...
Searching...
No Matches
impactx::ImpactXParticleContainer Class Reference

#include <ImpactXParticleContainer.H>

Inheritance diagram for impactx::ImpactXParticleContainer:
amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor > amrex::ParticleContainerBase

Public Types

using iterator = impactx::ParIterSoA
 amrex iterator for particle boxes
 
using const_iterator = impactx::ParConstIterSoA
 amrex constant iterator for particle boxes (read-only)
 
- Public Types inherited from amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >
typedef T_ParticleType ParticleType
 
typedef typename ParticleType::ConstType ConstParticleType
 
typedef T_CellAssignor CellAssignor
 
typedef Allocator< T > AllocatorType
 
typedef Particle< NStructReal+NArrayReal, NStructInt+NArrayIntSuperParticleType
 
typedef typename Particle< NStructReal, NStructInt >::RealType RealType
 
typedef ParticleContainer_impl< ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignorParticleContainerType
 
typedef ParticleTile< ParticleType, NArrayReal, NArrayInt, Allocator > ParticleTileType
 
typedef ParticleInitType< NStructReal, NStructInt, NArrayReal, NArrayIntParticleInitData
 
typedef std::map< std::pair< int, int >, ParticleTileTypeParticleLevel
 
typedef typename ParticleTileType::ParticleTileDataType PTDType
 
typedef typename ParticleTileType::ConstParticleTileDataType ConstPTDType
 
typedef typename ParticleTileType::AoS AoS
 
typedef typename ParticleTileType::SoA SoA
 
typedef typename SoA::RealVector RealVector
 
typedef typename SoA::IntVector IntVector
 
typedef typename AoS::ParticleVector ParticleVector
 
typedef Gpu::DeviceVector< char > CharVector
 
typedef ParIter_impl< ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignorParIterType
 
typedef ParConstIter_impl< ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignorParConstIterType
 
typedef amrex::ParticleContainer_impl< ParticleType, NArrayReal, NArrayInt, NewAllocator > ContainerLike
 

Public Member Functions

 ImpactXParticleContainer (initialization::AmrCoreData *amr_core)
 Construct a new particle container.
 
virtual ~ImpactXParticleContainer ()=default
 Destruct a particle container.
 
void prepare ()
 
void clear (bool keep_mass=false, bool keep_charge=false)
 
void AddNParticles (amrex::Gpu::DeviceVector< amrex::ParticleReal > const &x, amrex::Gpu::DeviceVector< amrex::ParticleReal > const &y, amrex::Gpu::DeviceVector< amrex::ParticleReal > const &t, amrex::Gpu::DeviceVector< amrex::ParticleReal > const &px, amrex::Gpu::DeviceVector< amrex::ParticleReal > const &py, amrex::Gpu::DeviceVector< amrex::ParticleReal > const &pt, amrex::ParticleReal qm, std::optional< amrex::ParticleReal > bunch_charge=std::nullopt, std::optional< amrex::Gpu::DeviceVector< amrex::ParticleReal > > w=std::nullopt)
 
void SetLostParticleContainer (ImpactXParticleContainer *lost_pc)
 
ImpactXParticleContainerGetLostParticleContainer ()
 
void SetRefParticle (RefPart const &refpart)
 
RefPartGetRefParticle ()
 
RefPart const & GetRefParticle () const
 
void SetRefParticleEdge ()
 
int GetParticleShape () const
 
void SetParticleShape ()
 
void SetParticleShape (int order)
 
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > MinAndMaxPositions ()
 
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > MeanAndStdPositions ()
 
void DepositCharge (std::unordered_map< int, amrex::MultiFab > &rho, amrex::Vector< amrex::IntVect > const &ref_ratio)
 
CoordSystem GetCoordSystem () const
 
void SetCoordSystem (CoordSystem coord_system)
 
void record_beam_moments ()
 
std::unordered_map< std::string, amrex::ParticleReal > beam_moments ()
 
std::list< std::unordered_map< std::string, amrex::ParticleReal > > beam_moments_history ()
 
void reset_beam_moments_history ()
 
- Public Member Functions inherited from amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >
 ParticleContainer_impl ()
 
 ParticleContainer_impl (ParGDBBase *gdb)
 
 ParticleContainer_impl (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
 ParticleContainer_impl (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
 ParticleContainer_impl (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
 ~ParticleContainer_impl () override=default
 
 ParticleContainer_impl (const ParticleContainer_impl &)=delete
 
ParticleContainer_imploperator= (const ParticleContainer_impl &)=delete
 
 ParticleContainer_impl (ParticleContainer_impl &&) noexcept=default
 
ParticleContainer_imploperator= (ParticleContainer_impl &&) noexcept=default
 
void Define (ParGDBBase *gdb)
 
void Define (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
void Define (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
void Define (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
int numLocalTilesAtLevel (int lev) const
 
void reserveData () override
 
void resizeData () override
 
void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)
 
void InitFromBinaryFile (const std::string &file, int extradata)
 
void InitFromBinaryMetaFile (const std::string &file, int extradata)
 
void InitRandom (Long icount, ULong iseed, const ParticleInitData &pdata, bool serialize=false, RealBox bx=RealBox())
 
void InitRandomPerBox (Long icount, ULong iseed, const ParticleInitData &pdata)
 
void InitOnePerCell (Real x_off, Real y_off, Real z_off, const ParticleInitData &pdata)
 
void InitNRandomPerCell (int n_per_cell, const ParticleInitData &pdata)
 
void Increment (MultiFab &mf, int level)
 
Long IncrementWithTotal (MultiFab &mf, int level, bool local=false)
 
void Redistribute (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
 
void ReorderParticles (int lev, const MFIter &mfi, const index_type *permutations)
 
void SortParticlesForDeposition (IntVect idx_type)
 
void SortParticlesByCell ()
 
void SortParticlesByBin (IntVect bin_size)
 
bool OK (int lev_min=0, int lev_max=-1, int nGrow=0) const
 
std::array< Long, 3 > ByteSpread () const
 
std::array< Long, 3 > PrintCapacity () const
 
void ShrinkToFit ()
 
Long NumberOfParticlesAtLevel (int level, bool only_valid=true, bool only_local=false) const
 
Vector< Long > NumberOfParticlesInGrid (int level, bool only_valid=true, bool only_local=false) const
 
void CapacityOfParticlesInGrid (LayoutData< I > &mem, int lev) const
 
Long TotalNumberOfParticles (bool only_valid=true, bool only_local=false) const
 
void RemoveParticlesAtLevel (int level)
 
void RemoveParticlesNotAtFinestLevel ()
 
void CreateVirtualParticles (int level, AoS &virts) const
 
void CreateGhostParticles (int level, int ngrow, AoS &ghosts) const
 
void AddParticlesAtLevel (AoS &particles, int level, int nGrow=0)
 
void CreateVirtualParticles (int level, ParticleTileType &virts) const
 
void CreateGhostParticles (int level, int ngrow, ParticleTileType &ghosts) const
 
void AddParticlesAtLevel (ParticleTileType &particles, int level, int nGrow=0)
 
void clearParticles ()
 
void copyParticles (const PCType &other, bool local=false)
 
void addParticles (const PCType &other, bool local=false)
 
void copyParticles (const PCType &other, F &&f, bool local=false)
 
void addParticles (const PCType &other, F const &f, bool local=false)
 
void WriteParticleRealData (void *data, size_t size, std::ostream &os) const
 
void ReadParticleRealData (void *data, size_t size, std::istream &is)
 
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
 
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
 
void Checkpoint (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) const
 
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
 
void CheckpointPre ()
 
void CheckpointPost ()
 
void Restart (const std::string &dir, const std::string &file)
 
void Restart (const std::string &dir, const std::string &file, bool is_checkpoint)
 
void WritePlotFile (const std::string &dir, const std::string &name) const
 
void WritePlotFile (const std::string &dir, const std::string &name, F &&f) const
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names) const
 
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
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names) const
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, F &&f) const
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp) const
 
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
 
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) const
 
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
 
void WritePlotFilePre ()
 
void WritePlotFilePost ()
 
void WriteAsciiFile (const std::string &file)
 
const Vector< ParticleLevel > & GetParticles () const
 
Vector< ParticleLevel > & GetParticles ()
 
const ParticleLevelGetParticles (int lev) const
 
ParticleLevelGetParticles (int lev)
 
const ParticleTileTypeParticlesAt (int lev, int grid, int tile) const
 
ParticleTileTypeParticlesAt (int lev, int grid, int tile)
 
const ParticleTileTypeParticlesAt (int lev, const Iterator &iter) const
 
ParticleTileTypeParticlesAt (int lev, const Iterator &iter)
 
ParticleTileTypeDefineAndReturnParticleTile (int lev, int grid, int tile)
 
ParticleTileTypeDefineAndReturnParticleTile (int lev, const Iterator &iter)
 
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
 
void AssignCellDensitySingleLevel (int rho_index, MultiFab &mf, int level, int ncomp=1, int particle_lvl_offset=0) const
 
IntVect Index (const P &p, int lev) const
 
ParticleLocData Reset (ParticleType &prt, bool update, bool verbose=true, ParticleLocData pld=ParticleLocData()) const
 
bool PeriodicShift (P &p) const
 
void SetLevelDirectoriesCreated (bool tf)
 
bool GetLevelDirectoriesCreated () const
 
void SetUsePrePost (bool tf) const
 
bool GetUsePrePost () const
 
int GetMaxNextIDPrePost () const
 
Long GetNParticlesPrePost () const
 
void SetUseUnlink (bool tf) const
 
bool GetUseUnlink () const
 
void RedistributeCPU (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
 
void RedistributeGPU (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
 
Long superParticleSize () const
 
void AddRealComp (std::string const &name, int communicate=1)
 
void AddRealComp (int communicate=1)
 
void AddIntComp (std::string const &name, int communicate=1)
 
void AddIntComp (int communicate=1)
 
int NumRuntimeRealComps () const
 
int NumRuntimeIntComps () const
 
int NumRealComps () const
 
int NumIntComps () const
 
void ResizeRuntimeRealComp (int new_size, bool communicate)
 
void ResizeRuntimeIntComp (int new_size, bool communicate)
 
ContainerLike< NewAllocator > make_alike () const
 
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
 
void SetSoACompileTimeNames (std::vector< std::string > const &rdata_name, std::vector< std::string > const &idata_name)
 
std::vector< std::string > GetRealSoANames () const
 
std::vector< std::string > GetIntSoANames () const
 
bool HasRealComp (std::string const &name)
 
bool HasIntComp (std::string const &name)
 
int GetRealCompIndex (std::string const &name)
 
int GetIntCompIndex (std::string const &name)
 
 ParticleContainer_impl ()
 
 ParticleContainer_impl (ParGDBBase *gdb)
 
 ParticleContainer_impl (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
 ParticleContainer_impl (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
 ParticleContainer_impl (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
 ParticleContainer_impl (const ParticleContainer_impl &)=delete
 
 ParticleContainer_impl (ParticleContainer_impl &&) noexcept=default
 
 ~ParticleContainer_impl () override=default
 
ParticleContainer_imploperator= (const ParticleContainer_impl &)=delete
 
ParticleContainer_imploperator= (ParticleContainer_impl &&) noexcept=default
 
void Define (ParGDBBase *gdb)
 
void Define (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
void Define (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
void Define (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
int numLocalTilesAtLevel (int lev) const
 
void reserveData () override
 
void resizeData () override
 
void InitFromAsciiFile (const std::string &file, int extradata, const IntVect *Nrep=nullptr)
 
void InitFromBinaryFile (const std::string &file, int extradata)
 
void InitFromBinaryMetaFile (const std::string &file, int extradata)
 
void InitRandom (Long icount, ULong iseed, const ParticleInitData &pdata, bool serialize=false, RealBox bx=RealBox())
 
void InitRandomPerBox (Long icount, ULong iseed, const ParticleInitData &pdata)
 
void InitOnePerCell (Real x_off, Real y_off, Real z_off, const ParticleInitData &pdata)
 
void InitNRandomPerCell (int n_per_cell, const ParticleInitData &pdata)
 
void Increment (MultiFab &mf, int level)
 
Long IncrementWithTotal (MultiFab &mf, int level, bool local=false)
 
void Redistribute (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
 
void ReorderParticles (int lev, const MFIter &mfi, const index_type *permutations)
 
void SortParticlesForDeposition (IntVect idx_type)
 
void SortParticlesByCell ()
 
void SortParticlesByBin (IntVect bin_size)
 
bool OK (int lev_min=0, int lev_max=-1, int nGrow=0) const
 
std::array< Long, 3 > ByteSpread () const
 
std::array< Long, 3 > PrintCapacity () const
 
void ShrinkToFit ()
 
Long NumberOfParticlesAtLevel (int level, bool only_valid=true, bool only_local=false) const
 
Vector< Long > NumberOfParticlesInGrid (int level, bool only_valid=true, bool only_local=false) const
 
void CapacityOfParticlesInGrid (LayoutData< I > &mem, int lev) const
 
Long TotalNumberOfParticles (bool only_valid=true, bool only_local=false) const
 
void RemoveParticlesAtLevel (int level)
 
void RemoveParticlesNotAtFinestLevel ()
 
void CreateVirtualParticles (int level, AoS &virts) const
 
void CreateVirtualParticles (int level, ParticleTileType &virts) const
 
void CreateGhostParticles (int level, int ngrow, AoS &ghosts) const
 
void CreateGhostParticles (int level, int ngrow, ParticleTileType &ghosts) const
 
void AddParticlesAtLevel (AoS &particles, int level, int nGrow=0)
 
void AddParticlesAtLevel (ParticleTileType &particles, int level, int nGrow=0)
 
void clearParticles ()
 
void copyParticles (const PCType &other, bool local=false)
 
void copyParticles (const PCType &other, F &&f, bool local=false)
 
void addParticles (const PCType &other, bool local=false)
 
void addParticles (const PCType &other, F const &f, bool local=false)
 
void WriteParticleRealData (void *data, size_t size, std::ostream &os) const
 
void ReadParticleRealData (void *data, size_t size, std::istream &is)
 
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
 
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
 
void Checkpoint (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) const
 
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
 
void CheckpointPre ()
 
void CheckpointPost ()
 
void Restart (const std::string &dir, const std::string &file)
 
void Restart (const std::string &dir, const std::string &file, bool is_checkpoint)
 
void WritePlotFile (const std::string &dir, const std::string &name) const
 
void WritePlotFile (const std::string &dir, const std::string &name, F &&f) const
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names) const
 
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
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names) const
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< std::string > &real_comp_names, F &&f) const
 
void WritePlotFile (const std::string &dir, const std::string &name, const Vector< int > &write_real_comp, const Vector< int > &write_int_comp) const
 
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
 
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) const
 
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
 
void WritePlotFilePre ()
 
void WritePlotFilePost ()
 
void WriteAsciiFile (const std::string &file)
 
const Vector< ParticleLevel > & GetParticles () const
 
Vector< ParticleLevel > & GetParticles ()
 
const ParticleLevelGetParticles (int lev) const
 
ParticleLevelGetParticles (int lev)
 
const ParticleTileTypeParticlesAt (int lev, int grid, int tile) const
 
ParticleTileTypeParticlesAt (int lev, int grid, int tile)
 
const ParticleTileTypeParticlesAt (int lev, const Iterator &iter) const
 
ParticleTileTypeParticlesAt (int lev, const Iterator &iter)
 
ParticleTileTypeDefineAndReturnParticleTile (int lev, int grid, int tile)
 
ParticleTileTypeDefineAndReturnParticleTile (int lev, const Iterator &iter)
 
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
 
void AssignCellDensitySingleLevel (int rho_index, MultiFab &mf, int level, int ncomp=1, int particle_lvl_offset=0) const
 
IntVect Index (const P &p, int lev) const
 
ParticleLocData Reset (ParticleType &prt, bool update, bool verbose=true, ParticleLocData pld=ParticleLocData()) const
 
bool PeriodicShift (P &p) const
 
void SetLevelDirectoriesCreated (bool tf)
 
bool GetLevelDirectoriesCreated () const
 
void SetUsePrePost (bool tf) const
 
bool GetUsePrePost () const
 
int GetMaxNextIDPrePost () const
 
Long GetNParticlesPrePost () const
 
void SetUseUnlink (bool tf) const
 
bool GetUseUnlink () const
 
void RedistributeCPU (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
 
void RedistributeGPU (int lev_min=0, int lev_max=-1, int nGrow=0, int local=0, bool remove_negative=true)
 
Long superParticleSize () const
 
void AddRealComp (std::string const &name, int communicate=1)
 
void AddRealComp (int communicate=1)
 
void AddIntComp (std::string const &name, int communicate=1)
 
void AddIntComp (int communicate=1)
 
int NumRuntimeRealComps () const
 
int NumRuntimeIntComps () const
 
int NumRealComps () const
 
int NumIntComps () const
 
void ResizeRuntimeRealComp (int new_size, bool communicate)
 
void ResizeRuntimeIntComp (int new_size, bool communicate)
 
ContainerLike< NewAllocator > make_alike () const
 
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
 
void SetSoACompileTimeNames (std::vector< std::string > const &rdata_name, std::vector< std::string > const &idata_name)
 
std::vector< std::string > GetRealSoANames () const
 
std::vector< std::string > GetIntSoANames () const
 
bool HasRealComp (std::string const &name)
 
bool HasIntComp (std::string const &name)
 
int GetRealCompIndex (std::string const &name)
 
int GetIntCompIndex (std::string const &name)
 
- Public Member Functions inherited from amrex::ParticleContainerBase
 ParticleContainerBase ()=default
 
 ParticleContainerBase (ParGDBBase *gdb)
 
 ParticleContainerBase (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
 ParticleContainerBase (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
 ParticleContainerBase (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
virtual ~ParticleContainerBase ()=default
 
 ParticleContainerBase (const ParticleContainerBase &)=delete
 
ParticleContainerBaseoperator= (const ParticleContainerBase &)=delete
 
 ParticleContainerBase (ParticleContainerBase &&)=default
 
ParticleContainerBaseoperator= (ParticleContainerBase &&)=default
 
void Define (ParGDBBase *gdb)
 
void Define (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
void Define (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
void Define (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
bool isDefined () const
 
void RedefineDummyMF (int lev)
 
MFIter MakeMFIter (int lev, const MFItInfo &info) const
 
MFIter MakeMFIter (int lev) const
 
MFIter MakeMFIter (int lev, bool tile) const
 
void SetParGDB (const Geometry &geom, const DistributionMapping &dmap, const BoxArray &ba)
 
void SetParGDB (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< IntVect > &rr)
 
void SetParGDB (const Vector< Geometry > &geom, const Vector< DistributionMapping > &dmap, const Vector< BoxArray > &ba, const Vector< int > &rr)
 
void SetParticleBoxArray (int lev, BoxArray new_ba)
 
void SetParticleDistributionMap (int lev, DistributionMapping new_dmap)
 
void SetParticleGeometry (int lev, Geometry new_geom)
 
const BoxArrayParticleBoxArray (int lev) const
 
const DistributionMappingParticleDistributionMap (int lev) const
 
const GeometryGeom (int lev) const
 
const GeometryParticleGeom (int lev) const
 
int finestLevel () const
 
int maxLevel () const
 
int numLevels () const
 
const ParGDBBaseGetParGDB () const
 
ParGDBBaseGetParGDB ()
 
int Verbose () const
 
void SetVerbose (int verbose)
 
int stableRedistribute () const
 
void setStableRedistribute (int stable)
 
const ParticleBufferMapBufferMap () const
 
Vector< int > NeighborProcs (int ngrow) const
 
bool OnSameGrids (int level, const MF &mf) const
 
Arenaarena () const
 
void SetArena (Arena *a)
 

Public Attributes

bool store_beam_moments = false
 
- Public Attributes inherited from amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >
RealDescriptor ParticleRealDescriptor
 
Vector< int > h_redistribute_real_comp
 
Vector< int > h_redistribute_int_comp
 
bool levelDirectoriesCreated
 
bool usePrePost
 
bool doUnlink
 
int maxnextidPrePost
 
int nOutFilesPrePost
 
Long nparticlesPrePost
 
Vector< Long > nParticlesAtLevelPrePost
 
Vector< Vector< int > > whichPrePost
 
Vector< Vector< int > > countPrePost
 
Vector< Vector< Long > > wherePrePost
 
std::string HdrFileNamePrePost
 
Vector< std::string > filePrefixPrePost
 
RealDescriptor ParticleRealDescriptor
 
Vector< int > h_redistribute_real_comp
 
Vector< int > h_redistribute_int_comp
 
bool levelDirectoriesCreated
 
bool usePrePost
 
bool doUnlink
 
int maxnextidPrePost
 
int nOutFilesPrePost
 
Long nparticlesPrePost
 
Vector< Long > nParticlesAtLevelPrePost
 
Vector< Vector< int > > whichPrePost
 
Vector< Vector< int > > countPrePost
 
Vector< Vector< Long > > wherePrePost
 
std::string HdrFileNamePrePost
 
Vector< std::string > filePrefixPrePost
 
- Public Attributes inherited from amrex::ParticleContainerBase
AmrParticleLocator< DenseBins< Box > > m_particle_locator
 

Private Attributes

RefPart m_refpart
 the reference particle for the beam in the particle container
 
std::optional< int > m_particle_shape
 the particle shape
 
ImpactXParticleContainerm_particles_lost = nullptr
 a non-owning reference to lost particles, i.e., due to apertures
 
CoordSystem m_coordsystem = CoordSystem::s
 the current coordinate system of particles in this container
 
std::list< std::unordered_map< std::string, amrex::ParticleReal > > m_beam_moments
 history of the beam moments over s
 

Additional Inherited Members

- Static Public Member Functions inherited from amrex::ParticleContainerBase
static const std::string & CheckpointVersion ()
 
static const std::string & PlotfileVersion ()
 
static const std::string & DataPrefix ()
 
static int MaxReaders ()
 
static Long MaxParticlesPerRead ()
 
static const std::string & AggregationType ()
 
static int AggregationBuffer ()
 
- Static Public Attributes inherited from amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >
static constexpr int NStructReal
 
static constexpr int NStructInt
 
static constexpr int NArrayReal
 
static constexpr int NArrayInt
 
static constexpr bool has_polymorphic_allocator
 
static constexpr int NStructReal
 
static constexpr int NStructInt
 
static constexpr int NArrayReal
 
static constexpr int NArrayInt
 
static constexpr bool has_polymorphic_allocator
 
- Static Public Attributes inherited from amrex::ParticleContainerBase
static bool do_tiling
 
static IntVect tile_size
 
static bool memEfficientSort
 
static bool use_comms_arena
 
- Protected Member Functions inherited from amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >
bool Where (const P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int nGrow=0, int local_grid=-1) const
 
bool EnforcePeriodicWhere (P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int local_grid=-1) const
 
void ReadParticles (int cnt, int grd, int lev, std::ifstream &ifs, int finest_level_in_file, bool convert_ids)
 
void SetParticleSize ()
 
bool Where (const P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int nGrow=0, int local_grid=-1) const
 
bool EnforcePeriodicWhere (P &prt, ParticleLocData &pld, int lev_min=0, int lev_max=-1, int local_grid=-1) const
 
void ReadParticles (int cnt, int grd, int lev, std::ifstream &ifs, int finest_level_in_file, bool convert_ids)
 
void SetParticleSize ()
 
- Protected Member Functions inherited from amrex::ParticleContainerBase
void BuildRedistributeMask (int lev, int nghost=1) const
 
void defineBufferMap () const
 
- Protected Attributes inherited from amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >
DenseBins< typename ParticleTileType::ParticleTileDataTypem_bins
 
DenseBins< typename ParticleTileType::ParticleTileDataTypem_bins
 
- Protected Attributes inherited from amrex::ParticleContainerBase
int m_verbose
 
int m_stable_redistribute
 
std::unique_ptr< ParGDBm_gdb_object
 
ParGDBBasem_gdb
 
Vector< std::unique_ptr< MultiFab > > m_dummy_mf
 
Arenam_arena
 
std::unique_ptr< iMultiFabredistribute_mask_ptr
 
int redistribute_mask_nghost
 
amrex::Vector< int > neighbor_procs
 
ParticleBufferMap m_buffer_map
 

Detailed Description

Beam Particles in ImpactX

This class stores particles, distributed over MPI ranks.

Member Typedef Documentation

◆ const_iterator

amrex constant iterator for particle boxes (read-only)

◆ iterator

amrex iterator for particle boxes

Constructor & Destructor Documentation

◆ ImpactXParticleContainer()

impactx::ImpactXParticleContainer::ImpactXParticleContainer ( initialization::AmrCoreData * amr_core)

Construct a new particle container.

◆ ~ImpactXParticleContainer()

virtual impactx::ImpactXParticleContainer::~ImpactXParticleContainer ( )
virtualdefault

Destruct a particle container.

Member Function Documentation

◆ AddNParticles()

void impactx::ImpactXParticleContainer::AddNParticles ( amrex::Gpu::DeviceVector< amrex::ParticleReal > const & x,
amrex::Gpu::DeviceVector< amrex::ParticleReal > const & y,
amrex::Gpu::DeviceVector< amrex::ParticleReal > const & t,
amrex::Gpu::DeviceVector< amrex::ParticleReal > const & px,
amrex::Gpu::DeviceVector< amrex::ParticleReal > const & py,
amrex::Gpu::DeviceVector< amrex::ParticleReal > const & pt,
amrex::ParticleReal qm,
std::optional< amrex::ParticleReal > bunch_charge = std::nullopt,
std::optional< amrex::Gpu::DeviceVector< amrex::ParticleReal > > w = std::nullopt )

Add new particles to the container for fixed s.

Either the total charge (bunch_charge) or the weight of each particle (w) must be provided.

Note: This can only be used after the initialization (grids) have been created, meaning after the call to AmrCore::InitFromScratch or AmrCore::InitFromCheckpoint has been made in the ImpactX class.

Parameters
xpositions in x
ypositions in y
tpositions as time-of-flight in c*t
pxmomentum in x
pymomentum in y
ptmomentum in t
qmcharge over mass in 1/eV
bunch_chargetotal charge within a bunch in C
wweight of each particle: how many real particles to represent

◆ beam_moments()

std::unordered_map< std::string, amrex::ParticleReal > impactx::ImpactXParticleContainer::beam_moments ( )

Calculate beam moments at current s

◆ beam_moments_history()

std::list< std::unordered_map< std::string, amrex::ParticleReal > > impactx::ImpactXParticleContainer::beam_moments_history ( )
inline

Get the history of beam moments

◆ clear()

void impactx::ImpactXParticleContainer::clear ( bool keep_mass = false,
bool keep_charge = false )

Empty the container and reset the reference particle

Also clears the history of the beam moments, see reset_beam_moments_history()

Parameters
keep_massdo not reset the reference particle mass
keep_chargedo not reset the reference particle charge

◆ DepositCharge()

void impactx::ImpactXParticleContainer::DepositCharge ( std::unordered_map< int, amrex::MultiFab > & rho,
amrex::Vector< amrex::IntVect > const & ref_ratio )

Deposit the charge of the particles onto a grid

This resets the values in rho to zero and then deposits the particle charge. In MPI-parallel contexts, this also performs a communication of boundary regions to sum neighboring contributions.

Parameters
rhocharge grid per level to deposit on
ref_ratiomesh refinement ratios between levels

◆ GetCoordSystem()

CoordSystem impactx::ImpactXParticleContainer::GetCoordSystem ( ) const

Get the current coordinate system of particles in this container

◆ GetLostParticleContainer()

ImpactXParticleContainer * impactx::ImpactXParticleContainer::GetLostParticleContainer ( )

◆ GetParticleShape()

int impactx::ImpactXParticleContainer::GetParticleShape ( ) const
inline

Get particle shape

◆ GetRefParticle() [1/2]

RefPart & impactx::ImpactXParticleContainer::GetRefParticle ( )

Get reference particle attributes

Returns
refpart

◆ GetRefParticle() [2/2]

RefPart const & impactx::ImpactXParticleContainer::GetRefParticle ( ) const

Get a copy to the reference particle attributes

Returns
refpart

◆ MeanAndStdPositions()

std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > impactx::ImpactXParticleContainer::MeanAndStdPositions ( )

Compute the mean and std of the particle position in each dimension

Returns
x_mean, x_std, y_mean, y_std, z_mean, z_std

◆ MinAndMaxPositions()

std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > impactx::ImpactXParticleContainer::MinAndMaxPositions ( )

Compute the min and max of the particle position in each dimension

Returns
x_min, y_min, z_min, x_max, y_max, z_max

◆ prepare()

void impactx::ImpactXParticleContainer::prepare ( )

Prepares the container for use.

This sets the tile size to a sensible default and resizes the underlying data structures.

◆ record_beam_moments()

void impactx::ImpactXParticleContainer::record_beam_moments ( )

Calculate & record the beam moments at current s

◆ reset_beam_moments_history()

void impactx::ImpactXParticleContainer::reset_beam_moments_history ( )
inline

Reset the history of the beam moments

◆ SetCoordSystem()

void impactx::ImpactXParticleContainer::SetCoordSystem ( CoordSystem coord_system)

Set the current coordinate system of particles in this container

Parameters
coord_systemthe new coordinate system the beam particles are in

◆ SetLostParticleContainer()

void impactx::ImpactXParticleContainer::SetLostParticleContainer ( ImpactXParticleContainer * lost_pc)

Register storage for lost particles

Parameters
lost_pcparticle container for lost particles

◆ SetParticleShape() [1/2]

void impactx::ImpactXParticleContainer::SetParticleShape ( )

Set Particle Shape from amrex::ParmParse inputs

Note: this can only be called once. All later calls are a logic error. The reason for that is that subsequent calls would need to change the guard size of all our MultiFabs, which is not implemented.

◆ SetParticleShape() [2/2]

void impactx::ImpactXParticleContainer::SetParticleShape ( int order)

Set Particle Shape order

Note: this can only be called once. All later calls are a logic error. The reason for that is that subsequent calls would need to change the guard size of all our MultiFabs, which is not implemented.

Parameters
orderthe order of the particle shape

◆ SetRefParticle()

void impactx::ImpactXParticleContainer::SetRefParticle ( RefPart const & refpart)

Set reference particle attributes

Parameters
refpartreference particle

◆ SetRefParticleEdge()

void impactx::ImpactXParticleContainer::SetRefParticleEdge ( )

Update reference particle element edge

Member Data Documentation

◆ m_beam_moments

std::list<std::unordered_map<std::string, amrex::ParticleReal> > impactx::ImpactXParticleContainer::m_beam_moments
private

history of the beam moments over s

◆ m_coordsystem

CoordSystem impactx::ImpactXParticleContainer::m_coordsystem = CoordSystem::s
private

the current coordinate system of particles in this container

◆ m_particle_shape

std::optional<int> impactx::ImpactXParticleContainer::m_particle_shape
private

the particle shape

◆ m_particles_lost

ImpactXParticleContainer* impactx::ImpactXParticleContainer::m_particles_lost = nullptr
private

a non-owning reference to lost particles, i.e., due to apertures

◆ m_refpart

RefPart impactx::ImpactXParticleContainer::m_refpart
private

the reference particle for the beam in the particle container

◆ store_beam_moments

bool impactx::ImpactXParticleContainer::store_beam_moments = false

In situ calculate and store the beam moments for every simulation step


The documentation for this class was generated from the following files: