OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
PartBinsCyc.cpp
Go to the documentation of this file.
1//
2// Class PartBinsCyc
3// Defines a structure to hold energy bins and their
4// associated data for multi-bunch tracking in cyclotrons
5//
6// Copyright (c) 2010, Jianjun Yang, Paul Scherrer Institut, Villigen PSI, Switzerland
7// Copyright (c) 2017-2019, Paul Scherrer Institut, Villigen PSI, Switzerland
8// All rights reserved
9//
10// Implemented as part of the PhD thesis
11// "Beam dynamics in high intensity cyclotrons including neighboring bunch effects"
12// and the paper
13// "Beam dynamics in high intensity cyclotrons including neighboring bunch effects:
14// Model, implementation, and application"
15// (https://journals.aps.org/prab/pdf/10.1103/PhysRevSTAB.13.064201)
16//
17// This file is part of OPAL.
18//
19// OPAL is free software: you can redistribute it and/or modify
20// it under the terms of the GNU General Public License as published by
21// the Free Software Foundation, either version 3 of the License, or
22// (at your option) any later version.
23//
24// You should have received a copy of the GNU General Public License
25// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
26//
28#include "Physics/Physics.h"
29#include "Utility/Inform.h"
30#include <cfloat>
31#include <vector>
32extern Inform *gmsg;
33
34// constructer function for cyclotron
35PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins, size_t partInBin[])
36 : PartBins(specifiedNumBins, 0) {
37
38 bins_m = specifiedNumBins; // max bin number
39 nemittedBins_m = bins; // the bin number with particles
40
41 for(int i = 0; i < nemittedBins_m; i++) {
42 nBin_m[i] = partInBin[i];
43
44 *gmsg << "Read in: Bin=" << i << " Particles Num=" << getTotalNumPerBin(i) << endl;
45 binsEmitted_m[i] = true;
46 }
47}
48
49// constructer function for cyclotron for restart run.
50PartBinsCyc::PartBinsCyc(int specifiedNumBins, int bins)
51 : PartBins(specifiedNumBins, 0) {
52
53 bins_m = specifiedNumBins; // max bin number
54 nemittedBins_m = bins; // the bin number with particles
55
56 for(int i = 0; i < nemittedBins_m; i++) {
57 binsEmitted_m[i] = true;
58 }
59}
Inform * gmsg
Definition: Main.cpp:61
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
size_t getTotalNumPerBin(int b)
How many particles are in the bin b.
Definition: PartBins.cpp:73
std::unique_ptr< bool[]> binsEmitted_m
Definition: PartBins.h:124
int nemittedBins_m
Definition: PartBins.h:157
int bins_m
Definition: PartBins.h:106
std::unique_ptr< size_t[]> nBin_m
Definition: PartBins.h:160
PartBinsCyc(int bunches, int bins, size_t partInBin[])
Definition: PartBinsCyc.cpp:35
Definition: Inform.h:42