OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
ParticleContainer< T, Dim > Class Template Reference

Container for all per-particle (and per-simulation) fields tracked during OPALX tracking. More...

#include <ParticleContainer.hpp>

Inherits ippl::ParticleBase< ippl::ParticleSpatialLayout< T, 3 >, Kokkos::DefaultExecutionSpace::memory_space >.

Collaboration diagram for ParticleContainer< T, Dim >:
Collaboration graph

Public Types

enum class  QMStorageMode { SingleValue , Attributes }
 
using bin_index_type = short int
 Defines which type to use as a particle bin.
 
using qm_view_type = typename ippl::ParticleAttrib< double >::view_type
 View types of Q and M values.
 
using spin_vector_type = ippl::Vector< float, 3 >
 

Public Member Functions

qm_view_type getQView () const
 
qm_view_type getMView () const
 
bool hasSpin () const
 
 ParticleContainer (Mesh_t< Dim > &mesh, FieldLayout_t< Dim > &FL, bool spinEnabled=false)
 
 ~ParticleContainer ()
 
void registerAttributes ()
 
void setupBCs ()
 
void transformBunch (const CoordinateSystemTrafo &trafo)
 Apply coordinate transform to local particles: translate R, rotate P, E, B.
 
PLayout_t< T, Dim > & getPL ()
 
void setBunchStateHandler (std::shared_ptr< BunchStateHandler > handler)
 
bool isUnitlessPositions () const
 
bool isMomentsDirty () const
 
void markMomentsDirty ()
 
void markMomentsClean ()
 
void updateMoments ()
 
void setEnergyReferenceMass (double referenceMassGeV, bool rescaleToReference=true)
 
Vector_t< double, 3 > getMeanP () const
 
Vector_t< double, 3 > getRmsP () const
 
Vector_t< double, 3 > getMeanR () const
 
Vector_t< double, 3 > getRmsR () const
 
Vector_t< double, 3 > getRmsRP () const
 
void computeMinMaxR ()
 
Vector_t< double, 3 > getMinR () const
 
Vector_t< double, 3 > getMaxR () const
 
matrix6x6_t getCovMatrix () const
 
double getMeanKineticEnergy () const
 
double getStdKineticEnergy () const
 
Vector_t< double, 6 > getMeans () const
 
Vector_t< double, 6 > getCentroid () const
 
Vector_t< double, 3 > getNormEmit () const
 
Vector_t< double, 3 > getGeometricEmit () const
 
double getDx () const
 
double getDDx () const
 
double getDy () const
 
double getDDy () const
 
double getDebyeLength () const
 
double getMeanGammaZ () const
 
double getTemperature () const
 
double getPlasmaParameter () const
 
double computeDebyeLength (double density)
 
void setQ (double q)
 Set particle charge for the active Q storage mode.
 
double getChargePerParticle () const
 Get charge per particle [Cb].
 
double getTotalCharge () const
 Get total charge [Cb] in this container.
 
void setM (double m)
 Set particle mass for the active M storage mode.
 
double getMassPerParticle () const
 Get mass per particle [GeV].
 
double getTotalMass () const
 Get total mass [GeV] in this container.
 
const Vector_t< double, Dim > & getRefPartR () const
 Get the reference particle position (const).
 
Vector_t< double, Dim > & getRefPartR ()
 Get the reference particle position.
 
void setRefPartR (const Vector_t< double, Dim > &refPartR)
 Set the reference particle position.
 
const Vector_t< double, Dim > & getRefPartP () const
 Get the reference particle momentum (const).
 
Vector_t< double, Dim > & getRefPartP ()
 Get the reference particle momentum.
 
void setRefPartP (const Vector_t< double, Dim > &refPartP)
 Set the reference particle momentum.
 
void setReference (const PartData *ref)
 Set reference particle data.
 
const PartDatagetReference () const
 Get reference particle data.
 
void set_sPos (double sPos)
 Set longitudinal position along design trajectory.
 
double get_sPos () const
 Get longitudinal position along design trajectory.
 
void setGlobalToLocalQuaternion (const Quaternion_t &globalToLocalQuaternion)
 Set global-to-local rotation quaternion.
 
Quaternion_t getGlobalToLocalQuaternion () const
 Get global-to-local rotation quaternion.
 
const CoordinateSystemTrafogetToLabTrafo () const
 Get local-to-lab coordinate transformation (const).
 
CoordinateSystemTrafogetToLabTrafo ()
 Get local-to-lab coordinate transformation.
 
void setToLabTrafo (const CoordinateSystemTrafo &toLabTrafo)
 Set local-to-lab coordinate transformation.
 
void updateRefToLabCSTrafo (double bunchDT)
 Advance reference/lab transform state and map bunch accordingly.
 
template<typename Pusher >
void applyFractionalStep (const Pusher &pusher, double tau, double pathLengthTarget)
 Apply a fractional Boris step and update reference/lab transform state.
 
void scaleDtByCharge ()
 Scale particle time-step weights by charge before scatter.
 
void unscaleDtByCharge ()
 Restore original dt values after scaleDtByCharge().
 
void switchToUnitlessPositions ()
 Transform positions to unitless coordinates using each particle's dt[i].
 
void switchOffUnitlessPositions ()
 Restore physical positions from unitless form using each particle's dt[i].
 
QMStorageMode getQMStorageMode () const
 
void setGlobalProcesses (std::vector< std::unique_ptr< GlobalProcess > > processes)
 
const std::vector< std::unique_ptr< GlobalProcess > > & getGlobalProcesses () const
 
size_type markParticlesOutside (double sigmasAway)
 Mark particles whose position is more than sigmasAway standard deviations from the bunch mean in any spatial dimension.
 
void createParticles (size_type numParticles)
 Create/allocate a specified number of particles.
 
void allocateParticles (size_type numParticles)
 
size_type deleteInvalidParticles ()
 Delete particles currently marked in InvalidMask.
 

Public Attributes

ippl::ParticleAttrib< double > dt
 timestep in [s]
 
ippl::ParticleAttrib< double > Phi
 the scalar potential in [Cb/s]
 
ippl::ParticleAttrib< bin_index_typeBin
 the energy bin the particle is in
 
short Sp = 0
 the particle specis
 
Base::particle_position_type P
 particle momenta [\beta\gamma]
 
Base::particle_position_type E
 electric field at particle position
 
Base::particle_position_type B
 electric field for gun simulation with bins
 
ippl::ParticleAttrib< bool > InvalidMask
 particle deletion mask (indicates which particles are deleted every timestep)
 
ippl::ParticleAttrib< spin_vector_typePol
 

Private Types

using Base = ippl::ParticleBase< ippl::ParticleSpatialLayout< T, Dim >, Kokkos::DefaultExecutionSpace::memory_space >
 Alias for the ippl::ParticleBase specialization this container inherits from.
 

Private Member Functions

void setBCAllPeriodic ()
 

Private Attributes

PLayout_t< T, Dimpl_m
 
QMStorageMode qmStorageMode_m = QMStorageMode::SingleValue
 
DistributionMoments distMoments_m
 
std::shared_ptr< BunchStateHandler::ContainerStatecontainerState_m
 
qm_view_type QView_m
 
qm_view_type MView_m
 
ippl::ParticleAttrib< double > QAttr
 
ippl::ParticleAttrib< double > MAttr
 
bool spinEnabled_m = false
 
Vector_t< double, DimrefPartR_m
 
Vector_t< double, DimrefPartP_m
 
Quaternion_t globalToLocalQuaternion_m
 
CoordinateSystemTrafo toLabTrafo_m
 
const PartDatareference_m = nullptr
 
double sPos_m = 0.0
 
std::vector< std::unique_ptr< GlobalProcess > > globalProcesses_m
 Global physics processes attached to this container.
 

Detailed Description

template<typename T, unsigned Dim = 3>
class ParticleContainer< T, Dim >

Container for all per-particle (and per-simulation) fields tracked during OPALX tracking.

The values tracked in Kokkos::Views during the simulation are: R - Position (from base class) P - Momentum [beta*gamma] dt - Time step Phi- Scalar potential Bin- Energy bin E - Electric field B - Magnetic field

Charge (Q) and mass (M):

  • Default: QM_MODE="SINGLE" -> QMStorageMode=SingleValue
    • Q and M are stored as a single shared value per container (memory-efficient).
    • Access via getQView() / getMView() returns the shared views.
  • Alternative: QM_MODE="ATTRIBUTES" -> QMStorageMode=Attributes
    • Q and M are stored as per-particle attributes.
    • Access via getQView() / getMView() returns the per-particle attribute views.

