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
13dea676
Commit
13dea676
authored
Jul 17, 2020
by
kraus
Browse files
cleaning up
parent
241f4afb
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
146 additions
and
32 deletions
+146
-32
src/Algorithms/CavityAutophaser.cpp
src/Algorithms/CavityAutophaser.cpp
+21
-0
src/Algorithms/CavityAutophaser.h
src/Algorithms/CavityAutophaser.h
+21
-0
src/Algorithms/OrbitThreader.cpp
src/Algorithms/OrbitThreader.cpp
+23
-8
src/Algorithms/OrbitThreader.h
src/Algorithms/OrbitThreader.h
+21
-0
src/Algorithms/ParallelTTracker.cpp
src/Algorithms/ParallelTTracker.cpp
+3
-1
src/Algorithms/ParallelTTracker.h
src/Algorithms/ParallelTTracker.h
+3
-1
src/Classic/AbsBeamline/ElementBase.cpp
src/Classic/AbsBeamline/ElementBase.cpp
+2
-15
src/Classic/AbsBeamline/ElementBase.h
src/Classic/AbsBeamline/ElementBase.h
+9
-5
src/Classic/Fields/Astra1DDynamic_fast.cpp
src/Classic/Fields/Astra1DDynamic_fast.cpp
+22
-2
src/Classic/Fields/Astra1DDynamic_fast.h
src/Classic/Fields/Astra1DDynamic_fast.h
+21
-0
No files found.
src/Algorithms/CavityAutophaser.cpp
View file @
13dea676
//
// Class CavityAutophaser
//
// This class determines the phase of an RF cavity for which the reference particle
// is accelerated to the highest energy.
//
// Copyright (c) 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020 Christof Metzger-Kraus
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Algorithms/CavityAutophaser.h"
#include "Algorithms/Vektor.h"
#include "AbsBeamline/RFCavity.h"
...
...
src/Algorithms/CavityAutophaser.h
View file @
13dea676
//
// Class CavityAutophaser
//
// This class determines the phase of an RF cavity for which the reference particle
// is accelerated to the highest energy.
//
// Copyright (c) 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020 Christof Metzger-Kraus
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef CAVITYAUTOPHASER
#define CAVITYAUTOPHASER
...
...
src/Algorithms/OrbitThreader.cpp
View file @
13dea676
//
// Class OrbitThreader
//
// This class determines the design path by tracking the reference particle through
// the 3D lattice.
//
// Copyright (c) 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020 Christof Metzger-Kraus
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Algorithms/OrbitThreader.h"
#include "Algorithms/CavityAutophaser.h"
...
...
@@ -410,14 +432,7 @@ double OrbitThreader::computeDriftLengthToBoundingBox(const std::set<std::shared
if
(
elements
.
empty
()
||
(
elements
.
size
()
==
1
&&
(
*
elements
.
begin
())
->
getType
()
==
ElementBase
::
ElementType
::
DRIFT
))
{
boost
::
optional
<
Vector_t
>
intersectionPoint
=
globalBoundingBox_m
.
getPointOfIntersection
(
position
,
direction
);
double
maxDrift
=
intersectionPoint
?
euclidean_norm
(
intersectionPoint
.
get
()
-
position
)
:
10.0
;
if
(
intersectionPoint
)
{
std
::
ofstream
traj
(
"trajectories.gpl"
,
std
::
ios
::
app
);
traj
<<
position
(
0
)
<<
"
\t
"
<<
position
(
1
)
<<
"
\t
"
<<
position
(
2
)
<<
std
::
endl
;
traj
<<
intersectionPoint
.
get
()(
0
)
<<
"
\t
"
<<
intersectionPoint
.
get
()(
1
)
<<
"
\t
"
<<
intersectionPoint
.
get
()(
2
)
<<
std
::
endl
;
traj
<<
std
::
endl
;
}
return
maxDrift
;
return
intersectionPoint
?
euclidean_norm
(
intersectionPoint
.
get
()
-
position
)
:
10.0
;
}
return
std
::
numeric_limits
<
double
>::
max
();
...
...
src/Algorithms/OrbitThreader.h
View file @
13dea676
//
// Class OrbitThreader
//
// This class determines the design path by tracking the reference particle through
// the 3D lattice.
//
// Copyright (c) 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020 Christof Metzger-Kraus
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_ORBITTHREADER_H
#define OPAL_ORBITTHREADER_H
...
...
src/Algorithms/ParallelTTracker.cpp
View file @
13dea676
...
...
@@ -4,7 +4,9 @@
// The visitor class for tracking particles with time as independent
// variable.
//
// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
// Copyright (c) 200x - 2014, Christof Kraus, Paul Scherrer Institut, Villigen PSI, Switzerland
// 2015 - 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020, Christof Metzger-Kraus
// All rights reserved
//
// This file is part of OPAL.
...
...
src/Algorithms/ParallelTTracker.h
View file @
13dea676
...
...
@@ -4,7 +4,9 @@
// The visitor class for tracking particles with time as independent
// variable.
//
// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
// Copyright (c) 200x - 2014, Christof Kraus, Paul Scherrer Institut, Villigen PSI, Switzerland
// 2015 - 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020, Christof Metzger-Kraus
// All rights reserved
//
// This file is part of OPAL.
...
...
src/Classic/AbsBeamline/ElementBase.cpp
View file @
13dea676
...
...
@@ -352,35 +352,22 @@ ElementBase::BoundingBox::getPointOfIntersection(const Vector_t & position,
Vector_t
relativePosition
=
lowerLeftCorner
-
position
;
Vector_t
diagonal
=
upperRightCorner
-
lowerLeftCorner
;
Vector_t
normalizedDirection
=
direction
/
euclidean_norm
(
direction
);
// *gmsg << "position: " << position << "\n"
// << "normalizedDirection: " << normalizedDirection << "\n"
// << "lowerLeftCorner: " << lowerLeftCorner << "\n"
// << "upperRightCorner: " << upperRightCorner << "\n"
// << "diagonal: " << diagonal << endl;
for
(
int
i
=
-
1
;
i
<
2
;
i
+=
2
)
{
for
(
int
i
:
{
-
1
,
1
}
)
{
for
(
unsigned
int
d
=
0
;
d
<
3
;
++
d
)
{
double
projectedDirection
=
normalizedDirection
[
d
];
// *gmsg << "\n" << "projectedDirection: " << projectedDirection << "\n";
if
(
std
::
abs
(
projectedDirection
)
<
1e-10
)
{
continue
;
}
double
distanceNearestPoint
=
relativePosition
[
d
];
double
tau
=
distanceNearestPoint
/
projectedDirection
;
// *gmsg << "distanceNearestPoint: " << distanceNearestPoint << "\n"
// << "relativePosition: " << relativePosition << "\n"
// << "tau: " << tau << "\n";
if
(
tau
<
0
)
{
continue
;
}
Vector_t
delta
=
tau
*
normalizedDirection
;
Vector_t
relativeIntersectionPoint
=
i
*
(
relativePosition
-
delta
);
// *gmsg << "delta: " << delta << "\n"
// << "relativeIntersectionPoint: " << relativeIntersectionPoint << endl;
// *gmsg << sign * intersectionPoint[(d + 1) % 3] << "\t" << sign * relativeIntersectionPoint[(d + 2) % 3] << "\t";
if
(
relativeIntersectionPoint
[(
d
+
1
)
%
3
]
<
0.0
||
relativeIntersectionPoint
[(
d
+
1
)
%
3
]
>
diagonal
[(
d
+
1
)
%
3
]
||
relativeIntersectionPoint
[(
d
+
2
)
%
3
]
<
0.0
||
...
...
@@ -392,7 +379,7 @@ ElementBase::BoundingBox::getPointOfIntersection(const Vector_t & position,
}
relativePosition
=
upperRightCorner
-
position
;
}
// *gmsg << endl;
return
boost
::
none
;
}
...
...
src/Classic/AbsBeamline/ElementBase.h
View file @
13dea676
...
...
@@ -84,11 +84,6 @@ class ElementImage;
class
ParticleMatterInteractionHandler
;
class
WakeFunction
;
struct
BoundaryBox
{
Vector_t
lowerLeftEdge
;
Vector_t
upperRightEdge
;
};
class
ElementBase
:
public
RCObject
{
public:
...
...
@@ -372,6 +367,15 @@ public:
}
bool
isInside
(
const
Vector_t
&
)
const
;
/*! Computes the intersection point between a bounding box and the ray which
* has the direction 'direction' and starts at the position 'position'. If
* the position is inside the box then the algorithm should find an inter-
* section point should be found.
*
* @param position the position where the ray starts
* @param direction the direction of the ray
*/
boost
::
optional
<
Vector_t
>
getPointOfIntersection
(
const
Vector_t
&
position
,
const
Vector_t
&
direction
)
const
;
};
...
...
src/Classic/Fields/Astra1DDynamic_fast.cpp
View file @
13dea676
//
// Class Astra1DDynamic_fast
//
// This class provides a reader for Astra style field maps. It pre-computes the field
// on a lattice to increase the performance during simulation.
//
// Copyright (c) 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020 Christof Metzger-Kraus
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Fields/Astra1DDynamic_fast.h"
#include "Utilities/GeneralClassicException.h"
#include "Utilities/Util.h"
...
...
@@ -7,7 +28,6 @@
#include <fstream>
#include <ios>
extern
Inform
*
gmsg
;
Astra1DDynamic_fast
::
Astra1DDynamic_fast
(
std
::
string
aFilename
)
:
Astra1D_fast
(
aFilename
)
{
...
...
@@ -91,7 +111,7 @@ bool Astra1DDynamic_fast::getFieldstrength(const Vector_t &R, Vector_t &E, Vecto
ezpp
=
gsl_spline_eval
(
onAxisInterpolants_m
[
2
],
R
(
2
)
-
zbegin_m
,
onAxisAccel_m
[
2
]);
ezppp
=
gsl_spline_eval
(
onAxisInterpolants_m
[
3
],
R
(
2
)
-
zbegin_m
,
onAxisAccel_m
[
3
]);
}
catch
(
OpalException
const
&
e
)
{
throw
OpalException
(
"Astra1DDynamic
e
_fast::getFieldstrength"
,
throw
OpalException
(
"Astra1DDynamic_fast::getFieldstrength"
,
"The requested interpolation point, "
+
std
::
to_string
(
R
(
2
))
+
" is out of range"
);
}
// expand the field off-axis
...
...
src/Classic/Fields/Astra1DDynamic_fast.h
View file @
13dea676
//
// Class Astra1DDynamic_fast
//
// This class provides a reader for Astra style field maps. It pre-computes the field
// on a lattice to increase the performance during simulation.
//
// Copyright (c) 2016, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin, Germany
// 2017 - 2020 Christof Metzger-Kraus
//
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef CLASSIC_AstraFIELDMAP1DDYNAMICFAST_HH
#define CLASSIC_AstraFIELDMAP1DDYNAMICFAST_HH
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment