OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
PartBunchBase.h
Go to the documentation of this file.
1//
2// Class PartBunchBase
3// Base class for representing particle bunches.
4//
5// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
18#ifndef PART_BUNCH_BASE_H
19#define PART_BUNCH_BASE_H
20
26#include "Algorithms/Vektor.h"
33#include "Physics/Units.h"
36#include "Utility/IpplTimings.h"
37
38#include <memory>
39#include <utility>
40#include <vector>
41
42class Distribution;
43class FieldSolver;
44class PartBins;
45class PartBinsCyc;
46class PartData;
47
48template <class T, unsigned Dim>
49class PartBunchBase : std::enable_shared_from_this<PartBunchBase<T, Dim>>
50{
51public:
56
57 typedef std::pair<Vector_t, Vector_t> VectorPair_t;
58
59 static const unsigned Dimension = Dim;
60
61 enum UnitState_t { units = 0, unitless = 1 };
62
63public:
64 virtual ~PartBunchBase() { }
65
67
68 PartBunchBase(const PartBunchBase& rhs) = delete; // implement if needed
69
70 /*
71 * Bunch common member functions
72 */
73
74 // This is required since we initialize the Layout and the RegionLayout with default constructor
75 virtual void initialize(FieldLayout_t* fLayout) = 0;
76
77 bool getIfBeamEmitting();
78
80
82
84
85 void Rebin();
86
87 void setEnergyBins(int numberOfEnergyBins);
88
89 bool weHaveEnergyBins();
90
91 //FIXME: unify methods, use convention that all particles have own dt
92 void switchToUnitlessPositions(bool use_dt_per_particle = false);
93
94 //FIXME: unify methods, use convention that all particles have own dt
95 void switchOffUnitlessPositions(bool use_dt_per_particle = false);
96
98 std::vector<Distribution*> addedDistributions,
99 size_t& np);
101 size_t numberOfParticles,
102 double current, const Beamline& bl);
103
104 bool isGridFixed() const;
105
106 bool hasBinning() const;
107
108
109 /*
110 Energy bins related functions
111 */
112
113 void setTEmission(double t);
114
115 double getTEmission();
116
117 bool doEmission();
118
119 bool weHaveBins() const;
120
121 void setPBins(PartBins* pbin);
122
123 void setPBins(PartBinsCyc* pbin);
124
129 size_t emitParticles(double eZ);
130
131 void updateNumTotal();
132
133 void rebin();
134
135 int getLastemittedBin();
136
137 void setLocalBinCount(size_t num, int bin);
138
140 void calcGammas();
141
142 void calcGammas_cycl();
143
145 void calcDebyeLength();
146
148 double getBinGamma(int bin);
149
151 virtual void setBinCharge(int bin, double q);
152
154 virtual void setBinCharge(int bin);
155
158
159 void calcLineDensity(unsigned int nBins, std::vector<double>& lineDensity,
160 std::pair<double, double>& meshInfo);
161
162 void setBeamFrequency(double v);
163
164 /*
165 Mesh and Field Layout related functions
166 */
167
168 virtual void boundp();
169
171 void boundp_destroyCycl();
172
174 size_t boundp_destroyT();
175
176 size_t destroyT();
177
178 /*
179 Read out coordinates
180 */
181 virtual double getPx(int i);
182 virtual double getPy(int i);
183 virtual double getPz(int i);
184
185 virtual double getPx0(int i);
186 virtual double getPy0(int i);
187
188 virtual double getX(int i);
189 virtual double getY(int i);
190 virtual double getZ(int i);
191
192 virtual double getX0(int i);
193 virtual double getY0(int i);
194
195 virtual void setZ(int i, double zcoo);
196
197 void get_bounds(Vector_t& rmin, Vector_t& rmax) const;
198
199 void getLocalBounds(Vector_t& rmin, Vector_t& rmax) const;
200
201 std::pair<Vector_t, double> getBoundingSphere();
202
203 std::pair<Vector_t, double> getLocalBoundingSphere();
204
205
206 /*
207 Compatibility function push_back
208 */
209 void push_back(OpalParticle const& p);
210
211 void setParticle(FVector<double, 6> z, int ii);
212
213 void setParticle(OpalParticle const& p, int ii);
214
216
218 friend class PartBunchBase<T, Dim>;
219
220 public:
222 bunch_m(nullptr),
223 index_m(0)
224 {}
225 ConstIterator(PartBunchBase const* bunch, unsigned int i):
226 bunch_m(bunch),
227 index_m(i)
228 {}
229
231 {}
232
233 bool operator == (ConstIterator const& rhs) const
234 {
235 return bunch_m == rhs.bunch_m && index_m == rhs.index_m;
236 }
237
238 bool operator != (ConstIterator const& rhs) const
239 {
240 return bunch_m != rhs.bunch_m || index_m != rhs.index_m;
241 }
242
244 {
245 if (index_m >= bunch_m->getLocalNum()) {
246 throw GeneralClassicException("PartBunchBase::ConstIterator::operator*", "out of bounds");
247 }
249 bunch_m->R[index_m],
250 bunch_m->P[index_m],
251 bunch_m->getT(),
252 bunch_m->Q[index_m],
254 }
255
257 {
258 ++index_m;
259 return *this;
260 }
261
263 {
264 ConstIterator it = *this;
265 ++index_m;
266
267 return it;
268 }
269
270 int operator-(const ConstIterator& other) const
271 {
272 return index_m - other.index_m;
273 }
274 private:
276 unsigned int index_m;
277 };
278
280 return ConstIterator(this, 0);
281 }
282
284 return ConstIterator(this, getLocalNum());
285 }
286
288 // The matrix [b]D[/b] is used to normalise the first two modes.
289 // The maximum normalised amplitudes for these modes are stored
290 // in [b]axmax[/b] and [b]aymax[/b].
292 double& axmax, double& aymax);
293
294 void setdT(double dt);
295 double getdT() const;
296
297 void setT(double t);
298 void incrementT();
299 double getT() const;
300
307 double get_sPos() const;
308
309 void set_sPos(double s);
310
311 double get_gamma() const;
312 double get_meanKineticEnergy() const;
313 double get_temperature() const;
314 double get_debyeLength() const;
315 double get_plasmaParameter() const;
316 double get_rmsDensity() const;
317 Vector_t get_origin() const;
318 Vector_t get_maxExtent() const;
319 Vector_t get_centroid() const;
320 Vector_t get_rrms() const;
321 Vector_t get_rprms() const;
322 Vector_t get_rmean() const;
323 Vector_t get_prms() const;
324 Vector_t get_pmean() const;
326 Vector_t get_emit() const;
327 Vector_t get_norm_emit() const;
328 Vector_t get_halo() const;
337 virtual Vector_t get_hr() const;
338
339 double get_Dx() const;
340 double get_Dy() const;
341 double get_DDx() const;
342 double get_DDy() const;
343
344 virtual void set_meshEnlargement(double dh);
345
347 size_t getLoadBalance(int p) const;
348
349 void get_PBounds(Vector_t &min, Vector_t &max) const;
350
351 void calcBeamParameters();
352 void calcBeamParametersInitial(); // Calculate initial beam parameters before emission.
353
354 double getCouplingConstant() const;
355 void setCouplingConstant(double c);
356
357 // set the charge per simulation particle
358 void setCharge(double q);
359 // set the charge per simulation particle when total particle number equals 0
360 void setChargeZeroPart(double q);
361
362 // set the mass per simulation particle
363 void setMass(double mass);
364 void setMassZeroPart(double mass);
365
367 double getCharge() const;
368
370 double getChargePerParticle() const;
371
372 double getMassPerParticle() const;
373
374 virtual void setSolver(FieldSolver *fs);
375
376 bool hasFieldSolver();
377
379
380 void setStepsPerTurn(int n);
381 int getStepsPerTurn() const;
382
384 void setGlobalTrackStep(long long n);
385 long long getGlobalTrackStep() const;
386
388 void setLocalTrackStep(long long n);
389 void incTrackSteps();
390 long long getLocalTrackStep() const;
391
392 void setNumBunch(short n);
393 short getNumBunch() const;
394
395 // used in ParallelCyclotronTracker for multi-bunch mode
396 void setTotalNumPerBunch(size_t numpart, short n);
397 size_t getTotalNumPerBunch(short n) const;
398
399 void setLocalNumPerBunch(size_t numpart, short n);
400 size_t getLocalNumPerBunch(short n) const;
401
402 /* used in initializeTracking_m of ParallelCyclotronTracker
403 * for multi-bunch mode
404 */
406
407 void setGlobalMeanR(Vector_t globalMeanR);
409 void setGlobalToLocalQuaternion(Quaternion_t globalToLocalQuaternion);
411
412 void setSteptoLastInj(int n);
413 int getSteptoLastInj() const;
414
416 double calcMeanPhi();
417
419 bool resetPartBinID2(const double eta);
420
421 bool resetPartBinBunch();
422
424 double getQ() const;
425 double getM() const;
426 double getP() const;
427 double getE() const;
429 ParticleType getPType() const;
430 double getInitialBeta() const;
431 double getInitialGamma() const;
434 void resetQ(double q);
435 void resetM(double m);
437 void setPType(const std::string& type);
439 double getdE() const;
440 virtual double getGamma(int i);
441 virtual double getBeta(int i);
442 virtual void actT();
443
444 const PartData* getReference() const;
445
446 double getEmissionDeltaT();
447
449
456
457 void iterateEmittedBin(int binNumber);
458
459 void calcEMean();
460
461 Inform& print(Inform& os);
462
463 /*
464 * (Pure) virtual member functions
465 */
466
467 virtual void runTests();
468
469 virtual void do_binaryRepart();
470
471 virtual void resetInterpolationCache(bool clearCache = false);
472
473 //brief calculates back the max/min of the efield on the grid
475
476 virtual double getRho(int x, int y, int z) = 0;
477
478 virtual void computeSelfFields() = 0;
479
480 //brief used for self fields with binned distribution
481 virtual void computeSelfFields(int bin) = 0;
482
483 virtual void computeSelfFields_cycl(double gamma) = 0;
484 virtual void computeSelfFields_cycl(int bin) = 0;
485
486 virtual void swap(unsigned int i, unsigned int j);
487
488 /*
489 Mesh and Field Layout related functions
490 */
491
492 virtual void setBCAllPeriodic();
493 virtual void setBCAllOpen();
494
495 virtual void setBCForDCBeam();
496
497
498// virtual void setMesh(Mesh_t* mesh) = 0;
499// virtual Mesh_t &getMesh() = 0;
500
501// virtual void setFieldLayout(FieldLayout_t* fLayout) = 0;
503
504 virtual void resizeMesh() { };
505
506 /*
507 * Wrapped member functions of IpplParticleBase
508 */
509
510 size_t getTotalNum() const;
511 void setTotalNum(size_t n);
512 void setLocalNum(size_t n);
513 size_t getLocalNum() const;
514
515 size_t getDestroyNum() const;
516 size_t getGhostNum() const;
517
519 const ParticleLayout<T, Dim>& getLayout() const;
520
521 bool getUpdateFlag(UpdateFlags_t f) const;
522 void setUpdateFlag(UpdateFlags_t f, bool val);
523
524
526 return pbase_m->getBConds();
527 }
528
530 pbase_m->setBConds(bc);
531 }
532
533 bool singleInitNode() const;
534
535 void resetID();
536
537 void update();
538 void update(const ParticleAttrib<char>& canSwap);
539
540 void createWithID(unsigned id);
541 void create(size_t M);
542 void globalCreate(size_t np);
543
544 void destroy(size_t M, size_t I, bool doNow = false);
545 void performDestroy(bool updateLocalNum = false);
546 void ghostDestroy(size_t M, size_t I);
547
548protected:
549 size_t calcMoments(); // Calculates bunch moments using only emitted particles.
550
551 /* Calculates bunch moments by summing over bins
552 * (not accurate when any particles have been emitted).
553 */
556 double calculateAngle(double x, double y);
557
558
559private:
560 virtual void updateDomainLength(Vektor<int, 3>& grid) = 0;
561
562 virtual void updateFields(const Vector_t& hr, const Vector_t& origin);
563
565
566public:
567 /*
568 * Bunch attributes
569 */
572
573 // Particle container attributes
574 ParticleAttrib< Vector_t > P; // particle momentum // ParticleSpatialLayout<double, 3>::ParticlePos_t P;
575 ParticleAttrib< double > Q; // charge per simulation particle, unit: C.
576 ParticleAttrib< double > M; // mass per simulation particle, for multi-species particle tracking, unit:GeV/c^2.
577 ParticleAttrib< double > Phi; // the electric potential
579 ParticleAttrib< Vector_t > Eftmp; // e field vector for gun simulations
580
582 ParticleAttrib< int > Bin; // holds the bin in which the particle is in, if zero particle is marked for deletion
583 ParticleAttrib< double > dt; // holds the dt timestep for particle
585 ParticleAttrib< ParticleOrigin > POrigin; // we can distinguish dark current particles from primary particle
586 ParticleAttrib< int > TriID; // holds the ID of triangle that the particle hit. Only for BoundaryGeometry case.
587 ParticleAttrib< short > cavityGapCrossed; // particle just crossed cavity gap (for ParallelCyclotronTracker)
588 ParticleAttrib< short > bunchNum; // bunch number to which particle belongs (multi-bunch mode)
589
592
594
597
598 // The structure for particle binning
600
604
605 // For AMTS integrator in OPAL-T
607
608 // get 2nd order momentum matrix
610
611private:
612 // save particles in case of one core
613 std::unique_ptr<Inform> pmsg_m;
614 std::unique_ptr<std::ofstream> f_stream;
617
618protected:
623
627
629
630 /*
631 Member variables starts here
632 */
633
634 // unit state of PartBunch
637
639 double centroid_m[2 * Dim];
640
642 double dt_m;
644 double t_m;
646 double spos_m;
647
651 //Vector_t globalMeanR_m = Vector_t(0.0, 0.0, 0.0);
652 //Quaternion_t globalToLocalQuaternion_m = Quaternion_t(1.0, 0.0, 0.0, 0.0);
655
660
661 //RMS number density of particles from grid
663
668
671
673
674 double qi_m;
676
679
681 double dh_m;
682
685
687 std::unique_ptr<double[]> bingamma_m;
688
689 //FIXME: this should go into the Bin class!
690 // holds number of emitted particles of the bin
691 // jjyang: opal-cycl use *nBin_m of pbin_m
692 std::unique_ptr<size_t[]> binemitted_m;
693
696
699
702
705
707 std::vector<size_t> bunchTotalNum_m;
708 std::vector<size_t> bunchLocalNum_m;
709
714
715 /*
716 Data structure for particle load balance information
717 */
718
719 std::unique_ptr<size_t[]> globalPartPerNode_m;
720
723
724 // flag to tell if we are a DC-beam
727 std::shared_ptr<AbstractParticle<T, Dim> > pbase_m;
728};
729
730template<class T, unsigned Dim>
732 return bunch.begin();
733}
734
735template<class T, unsigned Dim>
737 return bunch.end();
738}
739
740#include "PartBunchBase.hpp"
741
742#endif
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
ParticleOrigin
ParticleType
DistributionType
Definition: Distribution.h:50
const unsigned Dim
FieldSolverType
Definition: FieldSolver.h:38
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:84
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:76
constexpr double c
The velocity of light in m/s.
Definition: Physics.h:45
constexpr double eV2MeV
Definition: Units.h:77
boost::function< boost::tuple< double, bool >(arguments_t)> type
Definition: function.hpp:21
FRONT * fs
Definition: hypervolume.cpp:59
ParticleLayout< T, Dim > & getLayout()
double get_Dx() const
double getP() const
void setEnergyBins(int numberOfEnergyBins)
ParticleAttrib< Vector_t > Ef
double get_meanKineticEnergy() const
std::shared_ptr< AbstractParticle< T, Dim > > pbase_m
ParticlePos_t & R
double spos_m
the position along design trajectory
void setDistribution(Distribution *d, std::vector< Distribution * > addedDistributions, size_t &np)
virtual void resetInterpolationCache(bool clearCache=false)
std::vector< size_t > bunchTotalNum_m
number of particles per bunch
void setPType(const std::string &type)
long long localTrackStep_m
step in a TRACK command
const PartData * getReference() const
ParticleAttrib< int > Bin
ParticleOrigin getPOrigin() const
void setMass(double mass)
void setCharge(double q)
Vector_t RefPartP_m
int getSteptoLastInj() const
Vector_t get_99Percentile() const
void boundp_destroyCycl()
void get_bounds(Vector_t &rmin, Vector_t &rmax) const
bool resetPartBinID2(const double eta)
reset Bin[] for each particle according to the method given in paper PAST-AB(064402) by G....
virtual void resizeMesh()
void setNumBunch(short n)
AbstractParticle< T, Dim >::ParticlePos_t ParticlePos_t
Definition: PartBunchBase.h:52
double periodLength_m
double getMassPerParticle() const
AbstractParticle< T, Dim >::ParticleIndex_t ParticleIndex_t
Definition: PartBunchBase.h:53
bool fixed_grid
if the grid does not have to adapt
double getQ() const
Access to reference data.
double getCouplingConstant() const
Vector_t get_normalizedEps_99Percentile() const
double getChargePerParticle() const
get the macro particle charge
virtual void computeSelfFields()=0
virtual void set_meshEnlargement(double dh)
UnitState_t unit_state_
void resetM(double m)
double rmsDensity_m
ParticleAttrib< Vector_t > Eftmp
virtual double getBeta(int i)
virtual double getPx0(int i)
size_t getLocalNum() const
FMatrix< double, 2 *Dim, 2 *Dim > getSigmaMatrix() const
IpplTimings::TimerRef boundpTimer_m
double t_m
holds the actual time of the integration
void set_sPos(double s)
void setLocalTrackStep(long long n)
step in a TRACK command
void setLocalBinCount(size_t num, int bin)
long long globalTrackStep_m
if multiple TRACK commands
double get_debyeLength() const
bool getUpdateFlag(UpdateFlags_t f) const
void setParticle(FVector< double, 6 > z, int ii)
Vector_t rmax_m
maximal extend of particles
ParticleAttrib< double > M
size_t emitParticles(double eZ)
Emit particles in the given bin i.e. copy the particles from the bin structure into the particle cont...
void maximumAmplitudes(const FMatrix< double, 6, 6 > &D, double &axmax, double &aymax)
Return maximum amplitudes.
double get_plasmaParameter() const
void setMassZeroPart(double mass)
size_t getTotalNum() const
bool weHaveEnergyBins()
double get_DDy() const
virtual void updateFields(const Vector_t &hr, const Vector_t &origin)
Vector_t get_95Percentile() const
bool resetPartBinBunch()
virtual void setZ(int i, double zcoo)
std::unique_ptr< size_t[]> binemitted_m
double calcMeanPhi()
calculate average angle of longitudinal direction of bins
Quaternion_t getGlobalToLocalQuaternion()
const PartData * reference
size_t boundp_destroyT()
void setBeamFrequency(double v)
Vector_t get_normalizedEps_68Percentile() const
double get_gamma() const
ParticleBConds< Position_t, Dimension > & getBConds()
ParticleAttrib< Vector_t > P
void switchToUnitlessPositions(bool use_dt_per_particle=false)
size_t calcNumPartsOutside(Vector_t x)
returns the number of particles outside of a box defined by x
double getTEmission()
virtual ~PartBunchBase()
Definition: PartBunchBase.h:64
IpplTimings::TimerRef histoTimer_m
ParticleAttrib< ParticleType > PType
short numBunch_m
current bunch number
double getdT() const
Quaternion_t globalToLocalQuaternion_m
virtual void initialize(FieldLayout_t *fLayout)=0
Inform & print(Inform &os)
FieldSolverType getFieldSolverType() const
Return the fieldsolver type if we have a fieldsolver.
double getEmissionDeltaT()
virtual void updateDomainLength(Vektor< int, 3 > &grid)=0
void setLocalNumPerBunch(size_t numpart, short n)
size_t getLocalNumPerBunch(short n) const
void setGlobalToLocalQuaternion(Quaternion_t globalToLocalQuaternion)
ParticleAttrib< ParticleOrigin > POrigin
virtual void computeSelfFields_cycl(double gamma)=0
Vector_t get_rrms() const
std::unique_ptr< Inform > pmsg_m
bool getIfBeamEmitting()
bool weHaveBins() const
Vector_t RefPartR_m
double get_rmsDensity() const
virtual double getPy(int i)
double getBinGamma(int bin)
Get gamma of one bin.
ParticleAttrib< double > Q
double getInitialBeta() const
int getLastEmittedEnergyBin()
void calcBeamParameters()
void getLocalBounds(Vector_t &rmin, Vector_t &rmax) const
void setSteptoLastInj(int n)
virtual double getX0(int i)
virtual double getRho(int x, int y, int z)=0
double getInitialGamma() const
virtual void setBCAllPeriodic()
virtual void runTests()
void setQKs3D(Quaternion_t q)
Vector_t rmin_m
minimal extend of particles
void setChargeZeroPart(double q)
virtual double getY0(int i)
int stepsPerTurn_m
steps per turn for OPAL-cycl
IpplTimings::TimerRef statParamTimer_m
ParticleType getPType() const
Vector_t get_origin() const
Distribution * dist_m
Vector_t get_prms() const
double getdE() const
void createWithID(unsigned id)
PartBunchBase(AbstractParticle< T, Dim > *pb, const PartData *ref)
double getCharge() const
get the total charge per simulation particle
virtual double getPy0(int i)
double get_temperature() const
IpplTimings::TimerRef distrReload_m
timer for IC, can not be in Distribution.h
size_t getTotalNumPerBunch(short n) const
double centroid_m[2 *Dim]
holds the centroid of the beam
virtual double getPx(int i)
Vector_t get_pmean_Distribution() const
void setBConds(const ParticleBConds< Position_t, Dimension > &bc)
ParticleAttrib< short > cavityGapCrossed
size_t getNumberOfEmissionSteps()
ParticleAttrib< double > Phi
void calcLineDensity(unsigned int nBins, std::vector< double > &lineDensity, std::pair< double, double > &meshInfo)
calculates the 1d line density (not normalized) and append it to a file.
double dt_m
holds the timestep in seconds
Vector_t get_68Percentile() const
void setup(AbstractParticle< T, Dim > *pb)
virtual void setBCAllOpen()
void setTotalNum(size_t n)
CoordinateSystemTrafo toLabTrafo_m
void calcBeamParametersInitial()
IpplTimings::TimerRef boundpBoundsTimer_m
FieldSolver * fs_m
stores the used field solver
std::pair< Vector_t, Vector_t > VectorPair_t
Definition: PartBunchBase.h:57
void setKs3DRefp(Vector_t p)
AbstractParticle< T, Dim >::Position_t Position_t
Definition: PartBunchBase.h:55
long long getLocalTrackStep() const
void setGlobalMeanR(Vector_t globalMeanR)
PartBins * pbin_m
void setCouplingConstant(double c)
short getNumBunch() const
double get_DDx() const
virtual void computeSelfFields(int bin)=0
virtual void do_binaryRepart()
ParticleAttrib< int > TriID
Vector_t get_norm_emit() const
void calcGammas()
Compute the gammas of all bins.
double dh_m
Mesh enlargement.
ParticleAttrib< double > dt
int getStepsPerTurn() const
PartBunchBase(const PartBunchBase &rhs)=delete
void setdT(double dt)
double get_Dy() const
Vector_t get_rprms() const
IpplTimings::TimerRef boundpUpdateTimer_m
Quaternion_t getQKs3D()
static const unsigned Dimension
Definition: PartBunchBase.h:59
double couplingConstant_m
std::vector< size_t > bunchLocalNum_m
void setPOrigin(ParticleOrigin)
Vector_t get_maxExtent() const
Vector_t get_normalizedEps_95Percentile() const
void gatherLoadBalanceStatistics()
void countTotalNumPerBunch()
DistributionType getDistType() const
void get_PBounds(Vector_t &min, Vector_t &max) const
void calcGammas_cycl()
virtual void setBinCharge(int bin, double q)
Set the charge of one bin to the value of q and all other to zero.
bool isGridFixed() const
Vector_t get_halo() const
void performDestroy(bool updateLocalNum=false)
Vector_t getGlobalMeanR()
void ghostDestroy(size_t M, size_t I)
ParticleType refPType_m
int getNumberOfEnergyBins()
Vector_t hr_m
meshspacing of cartesian mesh
void setGlobalTrackStep(long long n)
step in multiple TRACK commands
std::pair< Vector_t, double > getBoundingSphere()
double tEmission_m
relative enlargement of the mesh
Vector_t get_centroid() const
Vector_t get_99_99Percentile() const
void push_back(OpalParticle const &p)
virtual double getX(int i)
virtual double getPz(int i)
ParticleAttrib< short > bunchNum
void setLocalNum(size_t n)
std::unique_ptr< std::ofstream > f_stream
Vector_t get_pmean() const
void setTotalNumPerBunch(size_t numpart, short n)
virtual void setBCForDCBeam()
bool hasBinning() const
void setKs3DRefr(Vector_t r)
void destroy(size_t M, size_t I, bool doNow=false)
ParticleAttrib< Vector_t > Bf
IpplTimings::TimerRef distrCreate_m
void globalCreate(size_t np)
AbstractParticle< T, Dim >::UpdateFlags UpdateFlags_t
Definition: PartBunchBase.h:54
Vector_t get_normalizedEps_99_99Percentile() const
OpalParticle getParticle(int ii)
virtual void swap(unsigned int i, unsigned int j)
virtual void actT()
std::unique_ptr< size_t[]> globalPartPerNode_m
void setPBins(PartBins *pbin)
Vector_t globalMeanR_m
virtual void boundp()
ConstIterator end() const
int distDump_m
counter to store the distribution dump
ConstIterator begin() const
void create(size_t M)
Vector_t getKs3DRefp()
size_t getDestroyNum() const
virtual double getGamma(int i)
void resetQ(double q)
double massPerParticle_m
virtual void setSolver(FieldSolver *fs)
long long getGlobalTrackStep() const
std::unique_ptr< double[]> bingamma_m
holds the gamma of the bin
void setT(double t)
Vector_t getKs3DRefr()
size_t calcMoments()
size_t getGhostNum() const
void setTEmission(double t)
size_t getLoadBalance(int p) const
virtual void computeSelfFields_cycl(int bin)=0
std::pair< Vector_t, double > getLocalBoundingSphere()
virtual Vector_t get_hr() const
DistributionMoments momentsComputer_m
ParticleIndex_t & ID
Vector_t get_emit() const
double calculateAngle(double x, double y)
angle range [0~2PI) degree
virtual FieldLayout_t & getFieldLayout()=0
virtual VectorPair_t getEExtrema()=0
void calcDebyeLength()
Compute the (global) Debye length for the beam.
double get_sPos() const
void iterateEmittedBin(int binNumber)
bool singleInitNode() const
double getM() const
void setUpdateFlag(UpdateFlags_t f, bool val)
Vektor< int, 3 > nr_m
meshsize of cartesian mesh
void calcMomentsInitial()
UnitState_t stateOfLastBoundP_
virtual double getY(int i)
double getT() const
ParticleOrigin refPOrigin_m
double getE() const
void switchOffUnitlessPositions(bool use_dt_per_particle=false)
void setStepsPerTurn(int n)
IpplTimings::TimerRef selfFieldTimer_m
timer for selfField calculation
virtual double getZ(int i)
Vector_t get_rmean() const
bool operator!=(ConstIterator const &rhs) const
int operator-(const ConstIterator &other) const
OpalParticle operator*() const
bool operator==(ConstIterator const &rhs) const
ConstIterator(PartBunchBase const *bunch, unsigned int i)
PartBunchBase const * bunch_m
ConstIterator operator++(int)
Particle reference data.
Definition: PartData.h:35
An abstract sequence of beam line components.
Definition: Beamline.h:34
A templated representation for vectors.
Definition: FVector.h:38
ParticleLayout< T, Dim >::Position_t Position_t
Definition: Inform.h:42
Timing::TimerRef TimerRef
Definition: IpplTimings.h:176