OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Classic
Algorithms
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
//
27
#include "
Algorithms/PartBinsCyc.h
"
28
#include "
Physics/Physics.h
"
29
#include "
Utility/Inform.h
"
30
#include <cfloat>
31
#include <vector>
32
extern
Inform
*
gmsg
;
33
34
// constructer function for cyclotron
35
PartBinsCyc::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.
50
PartBinsCyc::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
}
PartBins
Definition:
PartBins.h:30
PartBins::getTotalNumPerBin
size_t getTotalNumPerBin(int b)
How many particles are in the bin b.
Definition:
PartBins.cpp:73
PartBinsCyc.h
Physics.h
endl
Inform & endl(Inform &inf)
Definition:
Inform.cpp:42
Inform
Definition:
Inform.h:42
PartBins::nemittedBins_m
int nemittedBins_m
Definition:
PartBins.h:157
Inform.h
PartBins::nBin_m
std::unique_ptr< size_t[]> nBin_m
Definition:
PartBins.h:160
PartBinsCyc::PartBinsCyc
PartBinsCyc(int bunches, int bins, size_t partInBin[])
Definition:
PartBinsCyc.cpp:35
PartBins::binsEmitted_m
std::unique_ptr< bool[]> binsEmitted_m
Definition:
PartBins.h:124
PartBins::bins_m
int bins_m
Definition:
PartBins.h:106
gmsg
Inform * gmsg
Definition:
Main.cpp:70
Generated on Tue Jul 2 2024 15:05:19 for OPAL (Object Oriented Parallel Accelerator Library) by
1.8.5