Access to Q/M should be done with getQView() / getMView(). They automatically select the correct underlying storage mode.

Definition at line 62 of file ParticleContainer.hpp.

Member Typedef Documentation

◆ Base

template<typename T , unsigned Dim = 3>
using ParticleContainer< T, Dim >::Base = ippl::ParticleBase< ippl::ParticleSpatialLayout<T, Dim>, Kokkos::DefaultExecutionSpace::memory_space>
private

Alias for the ippl::ParticleBase specialization this container inherits from.

The second template argument is a parameter pack of Kokkos view properties forwarded to the optional ID attribute's storage. IPPL gates the ID attribute on sizeof...(IDProperties) > 0, so passing any property here turns IDs ON; an empty pack would leave them disabled. We pass Kokkos::DefaultExecutionSpace::memory_space so the ID view lives in the same space as the rest of the bunch (host or device, matching the build backend). With IDs enabled, IPPL auto-assigns globally unique std::int64_t IDs in Base::create().

Definition at line 76 of file ParticleContainer.hpp.

◆ bin_index_type

template<typename T , unsigned Dim = 3>
using ParticleContainer< T, Dim >::bin_index_type = short int

Defines which type to use as a particle bin.

Definition at line 93 of file ParticleContainer.hpp.

◆ qm_view_type

template<typename T , unsigned Dim = 3>
using ParticleContainer< T, Dim >::qm_view_type = typename ippl::ParticleAttrib<double>::view_type

View types of Q and M values.

Definition at line 96 of file ParticleContainer.hpp.

◆ spin_vector_type

template<typename T , unsigned Dim = 3>
using ParticleContainer< T, Dim >::spin_vector_type = ippl::Vector<float, 3>

Per-particle polarization vector type: 3D vector in single precision, |Pol| in [0, 1]. Polarization observables are typically ~1% accurate, so float storage is sufficient and halves the memory footprint versus the codebase's standard double attributes. Dynamics kernels should still compute in double and cast back on store.

Definition at line 102 of file ParticleContainer.hpp.

Member Enumeration Documentation

◆ QMStorageMode

template<typename T , unsigned Dim = 3>
enum class ParticleContainer::QMStorageMode
strong
Enumerator
SingleValue 
Attributes 

Definition at line 90 of file ParticleContainer.hpp.

Constructor & Destructor Documentation

◆ ParticleContainer()

template<typename T , unsigned Dim = 3>
ParticleContainer< T, Dim >::ParticleContainer ( Mesh_t< Dim > &  mesh,
FieldLayout_t< Dim > &  FL,
bool  spinEnabled = false 
)
inline

◆ ~ParticleContainer()

template<typename T , unsigned Dim = 3>
ParticleContainer< T, Dim >::~ParticleContainer ( )
inline

Definition at line 177 of file ParticleContainer.hpp.

Member Function Documentation

◆ allocateParticles()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::allocateParticles ( size_type  numParticles)
inline

Definition at line 703 of file ParticleContainer.hpp.

◆ applyFractionalStep()

template<typename T , unsigned Dim = 3>
template<typename Pusher >
void ParticleContainer< T, Dim >::applyFractionalStep ( const Pusher &  pusher,
double  tau,
double  pathLengthTarget 
)
inline

◆ computeDebyeLength()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::computeDebyeLength ( double  density)
inline

◆ computeMinMaxR()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::computeMinMaxR ( )
inline

Definition at line 262 of file ParticleContainer.hpp.

References DistributionMoments::computeMinMaxPosition(), and ParticleContainer< T, Dim >::distMoments_m.

Here is the call graph for this function:

◆ createParticles()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::createParticles ( size_type  numParticles)
inline

Create/allocate a specified number of particles.

This function creates a given number of particles in the container. It's a wrapper around the non destructive IPPL particle create function, but will print out a warning if the create call led to unnecessary reallocation (i.e. if the new total number of particles exceeds the previous capacity).

Note
The underlying create is a collective call, so all MPI ranks must call this function. IPPL automatically handles the short-circuit if internal capacity is sufficient.
Parameters
numParticlesThe number of particles to create.
Todo:
: can probably be removed later, after my flattop debugging

Definition at line 655 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::B, ParticleContainer< T, Dim >::Bin, ParticleContainer< T, Dim >::dt, ParticleContainer< T, Dim >::E, ParticleContainer< T, Dim >::InvalidMask, and ParticleContainer< T, Dim >::Phi.

◆ deleteInvalidParticles()

template<typename T , unsigned Dim = 3>
size_type ParticleContainer< T, Dim >::deleteInvalidParticles ( )
inline

Delete particles currently marked in InvalidMask.

This is the only ParticleContainer function that is allowed to compact the IPPL particle arrays. All deletion producers must only update InvalidMask.

Returns
Global number of particles deleted (across all MPI ranks).

Definition at line 732 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::InvalidMask, and ParticleContainer< T, Dim >::markMomentsDirty().

Here is the call graph for this function:

◆ get_sPos()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::get_sPos ( ) const
inline

Get longitudinal position along design trajectory.

Definition at line 427 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::sPos_m.

◆ getCentroid()

template<typename T , unsigned Dim = 3>
Vector_t< double, 6 > ParticleContainer< T, Dim >::getCentroid ( ) const
inline

Definition at line 279 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getCentroid().

Here is the call graph for this function:

◆ getChargePerParticle()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getChargePerParticle ( ) const
inline

◆ getCovMatrix()

template<typename T , unsigned Dim = 3>
matrix6x6_t ParticleContainer< T, Dim >::getCovMatrix ( ) const
inline

Definition at line 271 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMoments6x6().

Here is the call graph for this function:

◆ getDDx()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getDDx ( ) const
inline

Definition at line 287 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getDDx().

Here is the call graph for this function:

◆ getDDy()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getDDy ( ) const
inline

Definition at line 291 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getDDy().

Here is the call graph for this function:

◆ getDebyeLength()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getDebyeLength ( ) const
inline

Definition at line 293 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getDebyeLength().

Here is the call graph for this function:

◆ getDx()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getDx ( ) const
inline

Definition at line 285 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getDx().

Here is the call graph for this function:

◆ getDy()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getDy ( ) const
inline

Definition at line 289 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getDy().

Here is the call graph for this function:

◆ getGeometricEmit()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getGeometricEmit ( ) const
inline

Definition at line 283 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getGeometricEmittance().

Here is the call graph for this function:

◆ getGlobalProcesses()

template<typename T , unsigned Dim = 3>
const std::vector< std::unique_ptr< GlobalProcess > > & ParticleContainer< T, Dim >::getGlobalProcesses ( ) const
inline

◆ getGlobalToLocalQuaternion()

template<typename T , unsigned Dim = 3>
Quaternion_t ParticleContainer< T, Dim >::getGlobalToLocalQuaternion ( ) const
inline

Get global-to-local rotation quaternion.

Definition at line 435 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::globalToLocalQuaternion_m.

◆ getMassPerParticle()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getMassPerParticle ( ) const
inline

◆ getMaxR()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getMaxR ( ) const
inline

Definition at line 269 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMaxPosition().

Here is the call graph for this function:

◆ getMeanGammaZ()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getMeanGammaZ ( ) const
inline

Definition at line 295 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMeanGammaZ().

Here is the call graph for this function:

◆ getMeanKineticEnergy()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getMeanKineticEnergy ( ) const
inline

Definition at line 273 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMeanKineticEnergy().

Here is the call graph for this function:

◆ getMeanP()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getMeanP ( ) const
inline

Definition at line 252 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMeanMomentum().

Here is the call graph for this function:

◆ getMeanR()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getMeanR ( ) const
inline

Definition at line 256 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMeanPosition().

Referenced by ParticleContainer< T, Dim >::markParticlesOutside().

Here is the call graph for this function:

◆ getMeans()

template<typename T , unsigned Dim = 3>
Vector_t< double, 6 > ParticleContainer< T, Dim >::getMeans ( ) const
inline

Definition at line 277 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMeans().

Here is the call graph for this function:

◆ getMinR()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getMinR ( ) const
inline

Definition at line 267 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getMinPosition().

Here is the call graph for this function:

◆ getMView()

