OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PartBunchBase.h
Go to the documentation of this file.
1 #ifndef PART_BUNCH_BASE_H
2 #define PART_BUNCH_BASE_H
3 
4 #include "Ippl.h"
5 #include "Particle/AbstractParticle.h" //TODO should be in Ippl.h
9 #include "FixedAlgebra/FMatrix.h"
10 #include "FixedAlgebra/FVector.h"
11 #include "Algorithms/PartBins.h"
12 #include "Algorithms/PartBinsCyc.h"
13 #include "Algorithms/PartData.h"
14 #include "Algorithms/Quaternion.h"
15 
16 #include <iosfwd>
17 #include <vector>
18 
19 #include "Structure/LossDataSink.h"
20 #include "Structure/FieldSolver.h"
21 #include "Algorithms/ListElem.h"
22 
23 class Distribution;
24 
25 template <class T, int, int> class FMatrix;
26 template <class T, int> class FVector;
27 
28 template <class T, unsigned Dim>
29 class PartBunchBase
30 {
31 public:
36 
37  typedef std::pair<Vector_t, Vector_t> VectorPair_t;
38 
39  static const unsigned Dimension = Dim;
40 
41  enum UnitState_t { units = 0, unitless = 1 };
42 
43 public:
44 
46 
47  virtual ~PartBunchBase() { }
48 
50 
51  PartBunchBase(const PartBunchBase &rhs) = delete; // implement if needed
52 
53  /*
54  * Bunch common member functions
55  */
56 
57  // This is required since we initialize the Layout and the RegionLayout with default constructor
58  virtual void initialize(FieldLayout_t *fLayout) = 0;
59 
60  bool getIfBeamEmitting();
61 
63 
64  size_t getNumberOfEmissionSteps();
65 
67 
68  void Rebin();
69 
70  void setEnergyBins(int numberOfEnergyBins);
71 
72  bool weHaveEnergyBins();
73 
74  //FIXME: unify methods, use convention that all particles have own dt
75  void switchToUnitlessPositions(bool use_dt_per_particle = false);
76 
77  //FIXME: unify methods, use convention that all particles have own dt
78  void switchOffUnitlessPositions(bool use_dt_per_particle = false);
79 
81  std::vector<Distribution *> addedDistributions,
82  size_t &np);
83 
84  bool isGridFixed();
85 
86  bool hasBinning();
87 
88 
89  /*
90  Energy bins related functions
91  */
92 
93  void setTEmission(double t);
94 
95  double getTEmission();
96 
97  bool doEmission();
98 
99  bool weHaveBins() const;
100 
101  void setPBins(PartBins *pbin);
102 
103  void setPBins(PartBinsCyc *pbin);
104 
109  size_t emitParticles(double eZ);
110 
111  void updateNumTotal();
112 
113  void rebin();
114 
115  int getNumBins();
116 
117  int getLastemittedBin();
118 
119  void setLocalBinCount(size_t num, int bin);
120 
122  void calcGammas();
123 
124  void calcGammas_cycl();
125 
127  double getBinGamma(int bin);
128 
130  virtual void setBinCharge(int bin, double q);
131 
133  virtual void setBinCharge(int bin);
134 
136  size_t calcNumPartsOutside(Vector_t x);
137 
138  void calcLineDensity(unsigned int nBins, std::vector<double> &lineDensity,
139  std::pair<double, double> &meshInfo);
140 
141  void setBeamFrequency(double v);
142 
143  /*
144  Mesh and Field Layout related functions
145  */
146 
147  virtual void boundp();
148 
150  void boundp_destroy();
151 
153  size_t boundp_destroyT();
154 
155  size_t destroyT();
156 
157  /*
158  Read out coordinates
159  */
160 
161  virtual double getPx(int i);
162  virtual double getPy(int i);
163  virtual double getPz(int i);
164 
165  virtual double getPx0(int i);
166  virtual double getPy0(int i);
167 
168  virtual double getX(int i);
169  virtual double getY(int i);
170  virtual double getZ(int i);
171 
172  virtual double getX0(int i);
173  virtual double getY0(int i);
174 
175  virtual void setZ(int i, double zcoo);
176 
177  void get_bounds(Vector_t &rmin, Vector_t &rmax);
178 
179  void getLocalBounds(Vector_t &rmin, Vector_t &rmax);
180 
181  std::pair<Vector_t, double> getBoundingSphere();
182 
183  std::pair<Vector_t, double> getLocalBoundingSphere();
184 
185 
186  /*
187  Compatibility function push_back
188  */
189 
190  void push_back(OpalParticle p);
191 
192  void set_part(FVector<double, 6> z, int ii);
193 
194  void set_part(OpalParticle p, int ii);
195 
196  OpalParticle get_part(int ii);
197 
199  // The matrix [b]D[/b] is used to normalise the first two modes.
200  // The maximum normalised amplitudes for these modes are stored
201  // in [b]axmax[/b] and [b]aymax[/b].
203  double &axmax, double &aymax);
204 
205  void setdT(double dt);
206  double getdT() const;
207 
208  void setT(double t);
209  void incrementT();
210  double getT() const;
211 
218  double get_sPos();
219 
220  void set_sPos(double s);
221 
222  double get_gamma() const;
223 
224  double get_meanKineticEnergy() const;
225  Vector_t get_origin() const;
226  Vector_t get_maxExtent() const;
227  Vector_t get_centroid() const;
228  Vector_t get_rrms() const;
229  Vector_t get_rprms() const;
230  Vector_t get_rmean() const;
231  Vector_t get_prms() const;
232  Vector_t get_pmean() const;
234  Vector_t get_emit() const;
235  Vector_t get_norm_emit() const;
236  Vector_t get_halo() const;
237  virtual Vector_t get_hr() const;
238 
239  double get_Dx() const;
240  double get_Dy() const;
241 
242  double get_DDx() const;
243  double get_DDy() const;
244 
245  virtual void set_meshEnlargement(double dh);
246 
248  size_t getLoadBalance(int p) const;
249 
250  void get_PBounds(Vector_t &min, Vector_t &max) const;
251 
252  void calcBeamParameters();
253 
254  void calcBeamParametersInitial(); // Calculate initial beam parameters before emission.
255 
256  double getCouplingConstant() const;
257  void setCouplingConstant(double c);
258 
259  // set the charge per simulation particle
260  void setCharge(double q);
261  // set the charge per simulation particle when total particle number equals 0
262  void setChargeZeroPart(double q);
263 
264  // set the mass per simulation particle
265  void setMass(double mass);
266 
268  double getEkin() const;
269 
271  double getWorkFunctionRf() const;
272 
274  double getLaserEnergy() const;
275 
277  double getCharge() const;
278 
280  double getChargePerParticle() const;
281 
282  virtual void setSolver(FieldSolver *fs);
283 
284  bool hasFieldSolver();
285 
286  std::string getFieldSolverType() const;
287 
288  void setStepsPerTurn(int n);
289  int getStepsPerTurn() const;
290 
292  void setGlobalTrackStep(long long n);
293  long long getGlobalTrackStep() const;
294 
296  void setLocalTrackStep(long long n);
297  void incTrackSteps();
298  long long getLocalTrackStep() const;
299 
300  void setNumBunch(short n);
301  short getNumBunch() const;
302 
303  // used in ParallelCyclotronTracker for multi-bunch mode
304  void setTotalNumPerBunch(size_t numpart, short n);
305  size_t getTotalNumPerBunch(short n) const;
306 
307  void setLocalNumPerBunch(size_t numpart, short n);
308  size_t getLocalNumPerBunch(short n) const;
309 
310  /* used in initializeTracking_m of ParallelCyclotronTracker
311  * for multi-bunch mode
312  */
313  void countTotalNumPerBunch();
314 
315  void setGlobalMeanR(Vector_t globalMeanR);
317  void setGlobalToLocalQuaternion(Quaternion_t globalToLocalQuaternion);
319 
320  void setSteptoLastInj(int n);
321  int getSteptoLastInj();
322 
324  double calcMeanPhi();
325 
327  bool resetPartBinID2(const double eta);
328 
329  bool resetPartBinBunch();
330 
332  double getQ() const;
333  double getM() const;
334  double getP() const;
335  double getE() const;
337  double getInitialBeta() const;
338  double getInitialGamma() const;
341  void resetQ(double q);
342  void resetM(double m);
345  double getdE();
346  virtual double getGamma(int i);
347  virtual double getBeta(int i);
348  virtual void actT();
349 
350  const PartData *getReference() const;
351 
352  double getEmissionDeltaT();
353 
355  void setQKs3D(Quaternion_t q);
357  void setKs3DRefr(Vector_t r);
359  void setKs3DRefp(Vector_t p);
360 
361  void iterateEmittedBin(int binNumber);
362 
363  void calcEMean();
364 
365  void correctEnergy(double avrgp);
366 
367  Inform &print(Inform &os);
368 
369  /*
370  * (Pure) virtual member functions
371  */
372 
373  virtual void runTests();
374 
375  virtual void do_binaryRepart();
376 
377  virtual void resetInterpolationCache(bool clearCache = false);
378 
380  virtual VectorPair_t getEExtrema() = 0;
381 
382  virtual double getRho(int x, int y, int z) = 0;
383 
384  virtual void computeSelfFields() = 0;
385 
387  virtual void computeSelfFields(int bin) = 0;
388 
389  virtual void computeSelfFields_cycl(double gamma) = 0;
390  virtual void computeSelfFields_cycl(int bin) = 0;
391 
392  virtual void swap(unsigned int i, unsigned int j);
393 
394  /*
395  Mesh and Field Layout related functions
396  */
397 
398  virtual void setBCAllPeriodic();
399  virtual void setBCAllOpen();
400 
401  virtual void setBCForDCBeam();
402 
403 
404 // virtual void setMesh(Mesh_t* mesh) = 0;
405 // virtual Mesh_t &getMesh() = 0;
406 
407 // virtual void setFieldLayout(FieldLayout_t* fLayout) = 0;
408  virtual FieldLayout_t &getFieldLayout() = 0;
409 
410  /*
411  * Wrapped member functions of IpplParticleBase
412  */
413 
414  size_t getTotalNum() const;
415  void setTotalNum(size_t n);
416  void setLocalNum(size_t n);
417  size_t getLocalNum() const;
418 
419  size_t getDestroyNum() const;
420  size_t getGhostNum() const;
421 
422  unsigned int getMinimumNumberOfParticlesPerCore() const;
423  void setMinimumNumberOfParticlesPerCore(unsigned int n);
424 
426  const ParticleLayout<T, Dim>& getLayout() const;
427 
428  bool getUpdateFlag(UpdateFlags_t f) const;
429  void setUpdateFlag(UpdateFlags_t f, bool val);
430 
431 
433  return pbase->getBConds();
434  }
435 
437  pbase->setBConds(bc);
438  }
439 
440  bool singleInitNode() const;
441 
442  void resetID();
443 
444  void update();
445  void update(const ParticleAttrib<char>& canSwap);
446 
447  void createWithID(unsigned id);
448  void create(size_t M);
449  void globalCreate(size_t np);
450 
451  void destroy(size_t M, size_t I, bool doNow = false);
452  void performDestroy(bool updateLocalNum = false);
453  void ghostDestroy(size_t M, size_t I);
454 
455 protected:
456  size_t calcMoments(); // Calculates bunch moments using only emitted particles.
457 
458  /* Calculates bunch moments by summing over bins
459  * (not accurate when any particles have been emitted).
460  */
461  void calcMomentsInitial();
463  double calculateAngle(double x, double y);
464 
465 
466 private:
467  virtual void updateDomainLength(Vektor<int, 3>& grid) = 0;
468 
469  virtual void updateFields(const Vector_t& hr, const Vector_t& origin);
470 
472 
473 public:
474  /*
475  * Bunch attributes
476  */
477 
478 
481 
482 
483  // Particle container attributes
484  ParticleAttrib< Vector_t > P; // particle momentum // ParticleSpatialLayout<double, 3>::ParticlePos_t P;
485  ParticleAttrib< double > Q; // charge per simulation particle, unit: C.
486  ParticleAttrib< double > M; // mass per simulation particle, for multi-species particle tracking, unit:GeV/c^2.
487  ParticleAttrib< double > Phi; // the electric potential
488  ParticleAttrib< Vector_t > Ef; // e field vector
489  ParticleAttrib< Vector_t > Eftmp; // e field vector for gun simulations
490 
491  ParticleAttrib< Vector_t > Bf; // b field vector
492  ParticleAttrib< int > Bin; // holds the bin in which the particle is in, if zero particle is marked for deletion
493  ParticleAttrib< double > dt; // holds the dt timestep for particle
494 
495  ParticleAttrib< short > PType; // we can distinguish dark current particles from primary particle
496  ParticleAttrib< int > TriID; // holds the ID of triangle that the particle hit. Only for BoundaryGeometry case.
498 
499  ParticleAttrib< short > bunchNum; // bunch number to which particle belongs (multi-bunch mode)
500 
501 
506 
507 
509  int myNode_m;
510 
512  int nodes_m;
513 
516 
517  // The structure for particle binning
519 
520  std::unique_ptr<LossDataSink> lossDs_m;
521 
522  // save particles in case of one core
523  std::unique_ptr<Inform> pmsg_m;
524  std::unique_ptr<std::ofstream> f_stream;
525 
529 
530  // For AMTS integrator in OPAL-T
532 
535 
538 
539  // get 2nd order momentum matrix
541 
542 protected:
547 
549 
550 
552 
553 
554 // /*
555 // Member variables starts here
556 // */
557 
558  // unit state of PartBunch
561 
563  double centroid_m[2 * Dim];
564 
567 
569  double dt_m;
571  double t_m;
573  double eKin_m;
575  double dE_m;
577  double spos_m;
578 
582  //Vector_t globalMeanR_m = Vector_t(0.0, 0.0, 0.0);
583  //Quaternion_t globalToLocalQuaternion_m = Quaternion_t(1.0, 0.0, 0.0, 0.0);
586 
591 
600 
603 
606 
608 
611 
613  double Dx_m;
614  double Dy_m;
615 
617  double DDx_m;
618  double DDy_m;
619 
624 
627 
629 
630  double qi_m;
631 
634 
637 
639  double dh_m;
640 
642  double tEmission_m;
643 
645  std::unique_ptr<double[]> bingamma_m;
646 
647  //FIXME: this should go into the Bin class!
648  // holds number of emitted particles of the bin
649  // jjyang: opal-cycl use *nBin_m of pbin_m
650  std::unique_ptr<size_t[]> binemitted_m;
651 
654 
656  long long localTrackStep_m;
657 
659  long long globalTrackStep_m;
660 
662  short numBunch_m;
663 
665  std::vector<size_t> bunchTotalNum_m;
666  std::vector<size_t> bunchLocalNum_m;
667 
672 
673  /*
674  Data structure for particle load balance information
675  */
676 
677  std::unique_ptr<size_t[]> globalPartPerNode_m;
678 
679 
681 
682  // flag to tell if we are a DC-beam
683  bool dcBeam_m;
685  std::shared_ptr<AbstractParticle<T, Dim> > pbase;
686 };
687 
688 #include "PartBunchBase.hpp"
689 
690 #endif
virtual void swap(unsigned int i, unsigned int j)
bool weHaveBins() const
double getWorkFunctionRf() const
Need the work function for the Schottky effect calculation (eV)
double dt_m
holds the timestep in seconds
Vector_t get_rprms() const
Vector_t rmin_m
minimal extend of particles
double tEmission_m
in % how much the mesh is enlarged
virtual double getPy0(int i)
double get_Dx() const
ParticleAttrib< Vector_t > P
IpplTimings::TimerRef selfFieldTimer_m
timer for selfField calculation
void switchOffUnitlessPositions(bool use_dt_per_particle=false)
std::vector< size_t > bunchLocalNum_m
double getT() const
std::vector< size_t > bunchTotalNum_m
number of particles per bunch
void setQKs3D(Quaternion_t q)
double spos_m
the position along design trajectory
void getLocalBounds(Vector_t &rmin, Vector_t &rmax)
void setKs3DRefp(Vector_t p)
IpplTimings::TimerRef distrCreate_m
double get_DDy() const
int getLastEmittedEnergyBin()
void destroy(size_t M, size_t I, bool doNow=false)
ParticleAttrib< Vector_t > Ef
ParticleAttrib< Vector_t > Eftmp
Vector_t RefPartR_m
void setMinimumNumberOfParticlesPerCore(unsigned int n)
double calcMeanPhi()
calculate average angle of longitudinal direction of bins
Definition: TSVMeta.h:24
std::string getFieldSolverType() const
Return the fieldsolver type if we have a fieldsolver.
void setPType(ParticleType::type)
A templated representation for matrices.
Definition: IdealMapper.h:26
Quaternion_t getQKs3D()
void create(size_t M)
long long getLocalTrackStep() const
ParticleType::type getPType() const
bool resetPartBinBunch()
void gatherLoadBalanceStatistics()
The FieldSolver definition.
Definition: FieldSolver.h:43
long long globalTrackStep_m
if multiple TRACK commands
unsigned int getMinimumNumberOfParticlesPerCore() const
void setLocalNum(size_t n)
virtual void set_meshEnlargement(double dh)
void setLocalNumPerBunch(size_t numpart, short n)
A templated representation for vectors.
Definition: PartBunchBase.h:26
void setGlobalMeanR(Vector_t globalMeanR)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:123
virtual void actT()
void setDistribution(Distribution *d, std::vector< Distribution * > addedDistributions, size_t &np)
virtual void computeSelfFields_cycl(double gamma)=0
std::unique_ptr< double[]> bingamma_m
holds the gamma of the bin
void setGlobalToLocalQuaternion(Quaternion_t globalToLocalQuaternion)
ParticleAttrib< double > Q
Vector_t get_rrms() const
virtual void updateFields(const Vector_t &hr, const Vector_t &origin)
virtual ~PartBunchBase()
Definition: PartBunchBase.h:47
Distribution * dist_m
Vektor< int, 3 > nr_m
meshsize of cartesian mesh
Vector_t eps_norm_m
rms normalized emittance
double t_m
holds the actual time of the integration
int getNumberOfEnergyBins()
Particle reference data.
Definition: PartData.h:38
double getCouplingConstant() const
double getdT() const
virtual void do_binaryRepart()
double getM() const
double couplingConstant_m
FMatrix< double, 2 *Dim, 2 *Dim > moments_m
6x6 matrix of the moments of the beam
const PartData * getReference() const
Vector_t globalMeanR_m
double get_meanKineticEnergy() const
virtual void setBCForDCBeam()
void setLocalTrackStep(long long n)
step in a TRACK command
ParticleAttrib< short > bunchNum
void calcMomentsInitial()
Vector_t getKs3DRefp()
void setKs3DRefr(Vector_t r)
FRONT * fs
Definition: hypervolume.cpp:59
double centroid_m[2 *Dim]
holds the centroid of the beam
void push_back(OpalParticle p)
Vector_t get_pmean_Distribution() const
double dE_m
energy spread of the beam in MeV
void setdT(double dt)
virtual double getY(int i)
Vector_t get_emit() const
Vector_t prms_m
rms momenta
void resetQ(double q)
void resetM(double m)
virtual VectorPair_t getEExtrema()=0
calculates back the max/min of the efield on the grid
void setTotalNumPerBunch(size_t numpart, short n)
double dh_m
Mesh enlargement.
double getE() const
int nodes_m
avoid calls to Ippl::getNodes()
size_t getGhostNum() const
FMatrix< double, 2 *Dim, 2 *Dim > getSigmaMatrix()
size_t getTotalNum() const
Vector_t halo_m
virtual void resetInterpolationCache(bool clearCache=false)
Vector_t get_prms() const
std::unique_ptr< std::ofstream > f_stream
Vector_t pmean_m
mean momenta
Vector_t getKs3DRefr()
AbstractParticle< T, Dim >::UpdateFlags UpdateFlags_t
Definition: PartBunchBase.h:34
virtual void setBCAllOpen()
double getP() const
void calcGammas_cycl()
double getInitialBeta() const
double eKin_m
mean energy of the bunch (MeV)
void setBConds(const ParticleBConds< Position_t, Dimension > &bc)
void ghostDestroy(size_t M, size_t I)
std::unique_ptr< size_t[]> globalPartPerNode_m
void set_sPos(double s)
IpplTimings::TimerRef distrReload_m
timer for IC, can not be in Distribution.h
Vector_t get_rmean() const
std::shared_ptr< AbstractParticle< T, Dim > > pbase
std::pair< Vector_t, Vector_t > VectorPair_t
Definition: PartBunchBase.h:37
void setCouplingConstant(double c)
void calcBeamParameters()
virtual double getPy(int i)
virtual double getGamma(int i)
UnitState_t stateOfLastBoundP_
Vector_t get_pmean() const
Vector_t get_maxExtent() const
Class: DataSink.
Definition: OpalData.h:29
ParticleAttrib< short > PType
ParticleIndex_t & ID
Vector_t get_halo() const
ParticleLayout< T, Dim > & getLayout()
PartBunchBase(AbstractParticle< T, Dim > *pb)
IpplTimings::TimerRef boundpTimer_m
int stepsPerTurn_m
steps per turn for OPAL-cycl
bool singleInitNode() const
void setUpdateFlag(UpdateFlags_t f, bool val)
void countTotalNumPerBunch()
PartBins * pbin_m
IpplTimings::TimerRef boundpBoundsTimer_m
OpalParticle get_part(int ii)
virtual double getBeta(int i)
bool getIfBeamEmitting()
short numBunch_m
current bunch number
Quaternion_t getGlobalToLocalQuaternion()
ParticleAttrib< int > TriID
Defines a structure to hold energy bins and their associated data.
constexpr double c
The velocity of light in m/s.
Definition: Physics.h:52
void setEnergyBins(int numberOfEnergyBins)
size_t getTotalNumPerBunch(short n) const
Vector_t rmean_m
mean position (m)
void setStepsPerTurn(int n)
void get_PBounds(Vector_t &min, Vector_t &max) const
double getChargePerParticle() const
get the macro particle charge
CoordinateSystemTrafo toLabTrafo_m
double get_Dy() const
void setTEmission(double t)
virtual double getY0(int i)
Vector_t rrms_m
rms beam size (m)
std::unique_ptr< Inform > pmsg_m
double getTEmission()
size_t calcNumPartsOutside(Vector_t x)
returns the number of particles outside of a box defined by x
Vector_t RefPartP_m
Vector_t rmax_m
maximal extend of particles
bool lowParticleCount_m
if a local node has less than 2 particles lowParticleCount_m == true
virtual void initialize(FieldLayout_t *fLayout)=0
AbstractParticle< T, Dim >::ParticlePos_t ParticlePos_t
Definition: PartBunchBase.h:32
Vector_t get_norm_emit() const
void switchToUnitlessPositions(bool use_dt_per_particle=false)
int myNode_m
avoid calls to Ippl::myNode()
double getInitialGamma() const
virtual void computeSelfFields()=0
void setMass(double mass)
double DDx_m
derivative of the dispersion
double Dx_m
dispersion x &amp; y
Vector_t rprms_m
rms correlation
void setTotalNum(size_t n)
Vector_t get_origin() const
double get_DDx() const
virtual FieldLayout_t & getFieldLayout()=0
FieldSolver * fs_m
stores the used field solver
void maximumAmplitudes(const FMatrix< double, 6, 6 > &D, double &axmax, double &aymax)
Return maximum amplitudes.
size_t getLocalNum() const
Vector_t get_centroid() const
void set_part(FVector< double, 6 > z, int ii)
virtual double getPx0(int i)
size_t getLocalNumPerBunch(short n) const
Inform & print(Inform &os)
IpplTimings::TimerRef histoTimer_m
ParticleAttrib< double > dt
double getCharge() const
get the total charge per simulation particle
bool fixed_grid
if the grid does not have to adapt
void setLocalBinCount(size_t num, int bin)
size_t boundp_destroyT()
short getNumBunch() const
void performDestroy(bool updateLocalNum=false)
IpplTimings::TimerRef boundpUpdateTimer_m
ParticleAttrib< double > Phi
bool resetPartBinID2(const double eta)
reset Bin[] for each particle according to the method given in paper PAST-AB(064402) by G...
std::pair< Vector_t, double > getLocalBoundingSphere()
ParticleAttrib< short > cavityGapCrossed
particle just crossed cavity gap (for ParallelCyclotronTracker)
int distDump_m
counter to store the distribution dump
virtual double getPz(int i)
double get_gamma() const
void createWithID(unsigned id)
void setCharge(double q)
void globalCreate(size_t np)
virtual double getX0(int i)
Vector_t hr_m
meshspacing of cartesian mesh
AbstractParticle< T, Dim >::ParticleIndex_t ParticleIndex_t
Definition: PartBunchBase.h:33
virtual Vector_t get_hr() const
bool weHaveEnergyBins()
static const unsigned Dimension
Definition: PartBunchBase.h:39
void setNumBunch(short n)
double getBinGamma(int bin)
Get gamma of one bin.
Quaternion_t globalToLocalQuaternion_m
AbstractParticle< T, Dim >::Position_t Position_t
Definition: PartBunchBase.h:35
void setT(double t)
double getQ() const
Access to reference data.
size_t getLoadBalance(int p) const
size_t getDestroyNum() const
size_t getNumberOfEmissionSteps()
std::unique_ptr< size_t[]> binemitted_m
size_t calcMoments()
std::unique_ptr< LossDataSink > lossDs_m
virtual void setBCAllPeriodic()
ParticleAttrib< int > Bin
virtual void boundp()
void calcGammas()
Compute the gammas of all bins.
virtual void setBinCharge(int bin, double q)
Set the charge of one bin to the value of q and all other to zero.
ParticleType::type refPType_m
virtual double getZ(int i)
ParticleAttrib< Vector_t > Bf
std::pair< Vector_t, double > getBoundingSphere()
ParticleAttrib< double > M
virtual void setSolver(FieldSolver *fs)
long long localTrackStep_m
step in a TRACK command
ParticlePos_t & R
virtual double getRho(int x, int y, int z)=0
void iterateEmittedBin(int binNumber)
const PartData * reference
void setBeamFrequency(double v)
const unsigned Dim
Timing::TimerRef TimerRef
Definition: IpplTimings.h:176
double getEmissionDeltaT()
IpplTimings::TimerRef statParamTimer_m
double periodLength_m
double getLaserEnergy() const
Need the laser energy for the Schottky effect calculation (eV)
void get_bounds(Vector_t &rmin, Vector_t &rmax)
virtual void setZ(int i, double zcoo)
Vector_t eps_m
rms emittance (not normalized)
ParticleBConds< Position_t, Dimension > & getBConds()
virtual double getX(int i)
virtual double getPx(int i)
int getStepsPerTurn() const
void calcBeamParametersInitial()
Definition: Inform.h:41
OpalParticle position.
Definition: OpalParticle.h:38
UnitState_t unit_state_
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:95
bool getUpdateFlag(UpdateFlags_t f) const
Defines a structure to hold energy bins and their associated data for multi-bunch tracking in cyclotr...
virtual void runTests()
void setChargeZeroPart(double q)
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 getEkin() const
Need Ek for the Schottky effect calculation (eV)
void setPBins(PartBins *pbin)
void setup(AbstractParticle< T, Dim > *pb)
Vector_t getGlobalMeanR()
ParticleLayout< T, Dim >::Position_t Position_t
void setGlobalTrackStep(long long n)
step in multiple TRACK commands
double calculateAngle(double x, double y)
angle range [0~2PI) degree
void setSteptoLastInj(int n)
virtual void updateDomainLength(Vektor< int, 3 > &grid)=0
size_t emitParticles(double eZ)
Emit particles in the given bin i.e. copy the particles from the bin structure into the particle cont...
long long getGlobalTrackStep() const
void correctEnergy(double avrgp)