OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PartBinsCyc.cpp
Go to the documentation of this file.
2 #include "Physics/Physics.h"
3 #include <cfloat>
4 #include <vector>
5 extern Inform *gmsg;
6 
7 // constructer function for cyclotron
8 PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins, size_t partInBin[])
9  : PartBins(specifiedNumBins, 0) {
10 
11  bins_m = specifiedNumBins; // max bin number
12  nemittedBins_m = bins; // the bin number with particles
13 
14  for(int i = 0; i < nemittedBins_m; i++) {
15  nBin_m[i] = partInBin[i];
16 
17  *gmsg << "Read in: Bin=" << i << " Particles Num=" << getTotalNumPerBin(i) << endl;
18  binsEmitted_m[i] = true;
19  }
20 }
21 
22 // constructer function for cyclotron for restart run.
23 PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins)
24  : PartBins(specifiedNumBins, 0) {
25 
26  bins_m = specifiedNumBins; // max bin number
27  nemittedBins_m = bins; // the bin number with particles
28 
29  for(int i = 0; i < nemittedBins_m; i++) {
30  binsEmitted_m[i] = true;
31  }
32 }
std::unique_ptr< bool[]> binsEmitted_m
Definition: PartBins.h:163
Inform * gmsg
Definition: Main.cpp:21
int nemittedBins_m
Definition: PartBins.h:251
std::unique_ptr< size_t[]> nBin_m
Definition: PartBins.h:257
size_t getTotalNumPerBin(int b)
How many particles are in the bin b.
Definition: PartBins.cpp:53
int bins_m
Definition: PartBins.h:144
PartBinsCyc(int bunches, int bins, size_t partInBin[])
Definition: PartBinsCyc.cpp:8
Definition: Inform.h:41
Defines a structure to hold energy bins and their associated data for multi-bunch tracking in cyclotr...
Inform & endl(Inform &inf)
Definition: Inform.cpp:42