template<typename T , unsigned Dim = 3>
qm_view_type ParticleContainer< T, Dim >::getMView ( ) const
inline

Mass view in [GeV]. In SingleValue mode this is a rank-1 view of length 1. In Attributes mode this is the per-particle attribute view.

Definition at line 118 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::Attributes, ParticleContainer< T, Dim >::MAttr, ParticleContainer< T, Dim >::MView_m, and ParticleContainer< T, Dim >::qmStorageMode_m.

Referenced by ParticleContainer< T, Dim >::updateMoments().

◆ getNormEmit()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getNormEmit ( ) const
inline

Definition at line 281 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getNormalizedEmittance().

Here is the call graph for this function:

◆ getPL()

template<typename T , unsigned Dim = 3>
PLayout_t< T, Dim > & ParticleContainer< T, Dim >::getPL ( )
inline

Definition at line 207 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::pl_m.

◆ getPlasmaParameter()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getPlasmaParameter ( ) const
inline

Definition at line 299 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getPlasmaParameter().

Here is the call graph for this function:

◆ getQMStorageMode()

template<typename T , unsigned Dim = 3>
QMStorageMode ParticleContainer< T, Dim >::getQMStorageMode ( ) const
inline

◆ getQView()

template<typename T , unsigned Dim = 3>
qm_view_type ParticleContainer< T, Dim >::getQView ( ) const
inline

Charge view in [Cb]. In SingleValue mode this is a rank-1 view of length 1. In Attributes mode this is the per-particle attribute view.

Definition at line 108 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::Attributes, ParticleContainer< T, Dim >::QAttr, ParticleContainer< T, Dim >::qmStorageMode_m, and ParticleContainer< T, Dim >::QView_m.

◆ getReference()

template<typename T , unsigned Dim = 3>
const PartData * ParticleContainer< T, Dim >::getReference ( ) const
inline

Get reference particle data.

Definition at line 421 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::reference_m.

Referenced by ParallelTracker::kickParticles().

◆ getRefPartP() [1/2]

template<typename T , unsigned Dim = 3>
Vector_t< double, Dim > & ParticleContainer< T, Dim >::getRefPartP ( )
inline

Get the reference particle momentum.

Definition at line 406 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::refPartP_m.

◆ getRefPartP() [2/2]

template<typename T , unsigned Dim = 3>
const Vector_t< double, Dim > & ParticleContainer< T, Dim >::getRefPartP ( ) const
inline

Get the reference particle momentum (const).

Definition at line 403 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::refPartP_m.

◆ getRefPartR() [1/2]

template<typename T , unsigned Dim = 3>
Vector_t< double, Dim > & ParticleContainer< T, Dim >::getRefPartR ( )
inline

Get the reference particle position.

Definition at line 397 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::refPartR_m.

◆ getRefPartR() [2/2]

template<typename T , unsigned Dim = 3>
const Vector_t< double, Dim > & ParticleContainer< T, Dim >::getRefPartR ( ) const
inline

Get the reference particle position (const).

Definition at line 394 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::refPartR_m.

◆ getRmsP()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getRmsP ( ) const
inline

Definition at line 254 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getStandardDeviationMomentum().

Here is the call graph for this function:

◆ getRmsR()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getRmsR ( ) const
inline

◆ getRmsRP()

template<typename T , unsigned Dim = 3>
Vector_t< double, 3 > ParticleContainer< T, Dim >::getRmsRP ( ) const
inline

Definition at line 260 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getStandardDeviationRP().

Here is the call graph for this function:

◆ getStdKineticEnergy()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getStdKineticEnergy ( ) const
inline

Definition at line 275 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getStdKineticEnergy().

Here is the call graph for this function:

◆ getTemperature()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getTemperature ( ) const
inline

Definition at line 297 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::getTemperature().

Here is the call graph for this function:

◆ getToLabTrafo() [1/2]

template<typename T , unsigned Dim = 3>
CoordinateSystemTrafo & ParticleContainer< T, Dim >::getToLabTrafo ( )
inline

Get local-to-lab coordinate transformation.

Definition at line 441 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::toLabTrafo_m.

◆ getToLabTrafo() [2/2]

template<typename T , unsigned Dim = 3>
const CoordinateSystemTrafo & ParticleContainer< T, Dim >::getToLabTrafo ( ) const
inline

