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
a8ba54ae
Commit
a8ba54ae
authored
May 01, 2020
by
snuverink_j
Browse files
remove PhysicsActions: STATIC, DYNAMIC, MAKESEQ, SETINT
parent
35bdd2a3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
0 additions
and
1066 deletions
+0
-1066
src/CMakeLists.txt
src/CMakeLists.txt
+0
-1
src/OpalConfigure/Configure.cpp
src/OpalConfigure/Configure.cpp
+0
-10
src/PhysicsActions/CMakeLists.txt
src/PhysicsActions/CMakeLists.txt
+0
-30
src/PhysicsActions/Dynamic.cpp
src/PhysicsActions/Dynamic.cpp
+0
-177
src/PhysicsActions/Dynamic.h
src/PhysicsActions/Dynamic.h
+0
-53
src/PhysicsActions/MakeSequence.cpp
src/PhysicsActions/MakeSequence.cpp
+0
-239
src/PhysicsActions/MakeSequence.h
src/PhysicsActions/MakeSequence.h
+0
-53
src/PhysicsActions/SetIntegrator.cpp
src/PhysicsActions/SetIntegrator.cpp
+0
-214
src/PhysicsActions/SetIntegrator.h
src/PhysicsActions/SetIntegrator.h
+0
-52
src/PhysicsActions/Static.cpp
src/PhysicsActions/Static.cpp
+0
-184
src/PhysicsActions/Static.h
src/PhysicsActions/Static.h
+0
-53
No files found.
src/CMakeLists.txt
View file @
a8ba54ae
...
...
@@ -83,7 +83,6 @@ add_subdirectory (Match)
add_subdirectory
(
OpalConfigure
)
add_subdirectory
(
OpalParser
)
add_subdirectory
(
Optimize
)
add_subdirectory
(
PhysicsActions
)
add_subdirectory
(
Sample
)
add_subdirectory
(
Solvers
)
add_subdirectory
(
Steppers
)
...
...
src/OpalConfigure/Configure.cpp
View file @
a8ba54ae
...
...
@@ -44,12 +44,6 @@
// Macro command.
#include "OpalParser/MacroCmd.h"
// Physics action commands.
#include "PhysicsActions/Dynamic.h"
#include "PhysicsActions/MakeSequence.h"
#include "PhysicsActions/SetIntegrator.h"
#include "PhysicsActions/Static.h"
// Commands introducing a special mode.
#include "Editor/EditCmd.h"
#include "Match/MatchCmd.h"
...
...
@@ -169,13 +163,11 @@ namespace {
opal
->
create
(
new
DumpFields
());
opal
->
create
(
new
DumpEMFields
());
opal
->
create
(
new
Echo
());
opal
->
create
(
new
Dynamic
());
opal
->
create
(
new
Eigen
());
opal
->
create
(
new
Envelope
());
opal
->
create
(
new
Help
());
opal
->
create
(
new
EditCmd
());
opal
->
create
(
new
List
());
opal
->
create
(
new
MakeSequence
());
opal
->
create
(
new
MatchCmd
());
opal
->
create
(
new
MatrixCmd
());
opal
->
create
(
new
Micado
());
...
...
@@ -185,8 +177,6 @@ namespace {
opal
->
create
(
new
Save
());
opal
->
create
(
new
Select
());
opal
->
create
(
new
Show
());
opal
->
create
(
new
SetIntegrator
());
opal
->
create
(
new
Static
());
opal
->
create
(
new
Stop
());
opal
->
create
(
new
Quit
());
opal
->
create
(
new
PSystem
());
...
...
src/PhysicsActions/CMakeLists.txt
deleted
100644 → 0
View file @
35bdd2a3
set
(
_SRCS
Dynamic.cpp
MakeSequence.cpp
SetIntegrator.cpp
Static.cpp
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_opal_sources
(
${
_SRCS
}
)
set
(
HDRS
Dynamic.h
MakeSequence.h
SetIntegrator.h
Static.h
)
install
(
FILES
${
HDRS
}
DESTINATION
"
${
CMAKE_INSTALL_PREFIX
}
/include/PhysicsActions"
)
# vi: set et ts=4 sw=4 sts=4:
# Local Variables:
# mode: cmake
# cmake-tab-width: 4
# indent-tabs-mode: nil
# require-final-newline: nil
# End:
src/PhysicsActions/Dynamic.cpp
deleted
100644 → 0
View file @
35bdd2a3
// ------------------------------------------------------------------------
// $RCSfile: Dynamic.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Dynamic
// The class for the OPAL DYNAMIC command.
//
// ------------------------------------------------------------------------
//
// $Date: 2001/08/13 15:19:44 $
// $Author: jowett $
//
// ------------------------------------------------------------------------
#include "PhysicsActions/Dynamic.h"
#include "AbstractObjects/BeamSequence.h"
#include "AbstractObjects/OpalData.h"
#include "Algorithms/LieMapper.h"
#include "Attributes/Attributes.h"
#include "FixedAlgebra/DragtFinnMap.h"
#include "FixedAlgebra/DragtFinnNormalForm.h"
#include "FixedAlgebra/FDynamicFP.h"
#include "FixedAlgebra/FTps.h"
#include "Physics/Physics.h"
#include "Structure/Beam.h"
#include "Utilities/OpalException.h"
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
using
std
::
complex
;
// Class Dynamic
// ------------------------------------------------------------------------
// The attributes of class Dynamic.
namespace
{
enum
{
LINE
,
// The lattice to be used.
BEAM
,
// The beam to be used.
FNAME
,
// The name of the output file.
ORDER
,
// The desired order.
SIZE
};
}
Dynamic
::
Dynamic
()
:
Action
(
SIZE
,
"DYNAMIC"
,
"The
\"
DYNAMIC
\"
command analyses a dynamic transfer map."
)
{
itsAttr
[
LINE
]
=
Attributes
::
makeString
(
"LINE"
,
"Name of the lattice to be analysed"
);
itsAttr
[
BEAM
]
=
Attributes
::
makeString
(
"BEAM"
,
"Name of the beam to be used"
);
itsAttr
[
FNAME
]
=
Attributes
::
makeString
(
"FILE"
,
"Name of the file to be written"
,
"DYNAMIC"
);
itsAttr
[
ORDER
]
=
Attributes
::
makeReal
(
"ORDER"
,
"Order of the analysis; must be at least 2"
,
6.0
);
registerOwnership
(
AttributeHandler
::
COMMAND
);
}
Dynamic
::
Dynamic
(
const
std
::
string
&
name
,
Dynamic
*
parent
)
:
Action
(
name
,
parent
)
{}
Dynamic
::~
Dynamic
()
{}
Dynamic
*
Dynamic
::
clone
(
const
std
::
string
&
name
)
{
return
new
Dynamic
(
name
,
this
);
}
void
Dynamic
::
execute
()
{
// Find BeamSequence and Beam definitions.
BeamSequence
*
use
=
BeamSequence
::
find
(
Attributes
::
getString
(
itsAttr
[
LINE
]));
Beam
*
beam
=
Beam
::
find
(
Attributes
::
getString
(
itsAttr
[
BEAM
]));
// Open output file.
std
::
string
file
=
Attributes
::
getString
(
itsAttr
[
FNAME
]);
std
::
ofstream
os
(
file
.
c_str
());
if
(
os
.
bad
())
{
throw
OpalException
(
"Dynamic::execute()"
,
"Unable to open file
\"
"
+
file
+
"
\"
."
);
}
// Reference for beam.
const
PartData
&
reference
=
beam
->
getReference
();
// Compute transfer map.
int
order
=
std
::
max
(
int
(
std
::
round
(
Attributes
::
getReal
(
itsAttr
[
ORDER
]))),
1
);
FTps
<
double
,
6
>::
setGlobalTruncOrder
(
order
);
LieMapper
mapper
(
*
use
->
fetchLine
(),
reference
,
false
,
false
,
order
);
mapper
.
execute
();
DragtFinnMap
<
3
>
map
;
mapper
.
getMap
(
map
);
os
<<
"Accumulated map:
\n
"
<<
map
;
// Find fixed point.
FVector
<
double
,
6
>
fixedPoint
;
DragtFinnMap
<
3
>
closedOrbitMap
;
map
.
dynamicFixedPoint
(
fixedPoint
,
closedOrbitMap
);
std
::
streamsize
old_prec
=
os
.
precision
(
12
);
os
<<
"Fixed point:
\n
"
;
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
os
<<
std
::
setw
(
24
)
<<
fixedPoint
[
i
];
}
os
<<
"
\n
Map around fixed point:
\n
"
;
os
<<
closedOrbitMap
;
// Print normal form.
// const DragtFinnNormalForm<3> normal(map);
// const FVector<complex<double>,6> &lambda = normal.eigenValues();
// 21-06-2000 remove const in order to hope KCC likes it ....!
DragtFinnNormalForm
<
3
>
normal
(
map
);
const
FVector
<
complex
<
double
>
,
6
>
&
lambda
=
normal
.
eigenValues
();
os
<<
"
\n
Eigenvalues of the linear map:
\n
"
;
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
os
<<
lambda
[
i
]
<<
'\n'
;
}
os
<<
"
\n
Factorised Lie transformation script(N) for normal form map:
\n
"
<<
normal
.
normalForm
();
os
<<
"
\n
Factorised Lie Transformation script(A) for normalising map:
\n
"
<<
normal
.
normalisingMap
();
// Print fractional tunes.
int
freedom
=
normal
.
degreesOfFreedom
();
os
<<
"
\n
Fractional tunes:
\n
"
;
for
(
int
mode
=
0
;
mode
<
freedom
;
mode
++
)
{
os
<<
std
::
setw
(
24
)
<<
std
::
arg
(
lambda
[
2
*
mode
])
/
Physics
::
two_pi
;
}
os
<<
'\n'
;
// Print logarithmic excitation constants.
os
<<
"
\n
Excitation constants:
\n
"
;
for
(
int
mode
=
0
;
mode
<
freedom
;
mode
++
)
{
os
<<
std
::
setw
(
24
)
<<
log
(
std
::
norm
(
lambda
[
2
*
mode
]))
/
2.0
;
}
os
<<
'\n'
;
// Normalised anharmonicities.
{
FMatrix
<
double
,
3
,
3
>
QQ
=
normal
.
anharmonicity
();
os
<<
"
\n
Normalised anharmonicites:
\n
"
;
for
(
int
mode1
=
1
;
mode1
<=
freedom
;
mode1
++
)
{
for
(
int
mode2
=
mode1
;
mode2
<=
freedom
;
mode2
++
)
{
os
<<
"dQ"
<<
mode1
<<
"/dE"
<<
mode2
<<
" = "
<<
std
::
setw
(
24
)
<<
QQ
(
mode1
-
1
,
mode2
-
1
)
<<
'\n'
;
}
}
}
// Invariant polynomials.
for
(
int
mode
=
1
;
mode
<=
freedom
;
mode
++
)
{
os
<<
"
\n
Invariant polynomial for mode "
<<
mode
<<
":
\n
"
<<
normal
.
invariant
(
mode
-
1
);
}
os
<<
std
::
flush
;
os
.
precision
(
old_prec
);
}
\ No newline at end of file
src/PhysicsActions/Dynamic.h
deleted
100644 → 0
View file @
35bdd2a3
#ifndef OPAL_Dynamic_HH
#define OPAL_Dynamic_HH
// ------------------------------------------------------------------------
// $RCSfile: Dynamic.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Dynamic
//
// ------------------------------------------------------------------------
//
// $Date: 2001/08/13 15:19:44 $
// $Author: jowett $
//
// ------------------------------------------------------------------------
#include "AbstractObjects/Action.h"
// Class Dynamic.
// ------------------------------------------------------------------------
/// The DYNAMIC command.
class
Dynamic
:
public
Action
{
public:
/// Exemplar constructor.
Dynamic
();
virtual
~
Dynamic
();
/// Make clone.
virtual
Dynamic
*
clone
(
const
std
::
string
&
name
);
/// Execute the command.
virtual
void
execute
();
private:
// Not implemented.
Dynamic
(
const
Dynamic
&
);
void
operator
=
(
const
Dynamic
&
);
// Clone constructor.
Dynamic
(
const
std
::
string
&
name
,
Dynamic
*
parent
);
};
#endif // OPAL_Dynamic_HH
src/PhysicsActions/MakeSequence.cpp
deleted
100644 → 0
View file @
35bdd2a3
// ------------------------------------------------------------------------
// $CVSfile: MakeSequence.cc,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: MakeSequence
// The class for the OPAL MAKESEQ command.
//
// ------------------------------------------------------------------------
//
// $Date: 2001/08/13 15:22:04 $
// $Author: jowett $
//
// ------------------------------------------------------------------------
#include "PhysicsActions/MakeSequence.h"
#include "AbsBeamline/Drift.h"
#include "AbstractObjects/BeamSequence.h"
#include "AbstractObjects/Element.h"
#include "AbstractObjects/OpalData.h"
#include "AbstractObjects/Object.h"
#include "AbstractObjects/ObjectFunction.h"
#include "AbstractObjects/ValueDefinition.h"
#include "Algorithms/DefaultVisitor.h"
#include "Attributes/Attributes.h"
#include "BeamlineGeometry/Euclid3D.h"
#include "Utilities/OpalException.h"
#include "Utilities/Options.h"
#include <fstream>
extern
Inform
*
gmsg
;
// Class MakeSequence
// ------------------------------------------------------------------------
namespace
MakeSequenceNS
{
// Functor for flagging an object.
struct
ObjectFlagger
:
ObjectFunction
{
virtual
void
operator
()(
Object
*
)
const
;
};
void
ObjectFlagger
::
operator
()(
Object
*
object
)
const
{
// Only output objects which have a parent, and which are not built-in.
object
->
setFlag
(
object
->
getParent
()
!=
0
&&
!
object
->
isBuiltin
());
}
// Functor for saving an element.
struct
ElementWriter
:
ObjectFunction
{
ElementWriter
(
std
::
ostream
&
ostr
)
:
os
(
ostr
)
{
}
virtual
void
operator
()(
Object
*
)
const
;
private:
std
::
ostream
&
os
;
};
void
ElementWriter
::
operator
()(
Object
*
object
)
const
{
if
(
object
->
isFlagged
()
&&
dynamic_cast
<
Element
*>
(
object
)
&&
!
dynamic_cast
<
BeamSequence
*>
(
object
))
{
if
(
object
->
getOpalName
()[
0
]
!=
'#'
)
{
(
*
this
)(
object
->
getParent
());
os
<<
object
;
}
object
->
setFlag
(
false
);
}
}
// Functor for saving a variable.
struct
VariableWriter
:
ObjectFunction
{
VariableWriter
(
std
::
ostream
&
ostr
)
:
os
(
ostr
)
{
}
virtual
void
operator
()(
Object
*
)
const
;
private:
std
::
ostream
&
os
;
};
void
VariableWriter
::
operator
()(
Object
*
object
)
const
{
if
(
object
->
isFlagged
()
&&
dynamic_cast
<
ValueDefinition
*>
(
object
))
{
os
<<
object
;
object
->
setFlag
(
false
);
}
}
// Visitor class for writing the sequence.
class
SequenceWriter
:
public
DefaultVisitor
{
public:
// Construction/destruction.
SequenceWriter
(
const
Beamline
&
beamline
,
const
std
::
string
&
name
,
std
::
ostream
&
os
);
virtual
~
SequenceWriter
();
// Override.
virtual
void
execute
();
// Visit drift; must override to do nothing.
virtual
void
visitDrift
(
const
Drift
&
);
protected:
// Apply the default to an element.
// All visitXXX() methods use applyDefault() which is overridden here.
virtual
void
applyDefault
(
const
ElementBase
&
element
);
private:
// The sequence name.
std
::
string
itsName
;
// The output stream to be written.
std
::
ostream
&
itsStream
;
// The accumulated length.
double
sum_length
;
};
SequenceWriter
::
SequenceWriter
(
const
Beamline
&
beamline
,
const
std
::
string
&
name
,
std
::
ostream
&
os
)
:
DefaultVisitor
(
beamline
,
false
,
false
),
itsName
(
name
),
itsStream
(
os
),
sum_length
(
0.0
)
{}
void
SequenceWriter
::
execute
()
{
std
::
string
comment
=
"// "
;
std
::
string
line
(
72
,
'-'
);
itsStream
<<
comment
<<
line
<<
'\n'
<<
comment
<<
"Sequence definition.
\n
"
<<
comment
<<
line
<<
'\n'
<<
itsName
<<
":SEQUENCE,REFER=CENTRE"
;
itsStream
<<
",L="
<<
sum_length
<<
";
\n
"
;
sum_length
=
0.0
;
DefaultVisitor
::
execute
();
itsStream
<<
"ENDSEQUENCE;"
<<
std
::
endl
;
}
SequenceWriter
::~
SequenceWriter
()
{}
void
SequenceWriter
::
visitDrift
(
const
Drift
&
drift
)
{
sum_length
+=
drift
.
getElementLength
();
}
void
SequenceWriter
::
applyDefault
(
const
ElementBase
&
element
)
{
std
::
string
objectName
=
element
.
getName
();
if
(
objectName
[
0
]
!=
'#'
)
{
Element
*
elem
=
Element
::
find
(
objectName
);
sum_length
-=
elem
->
getEntrance
(
Element
::
IS_CENTRE
);
itsStream
<<
" "
<<
objectName
<<
",AT="
<<
sum_length
;
itsStream
<<
";
\n
"
;
sum_length
+=
elem
->
getExit
(
Element
::
IS_CENTRE
);
}
}
// The attributes of class MakeSequence.
enum
{
LINE
,
// The lattice to be used.
NAME
,
// The name for the new sequence.
FNAME
,
// The file to be written.
SIZE
};
}
using
namespace
MakeSequenceNS
;
MakeSequence
::
MakeSequence
()
:
Action
(
SIZE
,
"MAKESEQ"
,
"The
\"
MAKESEQ
\"
statement constructs a flat sequence from a "
"
\"
LINE
\"
object."
)
{
itsAttr
[
LINE
]
=
Attributes
::
makeString
(
"LINE"
,
"Name of the lattice to be flattened"
);
itsAttr
[
NAME
]
=
Attributes
::
makeString
(
"NAME"
,
"Name to be given to the generated seqence (default = original name)."
);
itsAttr
[
FNAME
]
=
Attributes
::
makeString
(
"FILE"
,
"Name to be given to the generated file (default = new sequence name)."
);
registerOwnership
(
AttributeHandler
::
STATEMENT
);
}
MakeSequence
::
MakeSequence
(
const
std
::
string
&
name
,
MakeSequence
*
parent
)
:
Action
(
name
,
parent
)
{}
MakeSequence
::~
MakeSequence
()
{}
MakeSequence
*
MakeSequence
::
clone
(
const
std
::
string
&
name
)
{
return
new
MakeSequence
(
name
,
this
);
}
void
MakeSequence
::
execute
()
{
// Get relevant names.
std
::
string
useName
=
Attributes
::
getString
(
itsAttr
[
LINE
]);
std
::
string
name
=
Attributes
::
getString
(
itsAttr
[
NAME
]);
std
::
string
file
=
Attributes
::
getString
(
itsAttr
[
FNAME
]);
if
(
name
.
empty
())
name
=
useName
;
if
(
file
.
empty
())
file
=
name
;
// Find BeamSequence definition.
BeamSequence
*
use
=
BeamSequence
::
find
(
useName
);
// Open the output stream.
std
::
ofstream
os
(
file
.
c_str
());
if
(
os
.
bad
())
{
throw
OpalException
(
"MakeSequence::execute()"
,
"Unable to open output stream
\"
"
+
file
+
"
\"
."
);
}
os
.
precision
(
12
);
std
::
string
line
(
72
,
'-'
);
std
::
string
comment
=
"// "
;
// Flag all objects which should be output.
OpalData
::
getInstance
()
->
apply
(
MakeSequenceNS
::
ObjectFlagger
());
// Write all variables.
os
<<
comment
<<
line
<<
'\n'
<<
comment
<<
"Variable definitions."
<<
'\n'
<<
comment
<<
line
<<
'\n'
;
OpalData
::
getInstance
()
->
apply
(
MakeSequenceNS
::
VariableWriter
(
os
));
os
<<
'\n'
;
// Write all elements.
os
<<
comment
<<
line
<<
'\n'
<<
comment
<<
"Element definitions."
<<
'\n'
<<
comment
<<
line
<<
'\n'
;
OpalData
::
getInstance
()
->
apply
(
MakeSequenceNS
::
ElementWriter
(
os
));
os
<<
std
::
endl
;
// Write the sequence.
SequenceWriter
writer
(
*
use
->
fetchLine
(),
name
,
os
);
writer
.
execute
();
os
.
close
();
}
\ No newline at end of file
src/PhysicsActions/MakeSequence.h
deleted
100644 → 0
View file @
35bdd2a3
#ifndef OPAL_MakeSequence_HH
#define OPAL_MakeSequence_HH
// ------------------------------------------------------------------------
// $RCSfile: MakeSequence.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: MakeSequence
//
// ------------------------------------------------------------------------
//
// $Date: 2001/08/13 15:22:04 $
// $Author: jowett $
//
// ------------------------------------------------------------------------
#include "AbstractObjects/Action.h"
// Class MakeSequence
// ------------------------------------------------------------------------
/// The MAKESEQ command.
class
MakeSequence
:
public
Action
{
public:
/// Exemplar constructor.
MakeSequence
();
virtual
~
MakeSequence
();
/// Make clone.
virtual
MakeSequence
*
clone
(
const
std
::
string
&
name
);
/// Execute the command.
virtual
void
execute
();
private:
// Not implemented.
MakeSequence
(
const
MakeSequence
&
);
void
operator
=
(
const
MakeSequence
&
);
// Clone constructor.
MakeSequence
(
const
std
::
string
&
name
,
MakeSequence
*
parent
);
};
#endif // __MakeSequence_HH
src/PhysicsActions/SetIntegrator.cpp
deleted
100644 → 0
View file @
35bdd2a3
// ------------------------------------------------------------------------
// $RCSfile: SetIntegrator.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Definitions for class: SetIntegrator
// The class for the OPAL SETINTEGRATOR command.
//
// ------------------------------------------------------------------------
//