10#ifndef IMPACTX_PARTICLE_CONTAINER_H
11#define IMPACTX_PARTICLE_CONTAINER_H
30#include <unordered_map>
66 static constexpr auto names_s = {
"position_x",
"position_y",
"position_t",
"momentum_x",
"momentum_y",
"momentum_t",
"qm",
"weighting" };
68 static constexpr auto names_t = {
"position_x",
"position_y",
"position_z",
"momentum_x",
"momentum_y",
"momentum_z",
"qm",
"weighting" };
84 static constexpr std::initializer_list<char const *>
names_s = {};
86 static constexpr std::initializer_list<char const *>
names_t = {};
161 void clear (
bool keep_mass=
false,
bool keep_charge=
false);
191 amrex::ParticleReal qm,
192 std::optional<amrex::ParticleReal> bunch_charge = std::nullopt,
260 amrex::ParticleReal, amrex::ParticleReal,
261 amrex::ParticleReal, amrex::ParticleReal,
262 amrex::ParticleReal, amrex::ParticleReal>
270 amrex::ParticleReal, amrex::ParticleReal,
271 amrex::ParticleReal, amrex::ParticleReal,
272 amrex::ParticleReal, amrex::ParticleReal>
285 DepositCharge (std::unordered_map<int, amrex::MultiFab> & rho,
307 std::unordered_map<std::string, amrex::ParticleReal>
311 std::list<std::unordered_map<std::string, amrex::ParticleReal> >
ParticleContainer_impl< ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor > ContainerType
ParticleContainer_impl< ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor > ContainerType
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)
Definition ImpactXParticleContainer.cpp:236
std::unordered_map< std::string, amrex::ParticleReal > beam_moments()
Definition ImpactXParticleContainer.cpp:442
virtual ~ImpactXParticleContainer()=default
Destruct a particle container.
void record_beam_moments()
Definition ImpactXParticleContainer.cpp:430
int GetParticleShape() const
Definition ImpactXParticleContainer.H:235
std::list< std::unordered_map< std::string, amrex::ParticleReal > > m_beam_moments
history of the beam moments over s
Definition ImpactXParticleContainer.H:333
void SetLostParticleContainer(ImpactXParticleContainer *lost_pc)
Definition ImpactXParticleContainer.cpp:74
void DepositCharge(std::unordered_map< int, amrex::MultiFab > &rho, amrex::Vector< amrex::IntVect > const &ref_ratio)
Definition ChargeDeposition.cpp:28
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > MinAndMaxPositions()
Definition ImpactXParticleContainer.cpp:399
void reset_beam_moments_history()
Definition ImpactXParticleContainer.H:316
void SetRefParticle(RefPart const &refpart)
Definition ImpactXParticleContainer.cpp:372
impactx::ParIterSoA iterator
amrex iterator for particle boxes
Definition ImpactXParticleContainer.H:136
bool store_beam_moments
Definition ImpactXParticleContainer.H:300
CoordSystem GetCoordSystem() const
Definition ImpactXParticleContainer.cpp:418
void SetRefParticleEdge()
Definition ImpactXParticleContainer.cpp:390
ImpactXParticleContainer * m_particles_lost
a non-owning reference to lost particles, i.e., due to apertures
Definition ImpactXParticleContainer.H:327
ImpactXParticleContainer(initialization::AmrCoreData *amr_core)
Construct a new particle container.
Definition ImpactXParticleContainer.cpp:63
void SetParticleShape()
Definition ImpactXParticleContainer.cpp:105
void SetCoordSystem(CoordSystem coord_system)
Definition ImpactXParticleContainer.cpp:424
ImpactXParticleContainer * GetLostParticleContainer()
Definition ImpactXParticleContainer.cpp:80
impactx::ParConstIterSoA const_iterator
amrex constant iterator for particle boxes (read-only)
Definition ImpactXParticleContainer.H:139
std::tuple< amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal > MeanAndStdPositions()
Definition ImpactXParticleContainer.cpp:409
RefPart m_refpart
the reference particle for the beam in the particle container
Definition ImpactXParticleContainer.H:321
std::optional< int > m_particle_shape
the particle shape
Definition ImpactXParticleContainer.H:324
CoordSystem m_coordsystem
the current coordinate system of particles in this container
Definition ImpactXParticleContainer.H:330
std::list< std::unordered_map< std::string, amrex::ParticleReal > > beam_moments_history()
Definition ImpactXParticleContainer.H:312
void prepare()
Definition ImpactXParticleContainer.cpp:126
void clear(bool keep_mass=false, bool keep_charge=false)
Definition ImpactXParticleContainer.cpp:228
RefPart & GetRefParticle()
Definition ImpactXParticleContainer.cpp:378
Definition ImpactXParticleContainer.H:116
ContainerType const * pc() const
Definition ImpactXParticleContainer.H:124
ParConstIterSoA(ContainerType &pc, int level)
Definition ImpactXParticleContainer.cpp:55
Definition ImpactXParticleContainer.H:98
ContainerType * pc()
Definition ImpactXParticleContainer.H:106
ParIterSoA(ContainerType &pc, int level)
Definition ImpactXParticleContainer.cpp:47
Definition AmrCoreData.H:44
PODVector< T, ArenaAllocator< T > > DeviceVector
ParIter_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor > ParIterSoA
ParConstIter_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor > ParConstIterSoA
ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor > ParticleContainerPureSoA
Definition CovarianceMatrixMath.H:25
CoordSystem
Definition ImpactXParticleContainer.H:36
@ s
fixed s as the independent variable
Definition ImpactXParticleContainer.H:37
@ t
fixed t as the independent variable
Definition ImpactXParticleContainer.H:38
Definition ImpactXParticleContainer.H:77
static constexpr std::initializer_list< char const * > names_s
named labels for fixed s
Definition ImpactXParticleContainer.H:84
@ nattribs
the number of attributes above (always last)
Definition ImpactXParticleContainer.H:80
static constexpr std::initializer_list< char const * > names_t
named labels for fixed t
Definition ImpactXParticleContainer.H:86
Definition ImpactXParticleContainer.H:45
static constexpr auto names_s
named labels for fixed s
Definition ImpactXParticleContainer.H:66
@ z
position in z [m] (at fixed t)
Definition ImpactXParticleContainer.H:61
@ pz
momentum in z, scaled by the magnitude of the reference momentum [unitless] (at fixed t)
Definition ImpactXParticleContainer.H:62
static constexpr auto names_t
named labels for fixed t
Definition ImpactXParticleContainer.H:68
@ pt
energy deviation, scaled by speed of light * the magnitude of the reference momentum [unitless] (at f...
Definition ImpactXParticleContainer.H:53
@ y
position in y [m] (at fixed s or t)
Definition ImpactXParticleContainer.H:49
@ t
time-of-flight ct [m] (at fixed s)
Definition ImpactXParticleContainer.H:50
@ w
particle weight, number of real particles represented by this macroparticle [unitless]
Definition ImpactXParticleContainer.H:55
@ px
momentum in x, scaled by the magnitude of the reference momentum [unitless] (at fixed s or t)
Definition ImpactXParticleContainer.H:51
@ nattribs
the number of attributes above (always last)
Definition ImpactXParticleContainer.H:56
@ py
momentum in y, scaled by the magnitude of the reference momentum [unitless] (at fixed s or t)
Definition ImpactXParticleContainer.H:52
@ x
position in x [m] (at fixed s or t)
Definition ImpactXParticleContainer.H:48
@ qm
charge to mass ratio, in q_e/m_e [q_e/eV]
Definition ImpactXParticleContainer.H:54
Definition ReferenceParticle.H:31