Get local-to-lab coordinate transformation (const).

Definition at line 438 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::toLabTrafo_m.

◆ getTotalCharge()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getTotalCharge ( ) const
inline

Get total charge [Cb] in this container.

Definition at line 351 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::getChargePerParticle().

Here is the call graph for this function:

◆ getTotalMass()

template<typename T , unsigned Dim = 3>
double ParticleContainer< T, Dim >::getTotalMass ( ) const
inline

Get total mass [GeV] in this container.

Definition at line 391 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::getMassPerParticle().

Here is the call graph for this function:

◆ hasSpin()

template<typename T , unsigned Dim = 3>
bool ParticleContainer< T, Dim >::hasSpin ( ) const
inline

Returns true when per-particle spin storage was enabled at construction (enabled per beam when the BEAM has POLARIZATION set).

Definition at line 159 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::spinEnabled_m.

Referenced by Decay::apply().

◆ isMomentsDirty()

template<typename T , unsigned Dim = 3>
bool ParticleContainer< T, Dim >::isMomentsDirty ( ) const
inline

◆ isUnitlessPositions()

template<typename T , unsigned Dim = 3>
bool ParticleContainer< T, Dim >::isUnitlessPositions ( ) const
inline

◆ markMomentsClean()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::markMomentsClean ( )
inline

◆ markMomentsDirty()

◆ markParticlesOutside()

template<typename T , unsigned Dim = 3>
size_type ParticleContainer< T, Dim >::markParticlesOutside ( double  sigmasAway)
inline

Mark particles whose position is more than sigmasAway standard deviations from the bunch mean in any spatial dimension.

Recomputes distribution moments, then ORs the outlier decision into InvalidMask. Deletion is intentionally deferred to deleteInvalidParticles().

Parameters
sigmasAwayNumber of standard deviations defining the boundary.
Returns
Global number of newly marked particles (across all MPI ranks).

Definition at line 598 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::getMeanR(), ParticleContainer< T, Dim >::getRmsR(), ParticleContainer< T, Dim >::InvalidMask, ParticleContainer< T, Dim >::markMomentsDirty(), and ParticleContainer< T, Dim >::updateMoments().

Here is the call graph for this function:

◆ registerAttributes()

◆ scaleDtByCharge()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::scaleDtByCharge ( )
inline

Scale particle time-step weights by charge before scatter.

Multiplies each local dt[i] by the corresponding charge used for deposition. In QMStorageMode::Attributes, the per-particle QAttr(i) is used. In QMStorageMode::SingleValue, the shared scalar QView_m(0) is used.

Definition at line 484 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::Attributes, ParticleContainer< T, Dim >::dt, ParticleContainer< T, Dim >::QAttr, ParticleContainer< T, Dim >::qmStorageMode_m, and ParticleContainer< T, Dim >::QView_m.

◆ set_sPos()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::set_sPos ( double  sPos)
inline

Set longitudinal position along design trajectory.

Definition at line 424 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::sPos_m.

◆ setBCAllPeriodic()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setBCAllPeriodic ( )
inlineprivate

Definition at line 780 of file ParticleContainer.hpp.

Referenced by ParticleContainer< T, Dim >::setupBCs().

◆ setBunchStateHandler()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setBunchStateHandler ( std::shared_ptr< BunchStateHandler handler)
inline

◆ setEnergyReferenceMass()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setEnergyReferenceMass ( double  referenceMassGeV,
bool  rescaleToReference = true 
)
inline

Definition at line 248 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::distMoments_m, and DistributionMoments::setEnergyReferenceMass().

Referenced by ParticleContainer< T, Dim >::setReference().

Here is the call graph for this function:

◆ setGlobalProcesses()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setGlobalProcesses ( std::vector< std::unique_ptr< GlobalProcess > >  processes)
inline

◆ setGlobalToLocalQuaternion()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setGlobalToLocalQuaternion ( const Quaternion_t globalToLocalQuaternion)
inline

Set global-to-local rotation quaternion.

Definition at line 430 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::globalToLocalQuaternion_m.

◆ setM()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setM ( double  m)
inline

Set particle mass for the active M storage mode.

Parameters
mMass value in [GeV].

In QMStorageMode::Attributes, this assigns m to every local particle. In QMStorageMode::SingleValue, this updates the shared scalar mass view.

Definition at line 360 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::Attributes, ParticleContainer< T, Dim >::MAttr, ParticleContainer< T, Dim >::MView_m, and ParticleContainer< T, Dim >::qmStorageMode_m.

◆ setQ()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setQ ( double  q)
inline

Set particle charge for the active Q storage mode.

Parameters
qCharge value in [Cb].

In QMStorageMode::Attributes, this assigns q to every local particle. In QMStorageMode::SingleValue, this updates the shared scalar charge view.

Definition at line 318 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::Attributes, ParticleContainer< T, Dim >::QAttr, ParticleContainer< T, Dim >::qmStorageMode_m, and ParticleContainer< T, Dim >::QView_m.

◆ setReference()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setReference ( const PartData ref)
inline

Set reference particle data.

Definition at line 412 of file ParticleContainer.hpp.

References Units::eV2GeV, PartData::getM(), ParticleContainer< T, Dim >::reference_m, and ParticleContainer< T, Dim >::setEnergyReferenceMass().

Here is the call graph for this function:

◆ setRefPartP()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setRefPartP ( const Vector_t< double, Dim > &  refPartP)
inline

Set the reference particle momentum.

Definition at line 409 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::refPartP_m.

◆ setRefPartR()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setRefPartR ( const Vector_t< double, Dim > &  refPartR)
inline

Set the reference particle position.

Definition at line 400 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::refPartR_m.

◆ setToLabTrafo()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setToLabTrafo ( const CoordinateSystemTrafo toLabTrafo)
inline

Set local-to-lab coordinate transformation.

Definition at line 444 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::toLabTrafo_m.

◆ setupBCs()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::setupBCs ( )
inline

Definition at line 197 of file ParticleContainer.hpp.

References ParticleContainer< T, Dim >::setBCAllPeriodic().

Referenced by ParticleContainer< T, Dim >::ParticleContainer().

Here is the call graph for this function:

◆ switchOffUnitlessPositions()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::switchOffUnitlessPositions ( )
inline

Restore physical positions from unitless form using each particle's dt[i].

