Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
OPAL
src
Commits
f8e24c61
Commit
f8e24c61
authored
Mar 19, 2019
by
ext-rogers_c
Browse files
FFAG moved to FFA
parent
54df0d41
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
130 additions
and
129 deletions
+130
-129
src/Algorithms/ParallelCyclotronTracker.cpp
src/Algorithms/ParallelCyclotronTracker.cpp
+7
-7
src/Algorithms/ParallelCyclotronTracker.h
src/Algorithms/ParallelCyclotronTracker.h
+2
-2
src/Classic/AbsBeamline/BeamlineVisitor.h
src/Classic/AbsBeamline/BeamlineVisitor.h
+2
-2
src/Classic/AbsBeamline/CMakeLists.txt
src/Classic/AbsBeamline/CMakeLists.txt
+2
-2
src/Classic/AbsBeamline/Cyclotron.cpp
src/Classic/AbsBeamline/Cyclotron.cpp
+11
-11
src/Classic/AbsBeamline/Cyclotron.h
src/Classic/AbsBeamline/Cyclotron.h
+2
-2
src/Classic/AbsBeamline/ScalingFFAMagnet.cpp
src/Classic/AbsBeamline/ScalingFFAMagnet.cpp
+22
-22
src/Classic/AbsBeamline/ScalingFFAMagnet.h
src/Classic/AbsBeamline/ScalingFFAMagnet.h
+16
-16
src/Classic/AbsBeamline/SpecificElementVisitor.h
src/Classic/AbsBeamline/SpecificElementVisitor.h
+4
-4
src/Classic/Algorithms/DefaultVisitor.cpp
src/Classic/Algorithms/DefaultVisitor.cpp
+2
-2
src/Classic/Algorithms/DefaultVisitor.h
src/Classic/Algorithms/DefaultVisitor.h
+2
-2
src/Elements/CMakeLists.txt
src/Elements/CMakeLists.txt
+2
-1
src/Elements/OpalScalingFFAMagnet.cpp
src/Elements/OpalScalingFFAMagnet.cpp
+17
-17
src/Elements/OpalScalingFFAMagnet.h
src/Elements/OpalScalingFFAMagnet.h
+12
-12
src/OpalConfigure/Configure.cpp
src/OpalConfigure/Configure.cpp
+2
-2
src/addToDoxygenMainPage.h
src/addToDoxygenMainPage.h
+1
-1
tests/classic_src/AbsBeamline/CMakeLists.txt
tests/classic_src/AbsBeamline/CMakeLists.txt
+1
-1
tests/classic_src/AbsBeamline/ScalingFFAMagnetTest.cpp
tests/classic_src/AbsBeamline/ScalingFFAMagnetTest.cpp
+23
-23
No files found.
src/Algorithms/ParallelCyclotronTracker.cpp
View file @
f8e24c61
...
...
@@ -7,7 +7,7 @@
// ------------------------------------------------------------------------
//
// Class: ParallelCyclotronTracker
// The class for tracking particles with 3D space charge in Cyclotrons and FFA
G
s
// The class for tracking particles with 3D space charge in Cyclotrons and FFAs
//
// ------------------------------------------------------------------------
//
...
...
@@ -52,7 +52,7 @@
#include "AbsBeamline/RFQuadrupole.h"
#include "AbsBeamline/SBend.h"
#include "AbsBeamline/SBend3D.h"
#include "AbsBeamline/ScalingFFA
G
Magnet.h"
#include "AbsBeamline/ScalingFFAMagnet.h"
#include "AbsBeamline/Separator.h"
#include "AbsBeamline/Septum.h"
#include "AbsBeamline/Solenoid.h"
...
...
@@ -542,7 +542,7 @@ void ParallelCyclotronTracker::visitCyclotron(const Cyclotron &cycl) {
* fieldflag = 2, readin carbon cyclotron field file created by Jianjun Yang, TYPE=CARBONCYCL
* fieldflag = 3, readin ANSYS format file for CYCIAE-100 created by Jianjun Yang, TYPE=CYCIAE
* fieldflag = 4, readin AVFEQ format file for Riken cyclotrons
* fieldflag = 5, readin FFA
G
format file for MSU/FNAL FFA
G
* fieldflag = 5, readin FFA format file for MSU/FNAL FFA
* fieldflag = 6, readin both median plane B field map and 3D E field map of RF cavity for compact cyclotron
* fieldflag = 7, read in fields for Daniel's synchrocyclotron simulations
*/
...
...
@@ -838,13 +838,13 @@ void ParallelCyclotronTracker::visitSBend3D(const SBend3D &bend) {
"Need to define a RINGDEFINITION to use SBend3D element"
);
}
void
ParallelCyclotronTracker
::
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
bend
)
{
*
gmsg
<<
"Adding ScalingFFA
G
Magnet"
<<
endl
;
void
ParallelCyclotronTracker
::
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
bend
)
{
*
gmsg
<<
"Adding ScalingFFAMagnet"
<<
endl
;
if
(
opalRing_m
!=
NULL
)
{
opalRing_m
->
appendElement
(
bend
);
}
else
{
throw
OpalException
(
"ParallelCyclotronTracker::visitScalingFFA
G
Magnet"
,
"Need to define a RINGDEFINITION to use ScalingFFA
G
Magnet element"
);
throw
OpalException
(
"ParallelCyclotronTracker::visitScalingFFAMagnet"
,
"Need to define a RINGDEFINITION to use ScalingFFAMagnet element"
);
}
}
...
...
src/Algorithms/ParallelCyclotronTracker.h
View file @
f8e24c61
...
...
@@ -164,8 +164,8 @@ public:
/// Apply the algorithm to a SBend3D.
virtual
void
visitSBend3D
(
const
SBend3D
&
);
/// Apply the algorithm to a ScalingFFA
G
Magnet.
virtual
void
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
bend
);
/// Apply the algorithm to a ScalingFFAMagnet.
virtual
void
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
bend
);
/// Apply the algorithm to a Separator.
virtual
void
visitSeparator
(
const
Separator
&
);
...
...
src/Classic/AbsBeamline/BeamlineVisitor.h
View file @
f8e24c61
...
...
@@ -63,7 +63,7 @@ class RFQuadrupole;
class
Ring
;
class
SBend
;
class
SBend3D
;
class
ScalingFFA
G
Magnet
;
class
ScalingFFAMagnet
;
class
Separator
;
class
Septum
;
class
Solenoid
;
...
...
@@ -210,7 +210,7 @@ public:
virtual
void
visitSolenoid
(
const
Solenoid
&
)
=
0
;
/// Apply the algorithm to a solenoid.
virtual
void
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
)
=
0
;
virtual
void
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
)
=
0
;
/// Apply the algorithm to a source.
virtual
void
visitSource
(
const
Source
&
)
=
0
;
...
...
src/Classic/AbsBeamline/CMakeLists.txt
View file @
f8e24c61
...
...
@@ -41,7 +41,7 @@ set (_SRCS
Ring.cpp
SBend.cpp
SBend3D.cpp
ScalingFFA
G
Magnet.cpp
ScalingFFAMagnet.cpp
Separator.cpp
Septum.cpp
Solenoid.cpp
...
...
@@ -98,7 +98,7 @@ set (HDRS
Ring.h
SBend3D.h
SBend.h
ScalingFFA
G
Magnet.h
ScalingFFAMagnet.h
SectorFieldMapComponent.h
Separator.h
Septum.h
...
...
src/Classic/AbsBeamline/Cyclotron.cpp
View file @
f8e24c61
...
...
@@ -194,7 +194,7 @@ int Cyclotron::getFieldFlag(const std::string& type) const {
* fieldflag = 2, readin carbon cyclotron field file created by Jianjun Yang, TYPE=CARBONCYCL
* fieldflag = 3, readin ANSYS format file for CYCIAE-100 created by Jianjun Yang, TYPE=CYCIAE
* fieldflag = 4, readin AVFEQ format file for Riken cyclotrons
* fieldflag = 5, readin FFA
G
format file for MSU/FNAL FFA
G
* fieldflag = 5, readin FFA format file for MSU/FNAL FFA
* fieldflag = 6, readin both median plane B field map and 3D E field map of RF cavity for compact cyclotron
* fieldflag = 7, read in fields for Daniel's synchrocyclotron simulations
*/
...
...
@@ -205,7 +205,7 @@ int Cyclotron::getFieldFlag(const std::string& type) const {
fieldflag
=
3
;
}
else
if
(
type
==
std
::
string
(
"AVFEQ"
))
{
fieldflag
=
4
;
}
else
if
(
type
==
std
::
string
(
"FFA
G
"
))
{
}
else
if
(
type
==
std
::
string
(
"FFA"
))
{
fieldflag
=
5
;
}
else
if
(
type
==
std
::
string
(
"BANDRF"
))
{
fieldflag
=
6
;
...
...
@@ -693,9 +693,9 @@ bool Cyclotron::interpolate(const double& rad,
// r1t1 : the index of the "min angle, min radius" point in the 2D field array.
// considering the array start with index of zero, minus 1.
if
(
myBFieldType_m
!=
FFA
G
BF
)
{
if
(
myBFieldType_m
!=
FFABF
)
{
/*
For FFA
G
this does not work
For FFA this does not work
*/
r1t1
=
it
+
ntetS
*
ir
-
1
;
r1t2
=
r1t1
+
1
;
...
...
@@ -743,7 +743,7 @@ bool Cyclotron::interpolate(const double& rad,
void
Cyclotron
::
read
(
const
int
&
fieldflag
,
const
double
&
scaleFactor
)
{
// PSIBF, AVFEQBF, ANSYSBF, FFA
G
BF
// PSIBF, AVFEQBF, ANSYSBF, FFABF
// for your own format field, you should add your own getFieldFromFile() function by yourself.
if
(
fieldflag
==
1
)
{
...
...
@@ -767,9 +767,9 @@ void Cyclotron::read(const int &fieldflag, const double &scaleFactor) {
getFieldFromFile_AVFEQ
(
scaleFactor
);
}
else
if
(
fieldflag
==
5
)
{
*
gmsg
<<
"* Read FFA
G
data MSU/FNAL "
<<
getBScale
()
<<
endl
;
myBFieldType_m
=
FFA
G
BF
;
getFieldFromFile_FFA
G
(
scaleFactor
);
*
gmsg
<<
"* Read FFA data MSU/FNAL "
<<
getBScale
()
<<
endl
;
myBFieldType_m
=
FFABF
;
getFieldFromFile_FFA
(
scaleFactor
);
}
else
if
(
fieldflag
==
6
)
{
*
gmsg
<<
"* Read both median plane B field map and 3D E field map of RF cavity for compact cyclotron"
<<
getBScale
()
<<
endl
;
...
...
@@ -1045,7 +1045,7 @@ void Cyclotron::initialise(PartBunchBase<double, 3> *bunch, const int &fieldflag
}
void
Cyclotron
::
getFieldFromFile_FFA
G
(
const
double
&
scaleFactor
)
{
void
Cyclotron
::
getFieldFromFile_FFA
(
const
double
&
scaleFactor
)
{
/*
Field is read in from ascci file (COSY output) in the oder:
...
...
@@ -1076,10 +1076,10 @@ void Cyclotron::getFieldFromFile_FFAG(const double &scaleFactor) {
vector
<
double
>::
iterator
vit
;
*
gmsg
<<
"* ----------------------------------------------"
<<
endl
;
*
gmsg
<<
"* READ IN FFA
G
FIELD MAP "
<<
endl
;
*
gmsg
<<
"* READ IN FFA FIELD MAP "
<<
endl
;
*
gmsg
<<
"* ----------------------------------------------"
<<
endl
;
BP
.
Bfact
=
-
10.0
;
// T->kG and H- for the current FNAL FFA
G
BP
.
Bfact
=
-
10.0
;
// T->kG and H- for the current FNAL FFA
ifstream
file_to_read
(
fmapfn_m
.
c_str
());
const
int
max_num_of_char_in_a_line
=
128
;
...
...
src/Classic/AbsBeamline/Cyclotron.h
View file @
f8e24c61
...
...
@@ -30,7 +30,7 @@ class Fieldmap;
class
LossDataSink
;
class
TrimCoil
;
enum
BFieldType
{
PSIBF
,
CARBONBF
,
ANSYSBF
,
AVFEQBF
,
FFA
G
BF
,
BANDRF
,
SYNCHRO
};
enum
BFieldType
{
PSIBF
,
CARBONBF
,
ANSYSBF
,
AVFEQBF
,
FFABF
,
BANDRF
,
SYNCHRO
};
struct
BfieldData
{
std
::
string
filename
;
...
...
@@ -231,7 +231,7 @@ protected:
void
getFieldFromFile_Carbon
(
const
double
&
scaleFactor
);
void
getFieldFromFile_CYCIAE
(
const
double
&
scaleFactor
);
void
getFieldFromFile_AVFEQ
(
const
double
&
scaleFactor
);
void
getFieldFromFile_FFA
G
(
const
double
&
scaleFactor
);
void
getFieldFromFile_FFA
(
const
double
&
scaleFactor
);
void
getFieldFromFile_BandRF
(
const
double
&
scaleFactor
);
void
getFieldFromFile_Synchrocyclotron
(
const
double
&
scaleFactor
);
...
...
src/Classic/AbsBeamline/ScalingFFAMagnet.cpp
View file @
f8e24c61
...
...
@@ -27,17 +27,17 @@
#include <cmath>
#include "AbsBeamline/ScalingFFA
G
Magnet.h"
#include "AbsBeamline/ScalingFFAMagnet.h"
#include "Algorithms/PartBunch.h"
#include "AbsBeamline/BeamlineVisitor.h"
ScalingFFA
G
Magnet
::
ScalingFFA
G
Magnet
(
const
std
::
string
&
name
)
ScalingFFAMagnet
::
ScalingFFAMagnet
(
const
std
::
string
&
name
)
:
Component
(
name
),
planarArcGeometry_m
(
1.
,
1.
),
dummy
(),
endField_m
(
NULL
)
{
setElType
(
isDrift
);
}
ScalingFFA
G
Magnet
::
ScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
right
)
ScalingFFAMagnet
::
ScalingFFAMagnet
(
const
ScalingFFAMagnet
&
right
)
:
Component
(
right
),
planarArcGeometry_m
(
right
.
planarArcGeometry_m
),
dummy
(),
maxOrder_m
(
right
.
maxOrder_m
),
tanDelta_m
(
right
.
tanDelta_m
),
...
...
@@ -56,64 +56,64 @@ ScalingFFAGMagnet::ScalingFFAGMagnet(const ScalingFFAGMagnet &right)
r0_m
=
right
.
r0_m
;
}
ScalingFFA
G
Magnet
::~
ScalingFFA
G
Magnet
()
{
ScalingFFAMagnet
::~
ScalingFFAMagnet
()
{
if
(
endField_m
!=
NULL
)
{
delete
endField_m
;
}
}
ElementBase
*
ScalingFFA
G
Magnet
::
clone
()
const
{
ScalingFFA
G
Magnet
*
magnet
=
new
ScalingFFA
G
Magnet
(
*
this
);
ElementBase
*
ScalingFFAMagnet
::
clone
()
const
{
ScalingFFAMagnet
*
magnet
=
new
ScalingFFAMagnet
(
*
this
);
magnet
->
initialise
();
return
magnet
;
}
EMField
&
ScalingFFA
G
Magnet
::
getField
()
{
EMField
&
ScalingFFAMagnet
::
getField
()
{
return
dummy
;
}
const
EMField
&
ScalingFFA
G
Magnet
::
getField
()
const
{
const
EMField
&
ScalingFFAMagnet
::
getField
()
const
{
return
dummy
;
}
bool
ScalingFFA
G
Magnet
::
apply
(
const
size_t
&
i
,
const
double
&
t
,
bool
ScalingFFAMagnet
::
apply
(
const
size_t
&
i
,
const
double
&
t
,
Vector_t
&
E
,
Vector_t
&
B
)
{
return
apply
(
RefPartBunch_m
->
R
[
i
],
RefPartBunch_m
->
P
[
i
],
t
,
E
,
B
);
}
void
ScalingFFA
G
Magnet
::
initialise
()
{
void
ScalingFFAMagnet
::
initialise
()
{
calculateDfCoefficients
();
planarArcGeometry_m
.
setElementLength
(
r0_m
*
phiEnd_m
);
// length = phi r
planarArcGeometry_m
.
setCurvature
(
1.
/
r0_m
);
}
void
ScalingFFA
G
Magnet
::
initialise
(
PartBunchBase
<
double
,
3
>
*
bunch
,
double
&
startField
,
double
&
endField
)
{
void
ScalingFFAMagnet
::
initialise
(
PartBunchBase
<
double
,
3
>
*
bunch
,
double
&
startField
,
double
&
endField
)
{
RefPartBunch_m
=
bunch
;
initialise
();
}
void
ScalingFFA
G
Magnet
::
finalise
()
{
void
ScalingFFAMagnet
::
finalise
()
{
RefPartBunch_m
=
NULL
;
}
bool
ScalingFFA
G
Magnet
::
bends
()
const
{
bool
ScalingFFAMagnet
::
bends
()
const
{
return
true
;
}
BGeometryBase
&
ScalingFFA
G
Magnet
::
getGeometry
()
{
BGeometryBase
&
ScalingFFAMagnet
::
getGeometry
()
{
return
planarArcGeometry_m
;
}
const
BGeometryBase
&
ScalingFFA
G
Magnet
::
getGeometry
()
const
{
const
BGeometryBase
&
ScalingFFAMagnet
::
getGeometry
()
const
{
return
planarArcGeometry_m
;
}
void
ScalingFFA
G
Magnet
::
accept
(
BeamlineVisitor
&
visitor
)
const
{
visitor
.
visitScalingFFA
G
Magnet
(
*
this
);
void
ScalingFFAMagnet
::
accept
(
BeamlineVisitor
&
visitor
)
const
{
visitor
.
visitScalingFFAMagnet
(
*
this
);
}
bool
ScalingFFA
G
Magnet
::
getFieldValue
(
const
Vector_t
&
R
,
Vector_t
&
B
)
const
{
bool
ScalingFFAMagnet
::
getFieldValue
(
const
Vector_t
&
R
,
Vector_t
&
B
)
const
{
Vector_t
pos
=
R
-
centre_m
;
double
r
=
sqrt
(
pos
[
0
]
*
pos
[
0
]
+
pos
[
2
]
*
pos
[
2
]);
double
phi
=
-
atan2
(
pos
[
0
],
pos
[
2
]);
// angle between y-axis and position vector in anticlockwise direction
...
...
@@ -129,7 +129,7 @@ bool ScalingFFAGMagnet::getFieldValue(const Vector_t &R, Vector_t &B) const {
}
bool
ScalingFFA
G
Magnet
::
getFieldValueCylindrical
(
const
Vector_t
&
pos
,
Vector_t
&
B
)
const
{
bool
ScalingFFAMagnet
::
getFieldValueCylindrical
(
const
Vector_t
&
pos
,
Vector_t
&
B
)
const
{
double
r
=
pos
[
0
];
double
z
=
pos
[
1
];
...
...
@@ -173,12 +173,12 @@ bool ScalingFFAGMagnet::getFieldValueCylindrical(const Vector_t &pos, Vector_t &
}
bool
ScalingFFA
G
Magnet
::
apply
(
const
Vector_t
&
R
,
const
Vector_t
&
P
,
bool
ScalingFFAMagnet
::
apply
(
const
Vector_t
&
R
,
const
Vector_t
&
P
,
const
double
&
t
,
Vector_t
&
E
,
Vector_t
&
B
)
{
return
getFieldValue
(
R
,
B
);
}
void
ScalingFFA
G
Magnet
::
calculateDfCoefficients
()
{
void
ScalingFFAMagnet
::
calculateDfCoefficients
()
{
dfCoefficients_m
=
std
::
vector
<
std
::
vector
<
double
>
>
(
maxOrder_m
+
1
);
dfCoefficients_m
[
0
]
=
std
::
vector
<
double
>
(
1
,
1.
);
// f_0 = 1.*0th derivative
for
(
size_t
n
=
0
;
n
<
maxOrder_m
;
n
+=
2
)
{
// n indexes the power in z
...
...
@@ -201,7 +201,7 @@ void ScalingFFAGMagnet::calculateDfCoefficients() {
}
void
ScalingFFA
G
Magnet
::
setEndField
(
endfieldmodel
::
EndFieldModel
*
endField
)
{
void
ScalingFFAMagnet
::
setEndField
(
endfieldmodel
::
EndFieldModel
*
endField
)
{
if
(
endField_m
!=
NULL
)
{
delete
endField_m
;
}
...
...
src/Classic/AbsBeamline/ScalingFFAMagnet.h
View file @
f8e24c61
...
...
@@ -30,22 +30,22 @@
#include "AbsBeamline/EndFieldModel/EndFieldModel.h"
#include "AbsBeamline/Component.h"
#ifndef ABSBEAMLINE_ScalingFFA
G
Magnet_H
#define ABSBEAMLINE_ScalingFFA
G
Magnet_H
#ifndef ABSBEAMLINE_ScalingFFAMagnet_H
#define ABSBEAMLINE_ScalingFFAMagnet_H
/** Sector bending magnet with an FFA
G
-style field index and spiral end shape
/** Sector bending magnet with an FFA-style field index and spiral end shape
*/
class
ScalingFFA
G
Magnet
:
public
Component
{
class
ScalingFFAMagnet
:
public
Component
{
public:
/** Construct a new ScalingFFA
G
Magnet
/** Construct a new ScalingFFAMagnet
*
* \param name User-defined name of the ScalingFFA
G
Magnet
* \param name User-defined name of the ScalingFFAMagnet
*/
explicit
ScalingFFA
G
Magnet
(
const
std
::
string
&
name
);
explicit
ScalingFFAMagnet
(
const
std
::
string
&
name
);
/** Destructor - deletes map */
~
ScalingFFA
G
Magnet
();
~
ScalingFFAMagnet
();
/** Inheritable copy constructor */
ElementBase
*
clone
()
const
;
...
...
@@ -91,7 +91,7 @@ class ScalingFFAGMagnet : public Component {
*/
bool
getFieldValueCylindrical
(
const
Vector_t
&
R
,
Vector_t
&
B
)
const
;
/** Initialise the ScalingFFA
G
Magnet
/** Initialise the ScalingFFAMagnet
*
* \param bunch the global bunch object
* \param startField not used
...
...
@@ -99,17 +99,17 @@ class ScalingFFAGMagnet : public Component {
*/
void
initialise
(
PartBunchBase
<
double
,
3
>
*
bunch
,
double
&
startField
,
double
&
endField
);
/** Initialise the ScalingFFA
G
Magnet
/** Initialise the ScalingFFAMagnet
*
* Sets up the field expansion and the geometry; call after changing any
* field parameters
*/
void
initialise
();
/** Finalise the ScalingFFA
G
Magnet - sets bunch to NULL */
/** Finalise the ScalingFFAMagnet - sets bunch to NULL */
void
finalise
();
/** Return true - ScalingFFA
G
Magnet always bends the reference particle */
/** Return true - ScalingFFAMagnet always bends the reference particle */
inline
bool
bends
()
const
;
/** Not implemented */
...
...
@@ -162,14 +162,14 @@ class ScalingFFAGMagnet : public Component {
/** Get the fringe field
*
* Returns the fringe field model; ScalingFFA
G
Magnet retains ownership of the
* Returns the fringe field model; ScalingFFAMagnet retains ownership of the
* returned memory.
*/
endfieldmodel
::
EndFieldModel
*
getEndField
()
const
{
return
endField_m
;}
/** Set the fringe field
*
* - endField: the new fringe field; ScalingFFA
G
Magnet takes ownership of the
* - endField: the new fringe field; ScalingFFAMagnet takes ownership of the
* memory associated with endField.
*/
void
setEndField
(
endfieldmodel
::
EndFieldModel
*
endField
);
...
...
@@ -242,9 +242,9 @@ class ScalingFFAGMagnet : public Component {
void
calculateDfCoefficients
();
/** Copy constructor */
ScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
right
);
ScalingFFAMagnet
(
const
ScalingFFAMagnet
&
right
);
ScalingFFA
G
Magnet
&
operator
=
(
const
ScalingFFA
G
Magnet
&
rhs
);
ScalingFFAMagnet
&
operator
=
(
const
ScalingFFAMagnet
&
rhs
);
PlanarArcGeometry
planarArcGeometry_m
;
BMultipoleField
dummy
;
...
...
src/Classic/AbsBeamline/SpecificElementVisitor.h
View file @
f8e24c61
...
...
@@ -35,7 +35,7 @@
#include "AbsBeamline/RFQuadrupole.h"
#include "AbsBeamline/SBend.h"
#include "AbsBeamline/SBend3D.h"
#include "AbsBeamline/ScalingFFA
G
Magnet.h"
#include "AbsBeamline/ScalingFFAMagnet.h"
#include "AbsBeamline/Separator.h"
#include "AbsBeamline/Septum.h"
#include "AbsBeamline/Solenoid.h"
...
...
@@ -184,7 +184,7 @@ public:
virtual
void
visitSource
(
const
Source
&
);
/// Apply the algorithm to a spiral sector magnet.
virtual
void
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
);
virtual
void
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
);
/// Apply the algorithm to a ParallelPlate.
virtual
void
visitParallelPlate
(
const
ParallelPlate
&
);
...
...
@@ -418,8 +418,8 @@ void SpecificElementVisitor<ELEM>::visitSBend3D(const SBend3D &element) {
}
template
<
class
ELEM
>
void
SpecificElementVisitor
<
ELEM
>::
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
element
)
{
CastsTrait
<
ELEM
,
ScalingFFA
G
Magnet
>::
apply
(
allElementsOfTypeE
,
element
);
void
SpecificElementVisitor
<
ELEM
>::
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
element
)
{
CastsTrait
<
ELEM
,
ScalingFFAMagnet
>::
apply
(
allElementsOfTypeE
,
element
);
}
template
<
class
ELEM
>
...
...
src/Classic/Algorithms/DefaultVisitor.cpp
View file @
f8e24c61
...
...
@@ -50,7 +50,7 @@
#include "AbsBeamline/RFQuadrupole.h"
#include "AbsBeamline/SBend.h"
#include "AbsBeamline/SBend3D.h"
#include "AbsBeamline/ScalingFFA
G
Magnet.h"
#include "AbsBeamline/ScalingFFAMagnet.h"
#include "AbsBeamline/Separator.h"
#include "AbsBeamline/Septum.h"
#include "AbsBeamline/Solenoid.h"
...
...
@@ -226,7 +226,7 @@ void DefaultVisitor::visitSBend3D(const SBend3D &bend) {
}
void
DefaultVisitor
::
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
spiral
)
{
void
DefaultVisitor
::
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
spiral
)
{
applyDefault
(
spiral
);
}
...
...
src/Classic/Algorithms/DefaultVisitor.h
View file @
f8e24c61
...
...
@@ -142,8 +142,8 @@ public:
/// Apply the algorithm to a sector bend.
virtual
void
visitSBend3D
(
const
SBend3D
&
);
/// Apply the algorithm to a scaling FFA
G
magnet.
virtual
void
visitScalingFFA
G
Magnet
(
const
ScalingFFA
G
Magnet
&
);
/// Apply the algorithm to a scaling FFA magnet.
virtual
void
visitScalingFFAMagnet
(
const
ScalingFFAMagnet
&
);
/// Apply the algorithm to a separator.
virtual
void
visitSeparator
(
const
Separator
&
);
...
...
src/Elements/CMakeLists.txt
View file @
f8e24c61
...
...
@@ -39,7 +39,7 @@ set (_SRCS
OpalRingDefinition.cpp
OpalSBend.cpp
OpalSBend3D.cpp
OpalScalingFFA
G
Magnet.cpp
OpalScalingFFAMagnet.cpp
OpalSeparator.cpp
OpalSeptum.cpp
OpalSextupole.cpp
...
...
@@ -103,6 +103,7 @@ set (HDRS
OpalRingDefinition.h
OpalSBend3D.h
OpalSBend.h
OpalScalingFFAMagnet.h
OpalSeparator.h
OpalSeptum.h
OpalSextupole.h
...
...
src/Elements/OpalScalingFFAMagnet.cpp
View file @
f8e24c61
...
...
@@ -29,14 +29,14 @@
#include "Utilities/OpalException.h" // used?
#include "AbsBeamline/EndFieldModel/Tanh.h" // classic
#include "AbsBeamline/ScalingFFA
G
Magnet.h" // classic
#include "Elements/OpalScalingFFA
G
Magnet.h"
#include "AbsBeamline/ScalingFFAMagnet.h" // classic
#include "Elements/OpalScalingFFAMagnet.h"
extern
Inform
*
gmsg
;
OpalScalingFFA
G
Magnet
::
OpalScalingFFA
G
Magnet
()
:
OpalElement
(
SIZE
,
"SCALINGFFA
G
MAGNET"
,
"The
\"
ScalingFFA
G
Magnet
\"
element defines a FFA
G
scaling magnet with zero or non-zero spiral angle."
)
{
OpalScalingFFAMagnet
::
OpalScalingFFAMagnet
()
:
OpalElement
(
SIZE
,
"SCALINGFFAMAGNET"
,
"The
\"
ScalingFFAMagnet
\"
element defines a FFA scaling magnet with zero or non-zero spiral angle."
)
{
itsAttr
[
B0
]
=
Attributes
::
makeReal
(
"B0"
,
"The nominal dipole field of the magnet [T]."
);
itsAttr
[
R0
]
=
Attributes
::
makeReal
(
"R0"
,
"Radial scale [m]."
);
...
...
@@ -47,11 +47,11 @@ OpalScalingFFAGMagnet::OpalScalingFFAGMagnet() :
itsAttr
[
MAX_Y_POWER
]
=
Attributes
::
makeReal
(
"MAX_Y_POWER"
,
"The maximum power in y that will be considered in the field expansion."
);
itsAttr
[
END_LENGTH
]
=
Attributes
::
makeReal
(
"END_LENGTH"
,
"The end length of the spiral FFA
G
[m]."
);
"The end length of the spiral FFA [m]."
);
itsAttr
[
HEIGHT
]
=
Attributes
::
makeReal
(
"HEIGHT"
,
"Full height of the magnet. Particles moving more than height/2. off the midplane (either above or below) are out of the aperture [m]."
);
itsAttr
[
CENTRE_LENGTH
]
=
Attributes
::
makeReal
(
"CENTRE_LENGTH"
,
"The centre length of the spiral FFA
G
[m]."
);
"The centre length of the spiral FFA [m]."
);
itsAttr
[
RADIAL_NEG_EXTENT
]
=
Attributes
::
makeReal
(
"RADIAL_NEG_EXTENT"
,
"Particles are considered outside the tracking region if radius is greater than R0-RADIAL_NEG_EXTENT [m]."
);
itsAttr
[
RADIAL_POS_EXTENT
]
=
Attributes
::
makeReal
(
"RADIAL_POS_EXTENT"
,
...
...
@@ -77,38 +77,38 @@ OpalScalingFFAGMagnet::OpalScalingFFAGMagnet() :
registerRealAttribute
(
"AZIMUTHAL_EXTENT"
);
registerOwnership
();
ScalingFFA
G
Magnet
*
magnet
=
new
ScalingFFA
G
Magnet
(
"ScalingFFA
G
Magnet"
);
ScalingFFAMagnet
*
magnet
=
new
ScalingFFAMagnet
(
"ScalingFFAMagnet"
);
magnet
->
setEndField
(
new
endfieldmodel
::
Tanh
(
1.
,
1.
,
1
));
setElement
(
magnet
->
makeAlignWrapper
());
}
OpalScalingFFA
G
Magnet
::
OpalScalingFFA
G
Magnet
(
const
std
::
string
&
name
,
OpalScalingFFA
G
Magnet
*
parent
)
:
OpalScalingFFAMagnet
::
OpalScalingFFAMagnet
(
const
std
::
string
&
name
,
OpalScalingFFAMagnet
*
parent
)
:
OpalElement
(
name
,
parent
)
{
ScalingFFA
G
Magnet
*
magnet
=
new
ScalingFFA
G
Magnet
(
name
);
ScalingFFAMagnet
*
magnet
=
new
ScalingFFAMagnet
(
name
);
magnet
->
setEndField
(
new
endfieldmodel
::
Tanh
(
1.
,
1.
,
1
));
setElement
(
magnet
->
makeAlignWrapper
());
}
OpalScalingFFA
G
Magnet
::~
OpalScalingFFA
G
Magnet
()
{
OpalScalingFFAMagnet
::~
OpalScalingFFAMagnet
()
{
}
OpalScalingFFA
G
Magnet
*
OpalScalingFFA
G
Magnet
::
clone
(
const
std
::
string
&
name
)
{
return
new
OpalScalingFFA
G
Magnet
(
name
,
this
);
OpalScalingFFAMagnet
*
OpalScalingFFAMagnet
::
clone
(
const
std
::
string
&
name
)
{
return
new
OpalScalingFFAMagnet
(
name
,
this
);
}
void
OpalScalingFFA
G
Magnet
::
void
OpalScalingFFAMagnet
::
fillRegisteredAttributes
(
const
ElementBase
&
base
,
ValueFlag
flag
)
{
OpalElement
::
fillRegisteredAttributes
(
base
,
flag
);
}
void
OpalScalingFFA
G
Magnet
::
update
()
{
ScalingFFA
G
Magnet
*
magnet
=
dynamic_cast
<
ScalingFFA
G
Magnet
*>
(
getElement
()
->
removeWrappers
());
void
OpalScalingFFAMagnet
::
update
()
{
ScalingFFAMagnet
*
magnet
=
dynamic_cast
<
ScalingFFAMagnet
*>
(
getElement
()
->
removeWrappers
());
// use L = r0*theta; we define the magnet ito length for UI but ito angles
// internally; and use m as external default unit and mm internally
...
...
src/Elements/OpalScalingFFAMagnet.h
View file @
f8e24c61
...
...
@@ -25,16 +25,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OPAL_OPALSCALINGFFA
G
MAGNET_H
#define OPAL_OPALSCALINGFFA
G
MAGNET_H
#ifndef OPAL_OPALSCALINGFFAMAGNET_H
#define OPAL_OPALSCALINGFFAMAGNET_H
#include "Elements/OpalBend.h"
/** OpalScalingFFA
G
Magnet provides user interface information for the SCALINGFFA
G
object
/** OpalScalingFFAMagnet provides user interface information for the SCALINGFFA object
*
* Defines three parameters - field map name, units for field, length for field
*/
class
OpalScalingFFA
G
Magnet
:
public
OpalElement
{
class
OpalScalingFFAMagnet
:
public
OpalElement
{
public:
/** enum maps string to integer value for UI definitions */
enum
{
...
...
@@ -55,13 +55,13 @@ class OpalScalingFFAGMagnet : public OpalElement {
};
/** Default constructor initialises UI parameters. */
OpalScalingFFA
G
Magnet
();
OpalScalingFFAMagnet
();
/** Destructor does nothing */
virtual
~
OpalScalingFFA
G
Magnet
();
virtual
~
OpalScalingFFAMagnet
();
/** Inherited copy constructor */
virtual
OpalScalingFFA
G
Magnet
*
clone
(
const
std
::
string
&
name
);
virtual
OpalScalingFFAMagnet
*
clone
(
const
std
::
string
&
name
);
/** Fill in all registered attributes
*
...
...
@@ -69,17 +69,17 @@ class OpalScalingFFAGMagnet : public OpalElement {
*/
virtual
void
fillRegisteredAttributes
(
const
ElementBase
&
,
ValueFlag
);
/** Update the ScalingFFA
G
with new parameters from UI parser */
/** Update the ScalingFFA with new parameters from UI parser */
virtual
void
update
();
private:
// Not implemented.
OpalScalingFFA
G
Magnet
(
const
OpalScalingFFA
G
Magnet
&
);