OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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
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 }
248 return OpalParticle(bunch_m->ID[index_m],
249 bunch_m->R[index_m],
250 bunch_m->P[index_m],
251 bunch_m->getT(),
252 bunch_m->Q[index_m],
253 bunch_m->getM() * Units::eV2MeV);
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
450 double getMomentumTolerance() const;
451
458
459 void iterateEmittedBin(int binNumber);
460
461 void calcEMean();
462
463 Inform& print(Inform& os);
464
465 /*
466 * (Pure) virtual member functions
467 */
468
469 virtual void runTests();
470
471 virtual void do_binaryRepart();
472
473 virtual void resetInterpolationCache(bool clearCache = false);
474
475 //brief calculates back the max/min of the efield on the grid
477
478 virtual double getRho(int x, int y, int z) = 0;
479
480 virtual void computeSelfFields() = 0;
481
482 //brief used for self fields with binned distribution
483 virtual void computeSelfFields(int bin) = 0;
484
485 virtual void computeSelfFields_cycl(double gamma) = 0;
486 virtual void computeSelfFields_cycl(int bin) = 0;
487
488 virtual void swap(unsigned int i, unsigned int j);
489
490 /*
491 Mesh and Field Layout related functions
492 */
493
494 virtual void setBCAllPeriodic();
495 virtual void setBCAllOpen();
496
497 virtual void setBCForDCBeam();
498
499
500// virtual void setMesh(Mesh_t* mesh) = 0;
501// virtual Mesh_t &getMesh() = 0;
502
503// virtual void setFieldLayout(FieldLayout_t* fLayout) = 0;
505
506 virtual void resizeMesh() { };
507
508 /*
509 * Wrapped member functions of IpplParticleBase
510 */
511
512 size_t getTotalNum() const;
513 void setTotalNum(size_t n);
514 void setLocalNum(size_t n);
515 size_t getLocalNum() const;
516
517 size_t getDestroyNum() const;
518 size_t getGhostNum() const;
519
521 const ParticleLayout<T, Dim>& getLayout() const;
522
523 bool getUpdateFlag(UpdateFlags_t f) const;
524 void setUpdateFlag(UpdateFlags_t f, bool val);
525
526
528 return pbase_m->getBConds();
529 }
530
532 pbase_m->setBConds(bc);
533 }
534
535 bool singleInitNode() const;
536
537 void resetID();
538
539 void update();
540 void update(const ParticleAttrib<char>& canSwap);
541
542 void createWithID(unsigned id);
543 void create(size_t M);
544 void globalCreate(size_t np);
545
546 void destroy(size_t M, size_t I, bool doNow = false);
547 void performDestroy(bool updateLocalNum = false);
548 void ghostDestroy(size_t M, size_t I);
549
550protected:
551 size_t calcMoments(); // Calculates bunch moments using only emitted particles.
552
553 /* Calculates bunch moments by summing over bins
554 * (not accurate when any particles have been emitted).
555 */
558 double calculateAngle(double x, double y);
559
560
561private:
562 virtual void updateDomainLength(Vektor<int, 3>& grid) = 0;
563
564 virtual void updateFields(const Vector_t& hr, const Vector_t& origin);
565
567
568public:
569 /*
570 * Bunch attributes
571 */
574
575 // Particle container attributes
576 ParticleAttrib< Vector_t > P; // particle momentum // ParticleSpatialLayout<double, 3>::ParticlePos_t P;
577 ParticleAttrib< double > Q; // charge per simulation particle, unit: C.
578 ParticleAttrib< double > M; // mass per simulation particle, for multi-species particle tracking, unit:GeV/c^2.
579 ParticleAttrib< double > Phi; // the electric potential
581 ParticleAttrib< Vector_t > Eftmp; // e field vector for gun simulations
582
584 ParticleAttrib< int > Bin; // holds the bin in which the particle is in, if zero particle is marked for deletion
585 ParticleAttrib< double > dt; // holds the dt timestep for particle
587 ParticleAttrib< ParticleOrigin > POrigin; // we can distinguish dark current particles from primary particle
588 ParticleAttrib< int > TriID; // holds the ID of triangle that the particle hit. Only for BoundaryGeometry case.
589 ParticleAttrib< short > cavityGapCrossed; // particle just crossed cavity gap (for ParallelCyclotronTracker)
590 ParticleAttrib< short > bunchNum; // bunch number to which particle belongs (multi-bunch mode)
591
594
596
599
600 // The structure for particle binning
602
606
607 // For AMTS integrator in OPAL-T
609
610 // get 2nd order momentum matrix
612
613private:
614 // save particles in case of one core
615 std::unique_ptr<Inform> pmsg_m;
616 std::unique_ptr<std::ofstream> f_stream;
619
620protected:
625
629
631
632 /*
633 Member variables starts here
634 */
635
636 // unit state of PartBunch
639
641 double centroid_m[2 * Dim];
642
644 double dt_m;
646 double t_m;
648 double spos_m;
649
653 //Vector_t globalMeanR_m = Vector_t(0.0, 0.0, 0.0);
654 //Quaternion_t globalToLocalQuaternion_m = Quaternion_t(1.0, 0.0, 0.0, 0.0);
657
662
663 //RMS number density of particles from grid
665
670
673
675
676 double qi_m;
678
681
683 double dh_m;
684
687
689 std::unique_ptr<double[]> bingamma_m;
690
691 //FIXME: this should go into the Bin class!
692 // holds number of emitted particles of the bin
693 // jjyang: opal-cycl use *nBin_m of pbin_m
694 std::unique_ptr<size_t[]> binemitted_m;
695
698
701
704
707
709 std::vector<size_t> bunchTotalNum_m;
710 std::vector<size_t> bunchLocalNum_m;
711
716
717 /*
718 Data structure for particle load balance information
719 */
720
721 std::unique_ptr<size_t[]> globalPartPerNode_m;
722
725
726 // flag to tell if we are a DC-beam
729 std::shared_ptr<AbstractParticle<T, Dim> > pbase_m;
730};
731
732template<class T, unsigned Dim>
734 return bunch.begin();
735}
736
737template<class T, unsigned Dim>
739 return bunch.end();
740}
741
742#include "PartBunchBase.hpp"
743
744#endif
CenteredFieldLayout< 3, Mesh_t, Center_t > FieldLayout_t
Definition PBunchDefs.h:28
Quaternion Quaternion_t
Definition Quaternion.h:42
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
ParticleOrigin
DistributionType
const unsigned Dim
constexpr double c
The velocity of light in m/s.
Definition Physics.h:45
FieldSolverType
Definition FieldSolver.h:38
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
constexpr double eV2MeV
Definition Units.h:77
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
double periodLength_m
double getMassPerParticle() const
AbstractParticle< T, Dim >::ParticleIndex_t ParticleIndex_t
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)
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
double get_DDy() const
virtual void updateFields(const Vector_t &hr, const Vector_t &origin)
Vector_t get_95Percentile() const
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()
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 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
void setKs3DRefp(Vector_t p)
AbstractParticle< T, Dim >::Position_t Position_t
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
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
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
Vector_t get_normalizedEps_99_99Percentile() const
double getMomentumTolerance() 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)
Set reference data.
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)
An abstract sequence of beam line components.
Definition Beamline.h:34
A templated representation for matrices.
Definition FMatrix.h:39
A templated representation for vectors.
Definition FVector.h:38
ParticleLayout< T, Dim >::UpdateFlags UpdateFlags
ParticleAttrib< SingleParticlePos_t > ParticlePos_t
ParticleLayout< T, Dim >::Position_t Position_t
ParticleAttrib< Index_t > ParticleIndex_t
Timing::TimerRef TimerRef
Vektor< double, 3 > Vector_t