Applies \( R_i = R'_i \, c \, dt_i \).

Exceptions
OpalExceptionif this container is not currently in unitless positions.

Definition at line 563 of file ParticleContainer.hpp.

References Physics::c, and ParticleContainer< T, Dim >::containerState_m.

Referenced by ParallelTracker::pushParticles().

◆ switchToUnitlessPositions()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::switchToUnitlessPositions ( )
inline

Transform positions to unitless coordinates using each particle's dt[i].

Applies \( R'_i = R_i / (c \, dt_i) \). Requires valid non-zero dt values per particle.

Exceptions
OpalExceptionif this container is already in unitless positions.

Definition at line 540 of file ParticleContainer.hpp.

References Physics::c, and ParticleContainer< T, Dim >::containerState_m.

Referenced by ParallelTracker::pushParticles().

◆ transformBunch()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::transformBunch ( const CoordinateSystemTrafo trafo)
inline

Apply coordinate transform to local particles: translate R, rotate P, E, B.

Definition at line 200 of file ParticleContainer.hpp.

References CoordinateSystemTrafo::rotateBunchTo(), and CoordinateSystemTrafo::transformBunchTo().

Referenced by ParticleContainer< T, Dim >::updateRefToLabCSTrafo().

Here is the call graph for this function:

◆ unscaleDtByCharge()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::unscaleDtByCharge ( )
inline

◆ updateMoments()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::updateMoments ( )
inline

◆ updateRefToLabCSTrafo()

template<typename T , unsigned Dim = 3>
void ParticleContainer< T, Dim >::updateRefToLabCSTrafo ( double  bunchDT)
inline

Member Data Documentation

◆ B

template<typename T , unsigned Dim = 3>
Base::particle_position_type ParticleContainer< T, Dim >::B

electric field for gun simulation with bins

magnetic field at particle position

Definition at line 147 of file ParticleContainer.hpp.

Referenced by ParticleContainer< T, Dim >::createParticles(), ParallelTracker::kickParticles(), and ParticleContainer< T, Dim >::registerAttributes().

◆ Bin

template<typename T , unsigned Dim = 3>
ippl::ParticleAttrib<bin_index_type> ParticleContainer< T, Dim >::Bin

the energy bin the particle is in

Definition at line 132 of file ParticleContainer.hpp.

Referenced by ParticleContainer< T, Dim >::createParticles(), and ParticleContainer< T, Dim >::registerAttributes().

◆ containerState_m

template<typename T , unsigned Dim = 3>
std::shared_ptr<BunchStateHandler::ContainerState> ParticleContainer< T, Dim >::containerState_m
private

Per-container state slot allocated by the handler at setBunchStateHandler. Owned here as the only strong reference; the handler keeps a weak_ptr, so destroying this container automatically releases the slot. The slot's own methods handle MPI consistency, so no direct handler reference is needed.

Definition at line 792 of file ParticleContainer.hpp.

Referenced by ParticleContainer< T, Dim >::isMomentsDirty(), ParticleContainer< T, Dim >::isUnitlessPositions(), ParticleContainer< T, Dim >::markMomentsClean(), ParticleContainer< T, Dim >::markMomentsDirty(), ParticleContainer< T, Dim >::setBunchStateHandler(), ParticleContainer< T, Dim >::switchOffUnitlessPositions(), ParticleContainer< T, Dim >::switchToUnitlessPositions(), and ParticleContainer< T, Dim >::updateMoments().

◆ distMoments_m

◆ dt

◆ E

template<typename T , unsigned Dim = 3>
Base::particle_position_type ParticleContainer< T, Dim >::E

◆ globalProcesses_m

template<typename T , unsigned Dim = 3>
std::vector<std::unique_ptr<GlobalProcess> > ParticleContainer< T, Dim >::globalProcesses_m
private

Global physics processes attached to this container.

Definition at line 822 of file ParticleContainer.hpp.

Referenced by ParticleContainer< T, Dim >::getGlobalProcesses(), and ParticleContainer< T, Dim >::setGlobalProcesses().

◆ globalToLocalQuaternion_m

template<typename T , unsigned Dim = 3>
Quaternion_t ParticleContainer< T, Dim >::globalToLocalQuaternion_m
private

◆ InvalidMask

template<typename T , unsigned Dim = 3>
ippl::ParticleAttrib<bool> ParticleContainer< T, Dim >::InvalidMask

◆ MAttr

template<typename T , unsigned Dim = 3>
ippl::ParticleAttrib<double> ParticleContainer< T, Dim >::MAttr
private

◆ MView_m

◆ P

◆ Phi

template<typename T , unsigned Dim = 3>
ippl::ParticleAttrib<double> ParticleContainer< T, Dim >::Phi

the scalar potential in [Cb/s]

Definition at line 129 of file ParticleContainer.hpp.

Referenced by ParticleContainer< T, Dim >::createParticles(), and ParticleContainer< T, Dim >::registerAttributes().

◆ pl_m

template<typename T , unsigned Dim = 3>
PLayout_t<T, Dim> ParticleContainer< T, Dim >::pl_m
private

◆ Pol

template<typename T , unsigned Dim = 3>
ippl::ParticleAttrib<spin_vector_type> ParticleContainer< T, Dim >::Pol

Per-particle polarization vector P (rest-frame Pauli expectation values along lab-frame axes; |Pol| in [0, 1]). Registered only when spinEnabled_m is true. Storage is float to halve memory; kernels should compute in double and cast.

Definition at line 155 of file ParticleContainer.hpp.

Referenced by Decay::apply(), and ParticleContainer< T, Dim >::registerAttributes().

◆ QAttr

◆ qmStorageMode_m

◆ QView_m

◆ reference_m

template<typename T , unsigned Dim = 3>
const PartData* ParticleContainer< T, Dim >::reference_m = nullptr
private

◆ refPartP_m

◆ refPartR_m

◆ Sp

template<typename T , unsigned Dim = 3>
short ParticleContainer< T, Dim >::Sp = 0

the particle specis

Definition at line 135 of file ParticleContainer.hpp.

◆ spinEnabled_m

template<typename T , unsigned Dim = 3>
bool ParticleContainer< T, Dim >::spinEnabled_m = false
private

◆ sPos_m

◆ toLabTrafo_m


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