35KOKKOS_INLINE_FUNCTION
typename T::value_type
L2Norm(
T& x) {
41template <
typename T,
unsigned Dim>
44 T, Dim, ParticleContainer<T, Dim>, FieldContainer<T, Dim>, LoadBalancer<T, Dim>> {
200 std::shared_ptr<VField_t<T, Dim>>
Etmp_m;
209 std::string integration_method,
210 std::shared_ptr<Distribution> &OPALdistribution,
211 std::shared_ptr<FieldSolverCmd> &OPALFieldSolver);
218 *
gmsg <<
"* PartBunch Destructor: Finished time step: " << this->it_m <<
" time: " << this->time_m <<
endl;
347 *gmsg <<
"not implemented" <<
endl;
408 void swap(
unsigned int ,
unsigned int ) {
446 "PartBunch is already in unitless positions!");
455 KOKKOS_LAMBDA(
const size_t i) {
456 double fac = use_dt_per_particle ? (1.0 / (
Physics::c * dtview(i)))
463 *
gmsg <<
"* Switched to unitless positions." <<
endl;
491 "PartBunch is already in physical positions!");
500 KOKKOS_LAMBDA(
const size_t i) {
501 double fac = use_dt_per_particle ? (
Physics::c * dtview(i))
508 *
gmsg <<
"* Switched to physical positions." <<
endl;
517 unsigned int , std::vector<double>& , std::pair<double, double>& ) {
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
typename ippl::detail::ViewType< ippl::Vector< double, Dim >, 1 >::view_type view_type
KOKKOS_INLINE_FUNCTION T::value_type L2Norm(T &x)
typename ippl::detail::ViewType< ippl::Vector< double, 3 >, 1 >::view_type view_type
Defines a structure to hold particles in energy bins and their associated data.
Inform & endl(Inform &inf)
constexpr double c
The velocity of light in m/s.
KOKKOS_INLINE_FUNCTION constexpr decltype(auto) apply(const View &view, const Coords &coords)
RangePolicy< View::rank, typenameView::execution_space, PolicyArgs... >::policy_type getRangePolicy(const View &view, int shift=0)
void parallel_for(const std::string &name, const ExecPolicy &policy, const FunctorType &functor)
long long localTrackStep_m
step in a TRACK command
Vector_t< double, Dim > get_rprms() const
void setGlobalMeanR(Vector_t< double, Dim > globalMeanR)
PartData * getReference()
long long getLocalTrackStep() const
void performBunchSanityChecks() const
Vector_t< double, Dim > rmin_m
void gatherLoadBalanceStatistics()
std::array< bool, Dim > decomp_m
size_t getNumberOfEmissionSteps()
void calcLineDensity(unsigned int, std::vector< double > &, std::pair< double, double > &)
Vector_t< double, Dim > R(size_t)
Vector_t< double, Dim > get_rrms() const
void pre_run() override
A method that should be used for setting up the simulation.
Vector_t< T, Dim > globalMeanR_m
Initialize the translation vector and rotation quaternion here.
void setSteptoLastInj(int n)
void setBinCharge(int, double)
double t_m
holds the actual time of the integration
void setBeamFrequency(double)
Vector_t< double, Dim > P(size_t)
size_t getTotalNum() const
Vector_t< double, Dim > get_normalizedEps_99_99Percentile() const
void swap(unsigned int, unsigned int)
Vector_t< double, Dim > get_norm_emit() const
void setTEmission(double)
double get_plasmaParameter() const
void getLocalBounds(Vector_t< double, Dim > &, Vector_t< double, Dim > &)
void switchOffUnitlessPositions(bool use_dt_per_particle=false)
Convert particle positions from unitless back to physical coordinates.
Vector_t< double, Dim > get_prms() const
int getSteptoLastInj() const
void resetInterpolationCache(bool)
void setCouplingConstant(double c)
Vector_t< double, Dim > get_pmean_Distribution() const
int getLastEmittedEnergyBin()
bool resetPartBinID2(const double)
long long getGlobalTrackStep() const
double get_rmsDensity() const
Vector_t< double, Dim > get_emit() const
double getChargePerParticle() const
Vector_t< double, Dim > get_95Percentile() const
int stepsPerTurn_m
steps per turn for OPAL-cycl
int getStepsPerTurn() const
std::shared_ptr< VField_t< T, Dim > > getTempEField()
double spos_m
the position along design trajectory
double getCouplingConstant() const
Vector_t< double, Dim > get_rmean() const
double getBeta(int) const
void grid2par() override
Grid-to-particle operation.
Quaternion_t globalToLocalQuaternion_m
void scatterCICPerBin(binIndex_t binIndex)
typename ParticleBinning::AdaptBins< ParticleContainer_t, BinningSelector_t > AdaptBins_t
void get_PBounds(Vector_t< double, Dim > &, Vector_t< double, Dim > &)
Vector_t< double, Dim > rmax_m
void setGlobalToLocalQuaternion(Quaternion_t globalToLocalQuaternion)
Vector_t< double, Dim > get_maxExtent() const
std::shared_ptr< FieldSolverCmd > OPALFieldSolver_m
Vector_t< double, Dim > globalMeanR_m
Initialize the translation vector and rotation quaternion here.
double getCharge() const
get the total charge per simulation particle
Vector_t< double, Dim > get_68Percentile() const
int getNumberOfEnergyBins()
std::shared_ptr< BCHandler_t > getBCHandler() const
void get_bounds(Vector_t< double, Dim > &rmin, Vector_t< double, Dim > &rmax)
size_t calcNumPartsOutside(Vector_t< double, Dim >)
bool isFirstRepartition_m
double get_debyeLength() const
short numBunch_m
current bunch number
void setBCHandler(std::shared_ptr< BCHandler_t > bcHandler)
double tEmission_m
if larger than 0, emitt particles for tEmission_m [s]
Vector_t< double, Dim > Bf(size_t)
typename ParticleContainer_t::bin_index_type binIndex_t
Vector_t< double, Dim > getEExtrema()
Inform & print(Inform &os)
Vector_t< int, Dim > nr_m
std::shared_ptr< ParticleContainer_t > getParticleContainer()
ParticleAttrib< double > dt
Vector_t< double, Dim > get_normalizedEps_68Percentile() const
double get_meanKineticEnergy()
double dt_m
6x6 matrix of the moments of the beam
void setLocalTrackStep(long long n)
step in a TRACK command
Vector_t< double, 2 *Dim > get_centroid() const
void par2grid() override
Particle-to-grid operation.
long long globalTrackStep_m
if multiple TRACK commands
Vector_t< double, Dim > get_halo() const
std::shared_ptr< VField_t< T, Dim > > Etmp_m
Temporary E field container used to store temporary E field during binned solver.
size_t emitParticles(double)
bool getFieldSolverType()
std::vector< size_t > bunchTotalNum_m
number of particles per bunch
void setSolver(std::string solver)
void gatherStatistics(unsigned int)
size_t getLocalNum() const
short getNumBunch() const
Vector_t< double, Dim > get_normalizedEps_95Percentile() const
int SteptoLastInj_m
this parameter records the current steps since last bunch injection it helps to inject new bunches co...
Vector_t< double, Dim > get_99_99Percentile() const
std::string integration_method_m
double get_temperature() const
ippl::NDIndex< Dim > domain_m
Vector_t< double, Dim > get_hr() const
Vector_t< double, Dim > dt(size_t)
Vector_t< double, Dim > RefPartR_m
Reference particle structures.
void calcBeamParameters()
void setStepsPerTurn(int n)
Vector_t< double, Dim > hr_m
mesh size [m]
void spaceChargeEFieldCheck(Vector_t< double, 3 > efScale)
double calculateAngle(double, double)
void setNumBunch(short n)
void setLocalBinCount(size_t, int)
void switchToUnitlessPositions(bool use_dt_per_particle=false)
Transform particle positions to a unitless coordinate system.
void setBins(std::shared_ptr< AdaptBins_t > bins)
size_t getLoadBalance(int p)
std::vector< size_t > bunchLocalNum_m
typename ParticleBinning::CoordinateSelector< ParticleContainer_t > BinningSelector_t
Quaternion_t getGlobalToLocalQuaternion()
Vector_t< double, Dim > origin_m
double couplingConstant_m
void advance() override
A method that should be used to execute/advance a step of simulation.
size_t getTotalNum() const
Vector_t< double, Dim > get_normalizedEps_99Percentile() const
std::shared_ptr< BCHandler_t > bcHandler_m
std::shared_ptr< Distribution > OPALdist_m
std::shared_ptr< AdaptBins_t > getBins()
Vector_t< double, Dim > Ef(size_t)
Vector_t< double, Dim > get_origin() const
void setGlobalTrackStep(long long n)
step in multiple TRACK commands
double getEmissionDeltaT()
double getMassPerParticle() const
Vector_t< double, Dim > RefPartP_m
double getRho(int, int, int)
Vector_t< double, Dim > getGlobalMeanR()
Vector_t< double, Dim > get_99Percentile() const
Vector_t< double, Dim > get_pmean() const
std::unique_ptr< size_t[]> globalPartPerNode_m
double getGamma(int) const
std::shared_ptr< AdaptBins_t > bins_m
CoordinateSystemTrafo toLabTrafo_m
std::unique_ptr< double[]> bingamma_m
holds the gamma of the bin
void setTempEField(std::shared_ptr< VField_t< T, Dim > > Etmp)
Handler for boundary conditions per spatial dimension.
A class that bins particles in energy bins and allows for adaptive runtime rebinning.
Example struct used to access the binning variable for each particle.
short int bin_index_type
Defines which type to use as a particle bin.
The base class for all OPAL exceptions.
A template class for managing Particle-in-Cell (PIC) simulations.
std::shared_ptr< ParticleContainer< T, 3 > > pcontainer_m
detail::size_type size_type