Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
cortes_c
src
Commits
3e4a948f
Commit
3e4a948f
authored
Apr 16, 2012
by
kraus
Browse files
Merge branch 'develop' into svn: improve compile time by removing inline dependencies
- use forward declaration where possible - remove unused includes
parent
f318d68c
Changes
63
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
117 additions
and
101 deletions
+117
-101
classic/5.0/src/AbsBeamline/Collimator.cpp
classic/5.0/src/AbsBeamline/Collimator.cpp
+15
-15
classic/5.0/src/AbsBeamline/Collimator.h
classic/5.0/src/AbsBeamline/Collimator.h
+3
-1
classic/5.0/src/AbsBeamline/Component.h
classic/5.0/src/AbsBeamline/Component.h
+7
-2
classic/5.0/src/AbsBeamline/Cyclotron.cpp
classic/5.0/src/AbsBeamline/Cyclotron.cpp
+8
-7
classic/5.0/src/AbsBeamline/CyclotronValley.cpp
classic/5.0/src/AbsBeamline/CyclotronValley.cpp
+8
-8
classic/5.0/src/AbsBeamline/ElementBase.cpp
classic/5.0/src/AbsBeamline/ElementBase.cpp
+6
-6
classic/5.0/src/AbsBeamline/Monitor.cpp
classic/5.0/src/AbsBeamline/Monitor.cpp
+1
-0
classic/5.0/src/AbsBeamline/Monitor.h
classic/5.0/src/AbsBeamline/Monitor.h
+3
-0
classic/5.0/src/AbsBeamline/Multipole.cpp
classic/5.0/src/AbsBeamline/Multipole.cpp
+1
-0
classic/5.0/src/AbsBeamline/Multipole.h
classic/5.0/src/AbsBeamline/Multipole.h
+1
-0
classic/5.0/src/AbsBeamline/ParallelPlate.cpp
classic/5.0/src/AbsBeamline/ParallelPlate.cpp
+11
-10
classic/5.0/src/AbsBeamline/ParallelPlate.h
classic/5.0/src/AbsBeamline/ParallelPlate.h
+6
-5
classic/5.0/src/AbsBeamline/Probe.cpp
classic/5.0/src/AbsBeamline/Probe.cpp
+16
-15
classic/5.0/src/AbsBeamline/Probe.h
classic/5.0/src/AbsBeamline/Probe.h
+3
-1
classic/5.0/src/AbsBeamline/RFCavity.cpp
classic/5.0/src/AbsBeamline/RFCavity.cpp
+1
-1
classic/5.0/src/AbsBeamline/Septum.cpp
classic/5.0/src/AbsBeamline/Septum.cpp
+2
-1
classic/5.0/src/AbsBeamline/Solenoid.cpp
classic/5.0/src/AbsBeamline/Solenoid.cpp
+1
-0
classic/5.0/src/AbsBeamline/Solenoid.h
classic/5.0/src/AbsBeamline/Solenoid.h
+1
-0
classic/5.0/src/AbsBeamline/Stripper.cpp
classic/5.0/src/AbsBeamline/Stripper.cpp
+16
-17
classic/5.0/src/AbsBeamline/Stripper.h
classic/5.0/src/AbsBeamline/Stripper.h
+7
-12
No files found.
classic/5.0/src/AbsBeamline/Collimator.cpp
View file @
3e4a948f
...
...
@@ -20,9 +20,9 @@
#include "Physics/Physics.h"
#include "AbsBeamline/Collimator.h"
#include "Algorithms/PartBunch.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Fields/Fieldmap.hh"
#include "AbstractObjects/OpalData.h"
#include "Structure/LossDataSink.h"
#include <memory>
...
...
@@ -238,7 +238,7 @@ bool Collimator::apply(const Vector_t &R, const Vector_t ¢roid, const double
// rectangle collimators in cyclotron cyclindral coordiantes
// without surfacephysics, the particle hitting collimator is deleted directly
// without surfacephysics, the particle hitting collimator is deleted directly
bool
Collimator
::
checkCollimator
(
PartBunch
&
bunch
,
const
int
turnnumber
,
const
double
t
,
const
double
tstep
)
{
bool
flagNeedUpdate
=
false
;
...
...
@@ -249,20 +249,20 @@ bool Collimator::checkCollimator(PartBunch &bunch, const int turnnumber, const d
if
(
r1
>
rs_m
-
50.0
&&
r1
<
re_m
+
50.0
){
size_t
tempnum
=
bunch
.
getLocalNum
();
int
pflag
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
tempnum
;
++
i
)
{
if
(
bunch
.
PType
[
i
]
==
0
)
{
pflag
=
checkPoint
(
bunch
.
R
[
i
](
0
),
bunch
.
R
[
i
](
1
));
if
(
pflag
!=
0
)
{
lossDs_m
->
addParticle
(
bunch
.
R
[
i
],
bunch
.
P
[
i
],
bunch
.
ID
[
i
]);
bunch
.
Bin
[
i
]
=
-
1
;
flagNeedUpdate
=
true
;
flagNeedUpdate
=
true
;
}
}
}
}
reduce
(
&
flagNeedUpdate
,
&
flagNeedUpdate
+
1
,
&
flagNeedUpdate
,
OpBitwiseOrAssign
());
if
(
flagNeedUpdate
)
lossDs_m
->
save
(
getName
());
if
(
flagNeedUpdate
)
lossDs_m
->
save
(
getName
());
return
flagNeedUpdate
;
}
...
...
@@ -414,7 +414,7 @@ void Collimator::goOffline() {
rc
=
H5PartSetNumParticles
(
H5file_m
,
PosX_m
.
size
());
if
(
rc
!=
H5_SUCCESS
)
ERRORMSG
(
"H5 rc= "
<<
rc
<<
" in "
<<
__FILE__
<<
" @ line "
<<
__LINE__
<<
endl
);
std
::
unique_ptr
<
char
[]
>
varray
(
new
char
[
PosX_m
.
size
()
*
sizeof
(
double
)]);
double
*
fvalues
=
reinterpret_cast
<
double
*>
(
varray
.
get
());
h5_int64_t
*
ids
=
reinterpret_cast
<
h5_int64_t
*>
(
varray
.
get
());
...
...
@@ -643,22 +643,22 @@ string Collimator::getCollimatorShape() {
void
Collimator
::
setGeom
()
{
geom_m
[
0
].
x
=
rs_m
*
cos
(
as_m
);
geom_m
[
0
].
y
=
rs_m
*
sin
(
as_m
);
geom_m
[
0
].
x
=
rs_m
*
cos
(
as_m
);
geom_m
[
0
].
y
=
rs_m
*
sin
(
as_m
);
geom_m
[
1
].
x
=
re_m
*
cos
(
as_m
);
geom_m
[
1
].
y
=
re_m
*
sin
(
as_m
);
geom_m
[
1
].
x
=
re_m
*
cos
(
as_m
);
geom_m
[
1
].
y
=
re_m
*
sin
(
as_m
);
geom_m
[
2
].
x
=
re_m
*
cos
(
ae_m
);
geom_m
[
2
].
y
=
re_m
*
sin
(
ae_m
);
geom_m
[
2
].
x
=
re_m
*
cos
(
ae_m
);
geom_m
[
2
].
y
=
re_m
*
sin
(
ae_m
);
geom_m
[
3
].
x
=
rs_m
*
cos
(
ae_m
);
geom_m
[
3
].
y
=
rs_m
*
sin
(
ae_m
);
geom_m
[
3
].
x
=
rs_m
*
cos
(
ae_m
);
geom_m
[
3
].
y
=
rs_m
*
sin
(
ae_m
);
geom_m
[
4
].
x
=
geom_m
[
0
].
x
;
geom_m
[
4
].
y
=
geom_m
[
0
].
y
;
}
...
...
classic/5.0/src/AbsBeamline/Collimator.h
View file @
3e4a948f
...
...
@@ -25,13 +25,15 @@
#include "AbsBeamline/Component.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "BeamlineGeometry/StraightGeometry.h"
#include "A
bsBeamline/Stripper
.h"
#include "A
lgorithms/PBunchDefs
.h"
#include <hdf5.h>
#include "H5hut.h"
#include <vector>
class
LossDataSink
;
// Class Collimator
// ------------------------------------------------------------------------
/// Abstract collimator.
...
...
classic/5.0/src/AbsBeamline/Component.h
View file @
3e4a948f
...
...
@@ -25,14 +25,19 @@
#include "AbsBeamline/ElementBase.h"
#include "Fields/EMField.h"
#include "Algorithms/P
art
Bunch.h"
#include "Algorithms/PBunch
Defs
.h"
#define EPS_MISALIGNMENT 1e-8
class
PartData
;
//
class PartBunch;
class
PartBunch
;
template
<
class
T
,
int
N
>
class
FVps
;
struct
Point
{
double
x
;
double
y
;
};
// Class Component
// ------------------------------------------------------------------------
...
...
classic/5.0/src/AbsBeamline/Cyclotron.cpp
View file @
3e4a948f
...
...
@@ -19,6 +19,7 @@
// ------------------------------------------------------------------------
#include "AbsBeamline/Cyclotron.h"
#include "Algorithms/PartBunch.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Physics/Physics.h"
#include "Fields/Fieldmap.hh"
...
...
@@ -560,14 +561,14 @@ void Cyclotron::getdiffs() {
//~ Bfield.dbrr = new double[Bfield.ntot];
//~ if(Bfield.dbrrr) delete[] Bfield.dbrrr;
//~ Bfield.dbrrr = new double[Bfield.ntot];
//~
//~
//~ if(Bfield.dbrt) delete[] Bfield.dbrt;
//~ Bfield.dbrt = new double[Bfield.ntot];
//~ if(Bfield.dbrrt) delete[] Bfield.dbrrt;
//~ Bfield.dbrrt = new double[Bfield.ntot];
//~ if(Bfield.dbrtt) delete[] Bfield.dbrtt;
//~ Bfield.dbrtt = new double[Bfield.ntot];
//~
//~
//~ if(Bfield.f2) delete[] Bfield.f2;
//~ Bfield.f2 = new double[Bfield.ntot];
//~ if(Bfield.f3) delete[] Bfield.f3;
...
...
@@ -583,8 +584,8 @@ void Cyclotron::getdiffs() {
Bfield
.
dbrtt
.
resize
(
Bfield
.
ntot
);
Bfield
.
f2
.
resize
(
Bfield
.
ntot
);
Bfield
.
f3
.
resize
(
Bfield
.
ntot
);
Bfield
.
g3
.
resize
(
Bfield
.
ntot
);
Bfield
.
f3
.
resize
(
Bfield
.
ntot
);
Bfield
.
g3
.
resize
(
Bfield
.
ntot
);
for
(
int
i
=
0
;
i
<
Bfield
.
nrad
;
i
++
)
{
...
...
@@ -759,7 +760,7 @@ void Cyclotron::getFieldFromFile(const double &scaleFactor) {
Bfield
.
ntot
=
idx
(
Bfield
.
nrad
-
1
,
Bfield
.
ntet
)
+
1
;
//jjyang
*
gmsg
<<
"* Total stored grid point number ( ntetS * nrad ) : "
<<
Bfield
.
ntot
<<
endl
;
Bfield
.
bfld
.
resize
(
Bfield
.
ntot
);
Bfield
.
dbt
.
resize
(
Bfield
.
ntot
);
Bfield
.
dbtt
.
resize
(
Bfield
.
ntot
);
...
...
@@ -1208,7 +1209,7 @@ void Cyclotron::getFieldFromFile_CYCIAE(const double &scaleFactor) {
for
(
int
ii
=
0
;
ii
<
13
;
ii
++
)
CHECK_CYC_FSCANF_EOF
(
fscanf
(
f
,
"%s"
,
fout
));
for
(
int
k
=
0
;
k
<
nHalfPoints
;
k
++
)
{
CHECK_CYC_FSCANF_EOF
(
fscanf
(
f
,
"%d"
,
&
dtmp
));
CHECK_CYC_FSCANF_EOF
(
fscanf
(
f
,
"%d"
,
&
dtmp
));
...
...
@@ -1216,7 +1217,7 @@ void Cyclotron::getFieldFromFile_CYCIAE(const double &scaleFactor) {
CHECK_CYC_FSCANF_EOF
(
fscanf
(
f
,
"%lf"
,
&
(
Bfield
.
bfld
[
idx
(
i
,
k
)])));
Bfield
.
bfld
[
idx
(
i
,
k
)]
=
Bfield
.
bfld
[
idx
(
i
,
k
)]
*
(
-
10.0
);
// T --> kGs, minus for minus hydrongen
}
for
(
int
k
=
nHalfPoints
;
k
<
Bfield
.
ntet
;
k
++
)
{
Bfield
.
bfld
[
idx
(
i
,
k
)]
=
Bfield
.
bfld
[
idx
(
i
,
Bfield
.
ntet
-
k
)];
}
...
...
classic/5.0/src/AbsBeamline/CyclotronValley.cpp
View file @
3e4a948f
...
...
@@ -20,7 +20,7 @@
#include "AbsBeamline/CyclotronValley.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "A
bstractObjects/OpalData
.h"
#include "A
lgorithms/PartBunch
.h"
#include "Fields/Fieldmap.hh"
#include "Physics/Physics.h"
#include "ValueDefinitions/RealVariable.h"
...
...
@@ -120,14 +120,14 @@ bool CyclotronValley::apply(const int &i, const double &t, double E[], double B[
}
bool
CyclotronValley
::
apply
(
const
int
&
i
,
const
double
&
t
,
Vector_t
&
E
,
Vector_t
&
B
)
{
const
Vector_t
tmpR
(
RefPartBunch_m
->
getX
(
i
)
-
dx_m
,
RefPartBunch_m
->
getY
(
i
)
-
dy_m
,
RefPartBunch_m
->
getZ
(
i
)
-
startField_m
-
ds_m
);
Vector_t
tmpE
(
0.0
,
0.0
,
0.0
),
tmpB
(
0.0
,
0.0
,
0.0
);
if
(
!
fieldmap_m
->
getFieldstrength
(
tmpR
,
tmpE
,
tmpB
))
{
// E += scale_m * cos(phase) * tmpE;
//B -= scale_m * sin(phase) * tmpB;
B
+=
scale_m
*
tmpB
;
B
+=
scale_m
*
tmpB
;
return
false
;
}
...
...
@@ -135,7 +135,7 @@ bool CyclotronValley::apply(const int &i, const double &t, Vector_t &E, Vector_t
}
bool
CyclotronValley
::
apply
(
const
Vector_t
&
R
,
const
Vector_t
&
centroid
,
const
double
&
t
,
Vector_t
&
E
,
Vector_t
&
B
)
{
const
Vector_t
tmpR
(
R
(
0
)
-
dx_m
,
R
(
1
)
-
dy_m
,
R
(
2
)
-
startField_m
-
ds_m
);
Vector_t
tmpE
(
0.0
,
0.0
,
0.0
),
tmpB
(
0.0
,
0.0
,
0.0
);
...
...
@@ -143,7 +143,7 @@ bool CyclotronValley::apply(const Vector_t &R, const Vector_t ¢roid, const d
if
(
!
fieldmap_m
->
getFieldstrength
(
tmpR
,
tmpE
,
tmpB
))
{
// E += scale_m * cos(phase) * tmpE;
//B -= scale_m * sin(phase) * tmpB;
B
+=
scale_m
*
tmpB
;
B
+=
scale_m
*
tmpB
;
return
false
;
}
return
true
;
...
...
@@ -162,11 +162,11 @@ void CyclotronValley::initialise(PartBunch *bunch, double &startField, double &e
if
(
zEnd
>
zBegin
)
{
msg
<<
getName
()
<<
" using file: "
<<
" "
;
fieldmap_m
->
getInfo
(
&
msg
);
ElementEdge_m
=
startField
;
startField_m
=
startField
=
ElementEdge_m
+
zBegin
;
endField_m
=
endField
=
ElementEdge_m
+
zEnd
;
}
else
{
endField
=
startField
-
1e-3
;
}
...
...
@@ -174,7 +174,7 @@ void CyclotronValley::initialise(PartBunch *bunch, double &startField, double &e
endField
=
startField
-
1e-3
;
}
}
...
...
classic/5.0/src/AbsBeamline/ElementBase.cpp
View file @
3e4a948f
...
...
@@ -24,16 +24,16 @@
#include "AbsBeamline/ElementBase.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/ElementImage.h"
#include "BeamlineGeometry/Euclid3D.h"
#include "BeamlineGeometry/Geometry.h"
#include "Structure/BoundaryGeometry.h"
#include "Channels/Channel.h"
#include "Solvers/WakeFunction.hh"
#include "Solvers/SurfacePhysicsHandler.hh"
#include <string>
using
namespace
std
;
//#include "BeamlineGeometry/Euclid3D.h"
//#include "BeamlineGeometry/Geometry.h"
#include "Structure/BoundaryGeometry.h"
#include "Solvers/WakeFunction.hh"
#include "Solvers/SurfacePhysicsHandler.hh"
using
namespace
std
;
// Class ElementBase
// ------------------------------------------------------------------------
...
...
classic/5.0/src/AbsBeamline/Monitor.cpp
View file @
3e4a948f
...
...
@@ -20,6 +20,7 @@
#include "Physics/Physics.h"
#include "AbsBeamline/Monitor.h"
#include "Algorithms/PartBunch.h"
#include "Fields/Fieldmap.hh"
#include "AbsBeamline/BeamlineVisitor.h"
#include <fstream>
...
...
classic/5.0/src/AbsBeamline/Monitor.h
View file @
3e4a948f
...
...
@@ -24,11 +24,14 @@
#include "AbsBeamline/Component.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "BeamlineGeometry/StraightGeometry.h"
//#include "Algorithms/PBunchDefs.h"
#include <hdf5.h>
#include "H5hut.h"
#include <list>
class
PartBunch
;
// Class Monitor
// ------------------------------------------------------------------------
/// Interface for beam position monitors.
...
...
classic/5.0/src/AbsBeamline/Multipole.cpp
View file @
3e4a948f
...
...
@@ -19,6 +19,7 @@
// ------------------------------------------------------------------------
#include "AbsBeamline/Multipole.h"
#include "Algorithms/PartBunch.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Fields/Fieldmap.hh"
#include "Physics/Physics.h"
...
...
classic/5.0/src/AbsBeamline/Multipole.h
View file @
3e4a948f
...
...
@@ -22,6 +22,7 @@
#include "BeamlineGeometry/StraightGeometry.h"
#include "Fields/BMultipoleField.h"
class
PartBunch
;
class
Fieldmap
;
// Class Multipole
...
...
classic/5.0/src/AbsBeamline/ParallelPlate.cpp
View file @
3e4a948f
...
...
@@ -21,6 +21,7 @@
#include "AbsBeamline/ParallelPlate.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Algorithms/PartBunch.h"
#include "Fields/Fieldmap.hh"
#include "Physics/Physics.h"
#include "ValueDefinitions/RealVariable.h"
...
...
@@ -80,8 +81,8 @@ ParallelPlate::ParallelPlate(const string &name):
ParallelPlate
::~
ParallelPlate
()
{
}
...
...
@@ -152,7 +153,7 @@ bool ParallelPlate::apply(const int &i, const double &t, Vector_t &E, Vector_t &
}
const
Vector_t
tmpR
(
RefPartBunch_m
->
getX
(
i
)
-
dx_m
,
RefPartBunch_m
->
getY
(
i
)
-
dy_m
,
RefPartBunch_m
->
getZ
(
i
)
-
startField_m
-
ds_m
);
//Here we don't check if the particle is outof bounds, just leave the matter to the particle Boundary collision model in BoundaryGeometry
if
(
(
tmpR
(
2
)
>=
startField_m
-
0.00001
)
&&
(
tmpR
(
2
)
<=
endField_m
+
0.00001
)
)
{
...
...
@@ -172,8 +173,8 @@ bool ParallelPlate::apply(const Vector_t &R, const Vector_t ¢roid, const dou
}
const
Vector_t
tmpR
(
R
(
0
)
-
dx_m
,
R
(
1
)
-
dy_m
,
R
(
2
)
-
startField_m
-
ds_m
);
// Fixme: check this.
//if(!fieldmap_m->getFieldstrength(tmpR, tmpE, tmpB)) {
if
(
(
tmpR
(
2
)
>=
startField_m
-
0.00001
)
&&
(
tmpR
(
2
)
<=
endField_m
+
0.00001
)
)
{
...
...
@@ -185,14 +186,14 @@ bool ParallelPlate::apply(const Vector_t &R, const Vector_t ¢roid, const dou
}
void
ParallelPlate
::
initialise
(
PartBunch
*
bunch
,
double
&
startField
,
double
&
endField
,
const
double
&
scaleFactor
)
{
Inform
msg
(
"PARALLELPLATE"
);
std
::
stringstream
errormsg
;
RefPartBunch_m
=
bunch
;
startField_m
=
ElementEdge_m
=
startField
;
//cout<<"Lenth_m in initialise: "<<length_m<<endl;
endField_m
=
endField
=
ElementEdge_m
+
length_m
;
//fixme:Has length_m already been initialised before?
}
// In current version ,not implemented yet.
...
...
@@ -204,7 +205,7 @@ void ParallelPlate::initialise(PartBunch *bunch, const double &scaleFactor) {
RefPartBunch_m
=
bunch
;
// ElementEdge_m = startField;
msg
<<
" Currently parallelplate initialization for cyclotron tracker is empty! "
<<
endl
;
}
...
...
@@ -218,12 +219,12 @@ bool ParallelPlate::bends() const {
void
ParallelPlate
::
goOnline
()
{
online_m
=
true
;
}
void
ParallelPlate
::
goOffline
()
{
online_m
=
false
;
}
...
...
classic/5.0/src/AbsBeamline/ParallelPlate.h
View file @
3e4a948f
...
...
@@ -24,6 +24,7 @@
#include "AbsBeamline/Component.h"
class
PartBunch
;
class
Fieldmap
;
// Class ParallelPlate
...
...
@@ -47,7 +48,7 @@ public:
/// Apply visitor to ParallelPlate.
virtual
void
accept
(
BeamlineVisitor
&
)
const
;
void
getDimensions
(
double
&
zBegin
,
double
&
zEnd
)
const
;
...
...
@@ -68,7 +69,7 @@ public:
double
getElementLength
()
const
;
virtual
bool
apply
(
const
int
&
i
,
const
double
&
t
,
double
E
[],
double
B
[]);
virtual
bool
apply
(
const
int
&
i
,
const
double
&
t
,
Vector_t
&
E
,
Vector_t
&
B
);
virtual
bool
apply
(
const
Vector_t
&
R
,
const
Vector_t
&
centroid
,
const
double
&
t
,
Vector_t
&
E
,
Vector_t
&
B
);
...
...
@@ -85,13 +86,13 @@ public:
virtual
void
goOffline
();
private:
string
filename_m
;
/**< The name of the inputfile*/
double
scale_m
;
/**< scale multiplier*/
double
phase_m
;
/**< phase shift of time varying field(degrees)*/
double
frequency_m
;
/**< Read in frequency of time varying field(MHz)*/
...
...
classic/5.0/src/AbsBeamline/Probe.cpp
View file @
3e4a948f
...
...
@@ -20,6 +20,7 @@
// ------------------------------------------------------------------------
#include "AbsBeamline/Probe.h"
#include "Algorithms/PartBunch.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Physics/Physics.h"
#include "Structure/LossDataSink.h"
...
...
@@ -43,9 +44,9 @@ Probe::Probe():
width_m
(
0.0
),
step_m
(
0
){
A_m
=
yend_m
-
ystart_m
;
B_m
=
xstart_m
-
xend_m
;
B_m
=
xstart_m
-
xend_m
;
R_m
=
sqrt
(
A_m
*
A_m
+
B_m
*
B_m
);
C_m
=
ystart_m
*
xend_m
-
xstart_m
*
yend_m
;
C_m
=
ystart_m
*
xend_m
-
xstart_m
*
yend_m
;
}
...
...
@@ -60,9 +61,9 @@ Probe::Probe(const Probe &right):
width_m
(
right
.
width_m
),
step_m
(
right
.
step_m
){
A_m
=
yend_m
-
ystart_m
;
B_m
=
xstart_m
-
xend_m
;
B_m
=
xstart_m
-
xend_m
;
R_m
=
sqrt
(
A_m
*
A_m
+
B_m
*
B_m
);
C_m
=
ystart_m
*
xend_m
-
xstart_m
*
yend_m
;
C_m
=
ystart_m
*
xend_m
-
xstart_m
*
yend_m
;
}
...
...
@@ -77,9 +78,9 @@ Probe::Probe(const string &name):
width_m
(
0.0
),
step_m
(
0
){
A_m
=
yend_m
-
ystart_m
;
B_m
=
xstart_m
-
xend_m
;
B_m
=
xstart_m
-
xend_m
;
R_m
=
sqrt
(
A_m
*
A_m
+
B_m
*
B_m
);
C_m
=
ystart_m
*
xend_m
-
xstart_m
*
yend_m
;
C_m
=
ystart_m
*
xend_m
-
xstart_m
*
yend_m
;
}
...
...
@@ -180,8 +181,8 @@ double Probe::getWidth() const {
void
Probe
::
setGeom
(
const
double
dist
)
{
double
slope
;
if
(
xend_m
==
xstart_m
)
double
slope
;
if
(
xend_m
==
xstart_m
)
slope
=
1.0e12
;
else
slope
=
(
yend_m
-
ystart_m
)
/
(
xend_m
-
xstart_m
);
...
...
@@ -199,7 +200,7 @@ void Probe::setGeom(const double dist) {
geom_m
[
3
].
y
=
yend_m
+
dist
/
2.0
*
1.0
/
sqrt
(
1
+
slope
*
slope
);
geom_m
[
4
].
x
=
geom_m
[
0
].
x
;
geom_m
[
4
].
y
=
geom_m
[
0
].
y
;
geom_m
[
4
].
y
=
geom_m
[
0
].
y
;
}
bool
Probe
::
checkProbe
(
PartBunch
&
bunch
,
const
int
turnnumber
,
const
double
t
,
const
double
tstep
)
{
...
...
@@ -215,7 +216,7 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
size_t
tempnum
=
bunch
.
getLocalNum
();
int
pflag
=
0
;
Vector_t
meanP
(
0.0
,
0.0
,
0.0
);
for
(
unsigned
int
i
=
0
;
i
<
bunch
.
getLocalNum
();
++
i
)
{
for
(
int
d
=
0
;
d
<
3
;
++
d
)
{
...
...
@@ -241,7 +242,7 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
}
else
{
sk1
=
meanP
(
1
)
/
meanP
(
0
);
sk2
=
-
A_m
/
B_m
;
stangle
=
std
::
abs
((
sk1
-
sk2
)
/
(
1
+
sk1
*
sk2
));
stangle
=
std
::
abs
((
sk1
-
sk2
)
/
(
1
+
sk1
*
sk2
));
}
double
lstep
=
(
sqrt
(
1.0
-
1.0
/
(
1.0
+
dot
(
meanP
,
meanP
)))
*
Physics
::
c
)
*
tstep
*
1.0e-6
;
// [mm]
double
Swidth
=
lstep
/
sqrt
(
1
+
1
/
stangle
/
stangle
);
...
...
@@ -251,7 +252,7 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
pflag
=
checkPoint
(
bunch
.
R
[
i
](
0
),
bunch
.
R
[
i
](
1
));
if
(
pflag
!=
0
)
{
// dist1 > 0, right hand, dt > 0; dist1 < 0, left hand, dt < 0
double
dist1
=
(
A_m
*
bunch
.
R
[
i
](
0
)
+
B_m
*
bunch
.
R
[
i
](
1
)
+
C_m
)
/
R_m
/
1000.0
;
double
dist1
=
(
A_m
*
bunch
.
R
[
i
](
0
)
+
B_m
*
bunch
.
R
[
i
](
1
)
+
C_m
)
/
R_m
/
1000.0
;
double
k1
,
k2
,
tangle
=
0.0
;
if
(
B_m
==
0.0
){
k1
=
bunch
.
P
[
i
](
1
)
/
bunch
.
P
[
i
](
0
);
...
...
@@ -268,7 +269,7 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
}
else
{
k1
=
bunch
.
P
[
i
](
1
)
/
bunch
.
P
[
i
](
0
);
k2
=
-
A_m
/
B_m
;
tangle
=
abs
((
k1
-
k2
)
/
(
1
+
k1
*
k2
));
tangle
=
abs
((
k1
-
k2
)
/
(
1
+
k1
*
k2
));
}
double
dist2
=
dist1
*
sqrt
(
1
+
1
/
tangle
/
tangle
);
double
dt
=
dist2
/
(
sqrt
(
1.0
-
1.0
/
(
1.0
+
dot
(
bunch
.
P
[
i
],
bunch
.
P
[
i
])))
*
Physics
::
c
)
*
1.0e9
;
...
...
@@ -277,13 +278,13 @@ bool Probe::checkProbe(PartBunch &bunch, const int turnnumber, const double t,
probepoint
(
1
)
=
(
A_m
*
A_m
*
bunch
.
R
[
i
](
1
)
-
A_m
*
B_m
*
bunch
.
R
[
i
](
0
)
-
B_m
*
C_m
)
/
(
R_m
*
R_m
);
probepoint
(
2
)
=
bunch
.
R
[
i
](
2
);
lossDs_m
->
addParticle_time
(
probepoint
,
bunch
.
P
[
i
],
bunch
.
ID
[
i
],
t
+
dt
,
turnnumber
);
flagprobed
=
true
;
flagprobed
=
true
;
}
}
}
reduce
(
&
flagprobed
,
&
flagprobed
+
1
,
&
flagprobed
,
OpBitwiseOrAssign
());
if
(
flagprobed
)
lossDs_m
->
save_time
(
getName
());
if
(
flagprobed
)
lossDs_m
->
save_time
(
getName
());
return
flagprobed
;
}
...
...
classic/5.0/src/AbsBeamline/Probe.h
View file @
3e4a948f
...
...
@@ -22,7 +22,9 @@
// ------------------------------------------------------------------------
#include "AbsBeamline/Component.h"
#include "AbsBeamline/Stripper.h"
class
PartBunch
;
class
LossDataSink
;
// Class Probe
// ------------------------------------------------------------------------
...
...
classic/5.0/src/AbsBeamline/RFCavity.cpp
View file @
3e4a948f
...
...
@@ -20,7 +20,7 @@
#include "AbsBeamline/RFCavity.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "A
bstractObjects/OpalData
.h"
#include "A
lgorithms/PartBunch
.h"
#include "Fields/Fieldmap.hh"
#include "ValueDefinitions/RealVariable.h"
#include "Structure/BoundaryGeometry.h"
...
...
classic/5.0/src/AbsBeamline/Septum.cpp
View file @
3e4a948f
...
...
@@ -20,6 +20,7 @@
#include "AbsBeamline/Septum.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Algorithms/PartBunch.h"
#include "Physics/Physics.h"
#include "Structure/LossDataSink.h"
#include <iostream>
...
...
@@ -201,7 +202,7 @@ bool Septum::checkSeptum(PartBunch &bunch) {
// angle range [0~2PI) degree
double
Septum
::
calculateAngle
(
double
x
,
double
y
)
{
double
thetaXY
=
atan2
(
y
,
x
);
// if(x < 0) thetaXY = pi + atan(y / x);
// else if((x > 0) && (y >= 0)) thetaXY = atan(y / x);
// else if((x > 0) && (y < 0)) thetaXY = 2.0 * pi + atan(y / x);
...
...
classic/5.0/src/AbsBeamline/Solenoid.cpp
View file @
3e4a948f
...
...
@@ -19,6 +19,7 @@
// ------------------------------------------------------------------------
#include "AbsBeamline/Solenoid.h"
#include "Algorithms/PartBunch.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Fields/Fieldmap.hh"
#include "Physics/Physics.h"
...
...
classic/5.0/src/AbsBeamline/Solenoid.h
View file @
3e4a948f
...
...
@@ -23,6 +23,7 @@
#include "AbsBeamline/Component.h"
class
PartBunch
;
class
Fieldmap
;
// Class Solenoid
...
...
classic/5.0/src/AbsBeamline/Stripper.cpp
View file @
3e4a948f
...
...
@@ -20,6 +20,7 @@
#include "AbsBeamline/Stripper.h"
#include "AbsBeamline/BeamlineVisitor.h"