Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
src
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OPAL
src
Commits
8997fb4e
Commit
8997fb4e
authored
Jun 07, 2020
by
kraus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace all pointers to ElementBase with shared and weak pointers resp.
parent
d7d4f1f1
Changes
95
Show whitespace changes
Inline
Side-by-side
Showing
95 changed files
with
436 additions
and
430 deletions
+436
-430
src/AbstractObjects/BeamSequence.h
src/AbstractObjects/BeamSequence.h
+4
-2
src/AbstractObjects/Table.h
src/AbstractObjects/Table.h
+4
-2
src/Algorithms/ParallelTTracker.cpp
src/Algorithms/ParallelTTracker.cpp
+9
-9
src/Algorithms/ParallelTTracker.h
src/Algorithms/ParallelTTracker.h
+3
-2
src/Classic/AbsBeamline/BeamStripping.cpp
src/Classic/AbsBeamline/BeamStripping.cpp
+4
-4
src/Classic/AbsBeamline/BeamStripping.h
src/Classic/AbsBeamline/BeamStripping.h
+4
-2
src/Classic/AbsBeamline/CCollimator.h
src/Classic/AbsBeamline/CCollimator.h
+4
-2
src/Classic/AbsBeamline/ElementBase.cpp
src/Classic/AbsBeamline/ElementBase.cpp
+4
-4
src/Classic/AbsBeamline/ElementBase.h
src/Classic/AbsBeamline/ElementBase.h
+10
-10
src/Classic/AbsBeamline/FlexibleCollimator.h
src/Classic/AbsBeamline/FlexibleCollimator.h
+2
-2
src/Classic/AbsBeamline/Integrator.cpp
src/Classic/AbsBeamline/Integrator.cpp
+2
-2
src/Classic/AbsBeamline/Integrator.h
src/Classic/AbsBeamline/Integrator.h
+6
-6
src/Classic/Beamlines/ElmPtr.cpp
src/Classic/Beamlines/ElmPtr.cpp
+2
-2
src/Classic/Beamlines/ElmPtr.h
src/Classic/Beamlines/ElmPtr.h
+1
-1
src/Classic/Construction/Factory.h
src/Classic/Construction/Factory.h
+3
-2
src/Classic/Solvers/CSRIGFWakeFunction.cpp
src/Classic/Solvers/CSRIGFWakeFunction.cpp
+4
-4
src/Classic/Solvers/CSRIGFWakeFunction.hh
src/Classic/Solvers/CSRIGFWakeFunction.hh
+3
-3
src/Classic/Solvers/CSRWakeFunction.cpp
src/Classic/Solvers/CSRWakeFunction.cpp
+4
-4
src/Classic/Solvers/CSRWakeFunction.hh
src/Classic/Solvers/CSRWakeFunction.hh
+3
-3
src/Classic/Solvers/CollimatorPhysics.cpp
src/Classic/Solvers/CollimatorPhysics.cpp
+21
-22
src/Classic/Solvers/GreenWakeFunction.cpp
src/Classic/Solvers/GreenWakeFunction.cpp
+3
-3
src/Classic/Solvers/GreenWakeFunction.hh
src/Classic/Solvers/GreenWakeFunction.hh
+0
-1
src/Classic/Solvers/ParticleMatterInteractionHandler.hh
src/Classic/Solvers/ParticleMatterInteractionHandler.hh
+2
-0
src/Classic/Solvers/WakeFunction.hh
src/Classic/Solvers/WakeFunction.hh
+5
-5
src/Elements/CMakeLists.txt
src/Elements/CMakeLists.txt
+16
-16
src/Elements/OpalBeamStripping.cpp
src/Elements/OpalBeamStripping.cpp
+6
-6
src/Elements/OpalCCollimator.cpp
src/Elements/OpalCCollimator.cpp
+4
-3
src/Elements/OpalCavity.cpp
src/Elements/OpalCavity.cpp
+3
-3
src/Elements/OpalCyclotron.cpp
src/Elements/OpalCyclotron.cpp
+5
-4
src/Elements/OpalDegrader.cpp
src/Elements/OpalDegrader.cpp
+3
-3
src/Elements/OpalDrift.cpp
src/Elements/OpalDrift.cpp
+10
-17
src/Elements/OpalDrift.h
src/Elements/OpalDrift.h
+2
-1
src/Elements/OpalECollimator.cpp
src/Elements/OpalECollimator.cpp
+5
-5
src/Elements/OpalElement.cpp
src/Elements/OpalElement.cpp
+2
-2
src/Elements/OpalElement.h
src/Elements/OpalElement.h
+2
-2
src/Elements/OpalFlexibleCollimator.cpp
src/Elements/OpalFlexibleCollimator.cpp
+5
-5
src/Elements/OpalHKicker.cpp
src/Elements/OpalHKicker.cpp
+4
-4
src/Elements/OpalHMonitor.cpp
src/Elements/OpalHMonitor.cpp
+3
-3
src/Elements/OpalInstrument.cpp
src/Elements/OpalInstrument.cpp
+4
-4
src/Elements/OpalKicker.cpp
src/Elements/OpalKicker.cpp
+4
-4
src/Elements/OpalMarker.cpp
src/Elements/OpalMarker.cpp
+4
-4
src/Elements/OpalMonitor.cpp
src/Elements/OpalMonitor.cpp
+2
-2
src/Elements/OpalMultipole.cpp
src/Elements/OpalMultipole.cpp
+4
-4
src/Elements/OpalMultipoleT.cpp
src/Elements/OpalMultipoleT.cpp
+13
-13
src/Elements/OpalMultipoleTCurvedConstRadius.cpp
src/Elements/OpalMultipoleTCurvedConstRadius.cpp
+4
-4
src/Elements/OpalMultipoleTCurvedVarRadius.cpp
src/Elements/OpalMultipoleTCurvedVarRadius.cpp
+4
-4
src/Elements/OpalMultipoleTStraight.cpp
src/Elements/OpalMultipoleTStraight.cpp
+4
-4
src/Elements/OpalOctupole.cpp
src/Elements/OpalOctupole.cpp
+4
-4
src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp
src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp
+1
-1
src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp
src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp
+2
-2
src/Elements/OpalParallelPlate.cpp
src/Elements/OpalParallelPlate.cpp
+4
-4
src/Elements/OpalPatch.cpp
src/Elements/OpalPatch.cpp
+3
-3
src/Elements/OpalPepperPot.cpp
src/Elements/OpalPepperPot.cpp
+3
-3
src/Elements/OpalProbe.cpp
src/Elements/OpalProbe.cpp
+3
-3
src/Elements/OpalQuadrupole.cpp
src/Elements/OpalQuadrupole.cpp
+9
-9
src/Elements/OpalRBend.cpp
src/Elements/OpalRBend.cpp
+7
-7
src/Elements/OpalRBend3D.cpp
src/Elements/OpalRBend3D.cpp
+4
-4
src/Elements/OpalRCollimator.cpp
src/Elements/OpalRCollimator.cpp
+5
-5
src/Elements/OpalRingDefinition.cpp
src/Elements/OpalRingDefinition.cpp
+2
-2
src/Elements/OpalSBend.cpp
src/Elements/OpalSBend.cpp
+8
-8
src/Elements/OpalSBend3D.cpp
src/Elements/OpalSBend3D.cpp
+1
-1
src/Elements/OpalSRot.cpp
src/Elements/OpalSRot.cpp
+3
-3
src/Elements/OpalScalingFFAMagnet.cpp
src/Elements/OpalScalingFFAMagnet.cpp
+1
-1
src/Elements/OpalSeparator.cpp
src/Elements/OpalSeparator.cpp
+4
-4
src/Elements/OpalSeptum.cpp
src/Elements/OpalSeptum.cpp
+2
-2
src/Elements/OpalSextupole.cpp
src/Elements/OpalSextupole.cpp
+4
-4
src/Elements/OpalSlit.cpp
src/Elements/OpalSlit.cpp
+5
-5
src/Elements/OpalSolenoid.cpp
src/Elements/OpalSolenoid.cpp
+4
-4
src/Elements/OpalSource.cpp
src/Elements/OpalSource.cpp
+2
-2
src/Elements/OpalStripper.cpp
src/Elements/OpalStripper.cpp
+1
-1
src/Elements/OpalTravelingWave.cpp
src/Elements/OpalTravelingWave.cpp
+5
-5
src/Elements/OpalVKicker.cpp
src/Elements/OpalVKicker.cpp
+4
-3
src/Elements/OpalVMonitor.cpp
src/Elements/OpalVMonitor.cpp
+3
-3
src/Elements/OpalVariableRFCavity.cpp
src/Elements/OpalVariableRFCavity.cpp
+2
-2
src/Elements/OpalVariableRFCavityFringeField.cpp
src/Elements/OpalVariableRFCavityFringeField.cpp
+5
-5
src/Elements/OpalVerticalFFAMagnet.cpp
src/Elements/OpalVerticalFFAMagnet.cpp
+2
-2
src/Elements/OpalYRot.cpp
src/Elements/OpalYRot.cpp
+4
-3
src/Lines/Line.cpp
src/Lines/Line.cpp
+12
-12
src/Lines/Line.h
src/Lines/Line.h
+2
-2
src/Lines/Replacer.cpp
src/Lines/Replacer.cpp
+3
-3
src/Lines/Replacer.h
src/Lines/Replacer.h
+5
-4
src/Lines/Sequence.cpp
src/Lines/Sequence.cpp
+15
-14
src/Lines/Sequence.h
src/Lines/Sequence.h
+5
-3
src/Lines/SequenceParser.cpp
src/Lines/SequenceParser.cpp
+2
-2
src/Structure/OpalWake.cpp
src/Structure/OpalWake.cpp
+31
-38
src/Structure/OpalWake.h
src/Structure/OpalWake.h
+5
-5
src/Structure/ParticleMatterInteraction.h
src/Structure/ParticleMatterInteraction.h
+5
-4
src/Tables/AttList.cpp
src/Tables/AttList.cpp
+1
-1
src/Tables/AttWriter.cpp
src/Tables/AttWriter.cpp
+2
-2
src/Tables/Flatten.h
src/Tables/Flatten.h
+5
-3
src/Tables/RangeSelector.cpp
src/Tables/RangeSelector.cpp
+3
-3
src/Tables/Survey.cpp
src/Tables/Survey.cpp
+3
-4
src/Tables/Survey.h
src/Tables/Survey.h
+4
-4
src/Tables/Twiss.cpp
src/Tables/Twiss.cpp
+2
-3
src/Tables/Twiss.h
src/Tables/Twiss.h
+4
-4
No files found.
src/AbstractObjects/BeamSequence.h
View file @
8997fb4e
...
...
@@ -20,6 +20,8 @@
#include "AbstractObjects/Element.h"
#include <memory>
class
Beamline
;
...
...
@@ -48,7 +50,7 @@ public:
/// Return the embedded CLASSIC beam line.
// The result it the ideal line.
virtual
Beamline
*
fetchLine
()
const
=
0
;
virtual
std
::
shared_ptr
<
Beamline
>
fetchLine
()
const
=
0
;
protected:
...
...
src/AbstractObjects/Table.h
View file @
8997fb4e
...
...
@@ -20,7 +20,9 @@
#include "AbstractObjects/Object.h"
#include "AbstractObjects/Expressions.h"
#include <vector>
#include <memory>
class
Attribute
;
class
Beamline
;
...
...
@@ -113,7 +115,7 @@ public:
/// Return embedded CLASSIC beamline.
// Returns the CLASSIC beamline representing the table.
// The data of the table are attached to each position in the line.
virtual
const
Beamline
*
getLine
()
const
=
0
;
virtual
std
::
shared_ptr
<
const
Beamline
>
getLine
()
const
=
0
;
/// Return a table row.
// Returns the values stored in the row specified by the first argument,
...
...
src/Algorithms/ParallelTTracker.cpp
View file @
8997fb4e
...
...
@@ -605,7 +605,7 @@ void ParallelTTracker::computeExternalFields(OrbitThreader &oth) {
void
ParallelTTracker
::
computeWakefield
(
IndexMap
::
value_t
&
elements
)
{
bool
hasWake
=
false
;
WakeFunction
*
wfInstance
;
std
::
shared_ptr
<
WakeFunction
>
wfInstance
;
Inform
msg
(
"ParallelTTracker "
,
*
gmsg
);
...
...
@@ -640,7 +640,7 @@ void ParallelTTracker::computeWakefield(IndexMap::value_t &elements) {
if
(
!
wakeStatus_m
)
{
msg
<<
level2
<<
"============== START WAKE CALCULATION ============="
<<
endl
;
wfInstance
->
initialize
(
(
*
it
).
get
()
);
wfInstance
->
initialize
(
*
it
);
wakeStatus_m
=
true
;
}
...
...
@@ -677,7 +677,7 @@ void ParallelTTracker::computeWakefield(IndexMap::value_t &elements) {
void
ParallelTTracker
::
computeParticleMatterInteraction
(
IndexMap
::
value_t
elements
,
OrbitThreader
&
oth
)
{
Inform
msg
(
"ParallelTTracker "
,
*
gmsg
);
std
::
set
<
IndexMap
::
value_t
::
value_type
>
elementsWithParticleMatterInteraction
;
std
::
set
<
ParticleMatterInteractionHandler
*
>
particleMatterinteractionHandlers
;
std
::
set
<
ParticleMatterInteractionHandler
::
SP
>
particleMatterinteractionHandlers
;
std
::
pair
<
double
,
double
>
currentRange
(
0.0
,
0.0
);
while
(
elements
.
size
()
>
0
)
{
...
...
@@ -698,8 +698,8 @@ void ParallelTTracker::computeParticleMatterInteraction(IndexMap::value_t elemen
}
if
(
elementsWithParticleMatterInteraction
.
size
()
>
0
)
{
std
::
set
<
ParticleMatterInteractionHandler
*
>
oldSPHandlers
;
std
::
vector
<
ParticleMatterInteractionHandler
*
>
leftBehindSPHandlers
,
newSPHandlers
;
std
::
set
<
ParticleMatterInteractionHandler
::
SP
>
oldSPHandlers
;
std
::
vector
<
ParticleMatterInteractionHandler
::
SP
>
leftBehindSPHandlers
,
newSPHandlers
;
for
(
auto
it
:
activeParticleMatterInteractionHandlers_m
)
{
oldSPHandlers
.
insert
(
it
);
}
...
...
@@ -738,7 +738,7 @@ void ParallelTTracker::computeParticleMatterInteraction(IndexMap::value_t elemen
do
{
///all particles in material if max per node is 2 and other degraders have 0 particles
//check if more than one degrader has particles
ParticleMatterInteractionHandler
*
onlyDegraderWithParticles
=
NULL
;
ParticleMatterInteractionHandler
::
SP
onlyDegraderWithParticles
=
NULL
;
int
degradersWithParticlesCount
=
0
;
for
(
auto
it
:
activeParticleMatterInteractionHandlers_m
)
{
it
->
setFlagAllParticlesIn
(
false
);
...
...
@@ -979,7 +979,7 @@ void ParallelTTracker::writePhaseSpace(const long long /*step*/, bool psDump, bo
FieldList
collimators
=
itsOpalBeamline_m
.
getElementByType
(
ElementBase
::
CCOLLIMATOR
);
if
(
collimators
.
size
()
!=
0
)
{
for
(
FieldList
::
iterator
it
=
collimators
.
begin
();
it
!=
collimators
.
end
();
++
it
)
{
FlexibleCollimator
*
coll
=
static_cast
<
FlexibleCollimator
*>
(
it
->
getElement
().
ge
t
());
std
::
shared_ptr
<
FlexibleCollimator
>
coll
=
std
::
static_pointer_cast
<
FlexibleCollimator
>
(
it
->
getElemen
t
());
std
::
string
name
=
coll
->
getName
();
unsigned
int
losses
=
coll
->
getLosses
();
collimatorLosses
.
push_back
(
std
::
make_pair
(
name
,
losses
));
...
...
@@ -1216,7 +1216,7 @@ void ParallelTTracker::autophaseCavities(const BorisPusher &pusher) {
auto
elementSet
=
itsOpalBeamline_m
.
getElements
(
nextR
);
for
(
auto
element
:
elementSet
)
{
if
(
element
->
getType
()
==
ElementBase
::
TRAVELINGWAVE
)
{
const
TravelingWave
*
TWelement
=
static_cast
<
const
TravelingWave
*>
(
element
.
get
()
);
std
::
shared_ptr
<
const
TravelingWave
>
TWelement
=
std
::
static_pointer_cast
<
const
TravelingWave
>
(
element
);
if
(
!
TWelement
->
getAutophaseVeto
())
{
CavityAutophaser
ap
(
itsReference
,
element
);
ap
.
getPhaseAtMaxEnergy
(
itsOpalBeamline_m
.
transformToLocalCS
(
element
,
itsBunch_m
->
RefPartR_m
),
...
...
@@ -1225,7 +1225,7 @@ void ParallelTTracker::autophaseCavities(const BorisPusher &pusher) {
}
}
else
if
(
element
->
getType
()
==
ElementBase
::
RFCAVITY
)
{
const
RFCavity
*
RFelement
=
static_cast
<
const
RFCavity
*>
(
element
.
get
()
);
std
::
shared_ptr
<
const
RFCavity
>
RFelement
=
std
::
static_pointer_cast
<
const
RFCavity
>
(
element
);
if
(
!
RFelement
->
getAutophaseVeto
())
{
CavityAutophaser
ap
(
itsReference
,
element
);
ap
.
getPhaseAtMaxEnergy
(
itsOpalBeamline_m
.
transformToLocalCS
(
element
,
itsBunch_m
->
RefPartR_m
),
...
...
src/Algorithms/ParallelTTracker.h
View file @
8997fb4e
...
...
@@ -63,6 +63,7 @@
#include <list>
#include <vector>
#include <memory>
class
ParticleMatterInteractionHandler
;
...
...
@@ -205,7 +206,7 @@ private:
bool
deletedParticles_m
;
WakeFunction
*
wakeFunction_m
;
std
::
shared_ptr
<
WakeFunction
>
wakeFunction_m
;
double
pathLength_m
;
...
...
@@ -242,7 +243,7 @@ private:
IpplTimings
::
TimerRef
BinRepartTimer_m
;
IpplTimings
::
TimerRef
WakeFieldTimer_m
;
std
::
set
<
ParticleMatterInteractionHandler
*
>
activeParticleMatterInteractionHandlers_m
;
std
::
set
<
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
>
activeParticleMatterInteractionHandlers_m
;
bool
particleMatterStatus_m
;
unsigned
long
totalParticlesInSimulation_m
;
...
...
src/Classic/AbsBeamline/BeamStripping.cpp
View file @
8997fb4e
...
...
@@ -69,7 +69,7 @@ BeamStripping::BeamStripping(const BeamStripping &right):
maxr_m
(
right
.
maxr_m
),
minz_m
(
right
.
minz_m
),
maxz_m
(
right
.
maxz_m
),
parmatint_m
(
NULL
)
{
parmatint_m
(
nullptr
)
{
}
BeamStripping
::
BeamStripping
(
const
std
::
string
&
name
)
:
...
...
@@ -84,7 +84,7 @@ BeamStripping::BeamStripping(const std::string &name):
maxr_m
(
0.0
),
minz_m
(
0.0
),
maxz_m
(
0.0
),
parmatint_m
(
NULL
)
{
parmatint_m
(
nullptr
)
{
}
...
...
@@ -166,7 +166,7 @@ bool BeamStripping::getStop() const {
}
bool
BeamStripping
::
checkBeamStripping
(
PartBunchBase
<
double
,
3
>
*
bunch
,
std
::
shared_ptr
<
Cyclotron
>
cycl
,
bool
BeamStripping
::
checkBeamStripping
(
PartBunchBase
<
double
,
3
>
*
bunch
,
std
::
shared_ptr
<
Cyclotron
>
c
onst
&
c
ycl
,
const
int
/*turnnumber*/
,
const
double
/*t*/
,
const
double
/*tstep*/
)
{
bool
flagNeedUpdate
=
false
;
...
...
@@ -190,7 +190,7 @@ bool BeamStripping::checkBeamStripping(PartBunchBase<double, 3> *bunch, std::sha
}
reduce
(
&
flagNeedUpdate
,
&
flagNeedUpdate
+
1
,
&
flagNeedUpdate
,
OpBitwiseOrAssign
());
if
(
flagNeedUpdate
&&
parmatint_m
)
{
dynamic_cast
<
BeamStrippingPhysics
*
>
(
parmatint_m
)
->
setCyclotron
(
cycl
);
std
::
dynamic_pointer_cast
<
BeamStrippingPhysics
>
(
parmatint_m
)
->
setCyclotron
(
cycl
);
parmatint_m
->
apply
(
bunch
,
boundingSphere
);
}
return
flagNeedUpdate
;
...
...
src/Classic/AbsBeamline/BeamStripping.h
View file @
8997fb4e
...
...
@@ -27,9 +27,11 @@
#include <string>
#include <vector>
#include <memory>
class
BeamlineVisitor
;
class
Cyclotron
;
class
ParticleMatterInteractionHandler
;
struct
PFieldData
{
std
::
string
filename
;
...
...
@@ -77,7 +79,7 @@ public:
/// Apply visitor to BeamStripping.
virtual
void
accept
(
BeamlineVisitor
&
)
const
;
virtual
bool
checkBeamStripping
(
PartBunchBase
<
double
,
3
>
*
bunch
,
std
::
shared_ptr
<
Cyclotron
>
cycl
,
const
int
turnnumber
,
const
double
t
,
const
double
tstep
);
virtual
bool
checkBeamStripping
(
PartBunchBase
<
double
,
3
>
*
bunch
,
std
::
shared_ptr
<
Cyclotron
>
c
onst
&
c
ycl
,
const
int
turnnumber
,
const
double
t
,
const
double
tstep
);
virtual
void
initialise
(
PartBunchBase
<
double
,
3
>
*
bunch
,
double
&
startField
,
double
&
endField
);
...
...
@@ -145,7 +147,7 @@ private:
double
maxz_m
;
/// mm
///@}
ParticleMatterInteractionHandler
*
parmatint_m
;
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
parmatint_m
;
protected:
// object of Matrices including pressure field map and its derivates
...
...
src/Classic/AbsBeamline/CCollimator.h
View file @
8997fb4e
...
...
@@ -20,6 +20,8 @@
#include "AbsBeamline/PluginElement.h"
#include <memory>
class
ParticleMatterInteractionHandler
;
class
CCollimator
:
public
PluginElement
{
...
...
@@ -83,7 +85,7 @@ private:
///@}
double
rmax_m
;
///< maximum extend in r
ParticleMatterInteractionHandler
*
parmatint_m
=
nullptr
;
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
parmatint_m
=
nullptr
;
};
inline
...
...
src/Classic/AbsBeamline/ElementBase.cpp
View file @
8997fb4e
...
...
@@ -151,7 +151,7 @@ Channel *ElementBase::getChannel(const std::string &aKey, bool create) {
const
ConstChannel
*
ElementBase
::
getConstChannel
(
const
std
::
string
&
aKey
)
const
{
// Use const_cast to allow calling the non-const method GetChannel().
// The const return value of this method will nevertheless inhibit set().
return
const_cast
<
ElementBase
*>
(
this
)
->
getChannel
(
aKey
);
return
const_cast
<
ElementBase
*
>
(
this
)
->
getChannel
(
aKey
);
}
...
...
@@ -310,15 +310,15 @@ bool ElementBase::update(const AttributeSet &set) {
return
true
;
}
void
ElementBase
::
setWake
(
WakeFunction
*
wk
)
{
wake_m
=
w
k
;
//->clone(getName() + std::string("_wake")); }
void
ElementBase
::
setWake
(
std
::
shared_ptr
<
WakeFunction
>
const
&
wf
)
{
wake_m
=
w
f
;
}
void
ElementBase
::
setBoundaryGeometry
(
BoundaryGeometry
*
geo
)
{
bgeometry_m
=
geo
;
//->clone(getName() + std::string("_wake")); }
}
void
ElementBase
::
setParticleMatterInteraction
(
ParticleMatterInteractionHandler
*
parmatint
)
{
void
ElementBase
::
setParticleMatterInteraction
(
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
const
&
parmatint
)
{
parmatint_m
=
parmatint
;
}
...
...
src/Classic/AbsBeamline/ElementBase.h
View file @
8997fb4e
...
...
@@ -399,16 +399,16 @@ public:
/// attach a wake field to the element
virtual
void
setWake
(
WakeFunction
*
wf
);
virtual
void
setWake
(
std
::
shared_ptr
<
WakeFunction
>
const
&
wf
);
/// return the attached wake object if there is any
virtual
WakeFunction
*
getWake
()
const
;
virtual
std
::
shared_ptr
<
WakeFunction
>
getWake
()
const
;
virtual
bool
hasWake
()
const
;
virtual
void
setParticleMatterInteraction
(
ParticleMatterInteractionHandler
*
spys
);
virtual
void
setParticleMatterInteraction
(
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
const
&
spys
);
virtual
ParticleMatterInteractionHandler
*
getParticleMatterInteraction
()
const
;
virtual
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
getParticleMatterInteraction
()
const
;
virtual
bool
hasParticleMatterInteraction
()
const
;
...
...
@@ -466,11 +466,11 @@ private:
// The user-defined set of attributes.
AttributeSet
userAttribs
;
WakeFunction
*
wake_m
;
std
::
shared_ptr
<
WakeFunction
>
wake_m
;
BoundaryGeometry
*
bgeometry_m
;
ParticleMatterInteractionHandler
*
parmatint_m
;
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
parmatint_m
;
bool
positionIsFixed
;
///@{ ELEMEDGE attribute
...
...
@@ -541,12 +541,12 @@ bool ElementBase::isSharable() const
{
return
shareFlag
;
}
inline
WakeFunction
*
ElementBase
::
getWake
()
const
std
::
shared_ptr
<
WakeFunction
>
ElementBase
::
getWake
()
const
{
return
wake_m
;
}
inline
bool
ElementBase
::
hasWake
()
const
{
return
wake_m
!=
NULL
;
}
{
return
wake_m
!=
nullptr
;
}
inline
BoundaryGeometry
*
ElementBase
::
getBoundaryGeometry
()
const
...
...
@@ -557,12 +557,12 @@ bool ElementBase::hasBoundaryGeometry() const
{
return
bgeometry_m
!=
NULL
;
}
inline
ParticleMatterInteractionHandler
*
ElementBase
::
getParticleMatterInteraction
()
const
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
ElementBase
::
getParticleMatterInteraction
()
const
{
return
parmatint_m
;
}
inline
bool
ElementBase
::
hasParticleMatterInteraction
()
const
{
return
parmatint_m
!=
NULL
;
}
{
return
parmatint_m
!=
nullptr
;
}
inline
void
ElementBase
::
setCSTrafoGlobal2Local
(
const
CoordinateSystemTrafo
&
trafo
)
...
...
src/Classic/AbsBeamline/FlexibleCollimator.h
View file @
8997fb4e
...
...
@@ -80,7 +80,7 @@ private:
unsigned
int
losses_m
;
std
::
unique_ptr
<
LossDataSink
>
lossDs_m
;
ParticleMatterInteractionHandler
*
parmatint_m
;
std
::
shared_ptr
<
ParticleMatterInteractionHandler
>
parmatint_m
;
};
inline
...
...
src/Classic/AbsBeamline/Integrator.cpp
View file @
8997fb4e
...
...
@@ -25,7 +25,7 @@
// Class Integrator
// ------------------------------------------------------------------------
Integrator
::
Integrator
(
ElementBase
*
elem
)
:
Integrator
::
Integrator
(
ElementBase
::
SP
const
&
elem
)
:
ElementBase
(
elem
->
getName
()),
itsElement
(
elem
)
{}
...
...
src/Classic/AbsBeamline/Integrator.h
View file @
8997fb4e
...
...
@@ -42,12 +42,12 @@ class Integrator: public ElementBase {
public:
explicit
Integrator
(
ElementBase
*
);
explicit
Integrator
(
ElementBase
::
SP
const
&
);
Integrator
(
const
Integrator
&
rhs
);
virtual
~
Integrator
();
/// Return the embedded element.
inline
ElementBase
*
getElement
()
const
;
inline
ElementBase
::
SP
getElement
()
const
;
/// Set sharable flag.
// The whole structure depending on [b]this[/b] is marked as sharable.
...
...
@@ -81,7 +81,7 @@ public:
protected:
/// Pointer to the replaced element.
Pointer
<
ElementBase
>
itsElement
;
ElementBase
::
SP
itsElement
;
private:
...
...
@@ -94,8 +94,8 @@ private:
// Implementation.
// ------------------------------------------------------------------------
inline
ElementBase
*
Integrator
::
getElement
()
const
{
return
&*
itsElement
;
inline
ElementBase
::
SP
Integrator
::
getElement
()
const
{
return
itsElement
;
}
#endif // CLASSIC_Integrator_HH
\ No newline at end of file
src/Classic/Beamlines/ElmPtr.cpp
View file @
8997fb4e
...
...
@@ -33,7 +33,7 @@ ElmPtr::ElmPtr(const ElmPtr &rhs):
{}
ElmPtr
::
ElmPtr
(
ElementBase
*
elem
)
:
ElmPtr
::
ElmPtr
(
ElementBase
::
SP
const
&
elem
)
:
itsElement
(
elem
)
{}
...
...
src/Classic/Beamlines/ElmPtr.h
View file @
8997fb4e
...
...
@@ -35,7 +35,7 @@ public:
ElmPtr
();
ElmPtr
(
const
ElmPtr
&
);
ElmPtr
(
ElementBase
*
);
ElmPtr
(
ElementBase
::
SP
const
&
);
virtual
~
ElmPtr
();
/// Apply visitor.
...
...
src/Classic/Construction/Factory.h
View file @
8997fb4e
...
...
@@ -20,10 +20,11 @@
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Definition.h"
#include <string>
#include <memory>
class
ElementBase
;
class
AttributeSet
;
...
...
@@ -42,7 +43,7 @@ public:
// The element [b]newElement[/b] is linked to the repository.
// If an element with the same name exists already, replacement is
// rejected, and [b]newElement[/b] is deleted.
virtual
bool
define
(
ElementBase
*
newElement
)
=
0
;
virtual
bool
define
(
ElementBase
SP
const
&
newElement
)
=
0
;
/// Erase element by name.
// If there is no element with the given [b]name[/b],
...
...
src/Classic/Solvers/CSRIGFWakeFunction.cpp
View file @
8997fb4e
...
...
@@ -13,8 +13,8 @@
#include <fstream>
#include <cmath>
CSRIGFWakeFunction
::
CSRIGFWakeFunction
(
const
std
::
string
&
name
,
ElementBase
*
element
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
)
:
WakeFunction
(
name
,
element
,
N
),
CSRIGFWakeFunction
::
CSRIGFWakeFunction
(
const
std
::
string
&
name
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
)
:
WakeFunction
(
name
,
N
),
filters_m
(
filters
.
begin
(),
filters
.
end
()),
lineDensity_m
(),
dlineDensitydz_m
(),
...
...
@@ -106,11 +106,11 @@ void CSRIGFWakeFunction::apply(PartBunchBase<double, 3> *bunch) {
}
}
void
CSRIGFWakeFunction
::
initialize
(
const
ElementBase
*
ref
)
{
void
CSRIGFWakeFunction
::
initialize
(
ElementBase
::
ConstSP
const
&
ref
)
{
if
(
ref
->
getType
()
==
ElementBase
::
RBEND
||
ref
->
getType
()
==
ElementBase
::
SBEND
)
{
const
Bend2D
*
bend
=
static_cast
<
const
Bend2D
*
>
(
ref
);
std
::
shared_ptr
<
const
Bend2D
>
bend
=
std
::
static_pointer_cast
<
const
Bend2D
>
(
ref
);
double
End
;
bendRadius_m
=
bend
->
getBendRadius
();
...
...
src/Classic/Solvers/CSRIGFWakeFunction.hh
View file @
8997fb4e
...
...
@@ -2,21 +2,21 @@
#define CSRIGFWAKEFUNCTION_HH
#include "Solvers/WakeFunction.hh"
#include "AbsBeamline/Definition.h"
#include <memory>
#include <vector>
#include <string>
class
Filter
;
class
ElementBase
;
class
CSRIGFWakeFunction
:
public
WakeFunction
{
public:
CSRIGFWakeFunction
(
const
std
::
string
&
name
,
ElementBase
*
element
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
);
CSRIGFWakeFunction
(
const
std
::
string
&
name
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
);
void
apply
(
PartBunchBase
<
double
,
3
>
*
bunch
);
void
initialize
(
const
ElementBase
*
ref
);
void
initialize
(
ElementBaseConstSP
const
&
ref
);
virtual
const
std
::
string
getType
()
const
;
...
...
src/Classic/Solvers/CSRWakeFunction.cpp
View file @
8997fb4e
...
...
@@ -15,8 +15,8 @@
#include <cmath>
CSRWakeFunction
::
CSRWakeFunction
(
const
std
::
string
&
name
,
ElementBase
*
element
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
)
:
WakeFunction
(
name
,
element
,
N
),
CSRWakeFunction
::
CSRWakeFunction
(
const
std
::
string
&
name
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
)
:
WakeFunction
(
name
,
N
),
filters_m
(
filters
.
begin
(),
filters
.
end
()),
lineDensity_m
(),
dlineDensitydz_m
(),
...
...
@@ -112,11 +112,11 @@ void CSRWakeFunction::apply(PartBunchBase<double, 3> *bunch) {
}
}
void
CSRWakeFunction
::
initialize
(
const
ElementBase
*
ref
)
{
void
CSRWakeFunction
::
initialize
(
ElementBase
::
ConstSP
const
&
ref
)
{
if
(
ref
->
getType
()
==
ElementBase
::
RBEND
||
ref
->
getType
()
==
ElementBase
::
SBEND
)
{
const
Bend2D
*
bend
=
static_cast
<
const
Bend2D
*
>
(
ref
);
std
::
shared_ptr
<
const
Bend2D
>
bend
=
std
::
static_pointer_cast
<
const
Bend2D
>
(
ref
);
double
End
;
bendRadius_m
=
bend
->
getBendRadius
();
...
...
src/Classic/Solvers/CSRWakeFunction.hh
View file @
8997fb4e
...
...
@@ -2,21 +2,21 @@
#define CSRWAKEFUNCTION_HH
#include "Solvers/WakeFunction.hh"
#include "AbsBeamline/Definition.h"
#include <memory>
#include <vector>
#include <string>
class
Filter
;
class
ElementBase
;
class
CSRWakeFunction
:
public
WakeFunction
{
public:
CSRWakeFunction
(
const
std
::
string
&
name
,
ElementBase
*
element
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
);
CSRWakeFunction
(
const
std
::
string
&
name
,
std
::
vector
<
Filter
*>
filters
,
const
unsigned
int
&
N
);
void
apply
(
PartBunchBase
<
double
,
3
>
*
bunch
);
void
initialize
(
const
ElementBase
*
ref
);
void
initialize
(
ElementBaseConstSP
const
&
ref
);
virtual
const
std
::
string
getType
()
const
;
...
...
src/Classic/Solvers/CollimatorPhysics.cpp
View file @
8997fb4e
...
...
@@ -31,43 +31,48 @@
#include <algorithm>
namespace
{
bool
myCompF
(
PART
x
,
PART
y
)
{
return
x
.
label
>
y
.
label
;
}
struct
DegraderInsideTester
:
public
InsideTester
{
explicit
DegraderInsideTester
(
ElementBase
*
el
)
{
deg_m
=
st
atic_cast
<
Degrader
*>
(
el
);
explicit
DegraderInsideTester
(
ElementBase
::
WP
const
&
el
)
{
deg_m
=
st
d
::
static_pointer_cast
<
Degrader
>
(
el
.
lock
()
);
}
virtual
bool
checkHit
(
const
Vector_t
&
R
,
const
Vector_t
&
/*P*/
,
double
/*dt*/
)
override
{
return
deg_m
->
isInMaterial
(
R
(
2
));
return
deg_m
.
lock
()
->
isInMaterial
(
R
(
2
));
}
private:
Degrader
*
deg_m
;
std
::
weak_ptr
<
Degrader
>
deg_m
;
};
struct
CollimatorInsideTester
:
public
InsideTester
{
explicit
CollimatorInsideTester
(
ElementBase
*
el
)
{
col_m
=
st
atic_cast
<
CCollimator
*>
(
el
);
explicit
CollimatorInsideTester
(
ElementBase
::
WP
const
&
el
)
{
col_m
=
st
d
::
static_pointer_cast
<
CCollimator
>
(
el
.
lock
()
);
}
virtual
bool
checkHit
(
const
Vector_t
&
R
,
const
Vector_t
&
/*P*/
,
double
/*dt*/
)
override
{
return
col_m
->
checkPoint
(
R
(
0
),
R
(
1
));
return
col_m
.
lock
()
->
checkPoint
(
R
(
0
),
R
(
1
));
}
private:
CCollimator
*
col_m
;
std
::
weak_ptr
<
CCollimator
>
col_m
;
};
struct
FlexCollimatorInsideTester
:
public
InsideTester
{
explicit
FlexCollimatorInsideTester
(
ElementBase
*
el
)
{
col_m
=
st
atic_cast
<
FlexibleCollimator
*>
(
el
);
explicit
FlexCollimatorInsideTester
(
ElementBase
::
WP
const
&
el
)
{
col_m
=
st
d
::
static_pointer_cast
<
FlexibleCollimator
>
(
el
.
lock
()
);
}
virtual
bool
checkHit
(
const
Vector_t
&
R
,
const
Vector_t
&
P
,
double
dt
)
override
{
return
col_m
->
isStopped
(
R
,
P
,
Physics
::
c
*
dt
/
sqrt
(
1.0
+
dot
(
P
,
P
)));
return
col_m
.
lock
()
->
isStopped
(
R
,
P
,
Physics
::
c
*
dt
/
sqrt
(
1.0
+
dot
(
P
,
P
)));
}
private:
FlexibleCollimator
*
col_m
;
std
::
weak_ptr
<
FlexibleCollimator
>
col_m
;
};
}
...
...
@@ -117,13 +122,13 @@ CollimatorPhysics::CollimatorPhysics(const std::string &name,
collshape_m
=
element_ref_m
.
lock
()
->
getType
();
switch
(
collshape_m
)
{
case
ElementBase
::
DEGRADER
:
hitTester_m
.
reset
(
new
DegraderInsideTester
(
element_ref_m
));
hitTester_m
.
reset
(
new
DegraderInsideTester
(
element_ref_m
.
lock
()
));
break
;
case
ElementBase
::
CCOLLIMATOR
:
hitTester_m
.
reset
(
new
CollimatorInsideTester
(
element_ref_m
));
hitTester_m
.
reset
(
new
CollimatorInsideTester
(
element_ref_m
.
lock
()
));
break
;
case
ElementBase
::
FLEXIBLECOLLIMATOR
:
hitTester_m
.
reset
(
new
FlexCollimatorInsideTester
(
element_ref_m
));
hitTester_m
.
reset
(
new
FlexCollimatorInsideTester
(
element_ref_m
.
lock
()
));
break
;
default:
throw
OpalException
(
"CollimatorPhysics::CollimatorPhysics"
,
...
...
@@ -565,7 +570,7 @@ bool CollimatorPhysics::stillAlive(PartBunchBase<double, 3> *bunch) {
//free GPU memory in case element is degrader, it is empty and bunch has moved past it
if
(
collshape_m
==
ElementBase
::
DEGRADER
&&
totalPartsInMat_m
==
0
)
{
Degrader
*
deg
=
static_cast
<
Degrader
*>
(
element_ref_m
);
std
::
shared_ptr
<
Degrader
>
deg
=
std
::
static_pointer_cast
<
Degrader
>
(
element_ref_m
.
lock
()
);
//get the size of the degrader
double
zBegin
,
zEnd
;
...
...
@@ -584,12 +589,6 @@ bool CollimatorPhysics::stillAlive(PartBunchBase<double, 3> *bunch) {
}
namespace
{
bool
myCompF
(
PART
x
,
PART
y
)
{
return
x
.
label
>
y
.
label
;
}
}
void
CollimatorPhysics
::
deleteParticleFromLocalVector
()
{
/*
the particle to be deleted (label < 0) are all at the end of
...
...
src/Classic/Solvers/GreenWakeFunction.cpp
View file @
8997fb4e
#include "Solvers/GreenWakeFunction.hh"
#include "Algorithms/PartBunchBase.h"
#include "Utilities/GeneralClassicException.h"
#include "AbsBeamline/ElementBase.h"
#include <fstream>
#include <string>
...
...
@@ -37,7 +38,6 @@
* @param[in] fname read wake from file
*/
GreenWakeFunction
::
GreenWakeFunction
(
const
std
::
string
&
name
,
ElementBase
*
element
,
std
::
vector
<
Filter
*>
filters
,
int
NBIN
,
double
Z0
,
...
...
@@ -48,7 +48,7 @@ GreenWakeFunction::GreenWakeFunction(const std::string &name,
int
direction
,
bool
constLength
,
std
::
string
fname
)
:
WakeFunction
(
name
,
element
,
NBIN
),
WakeFunction
(
name
,
NBIN
),
lineDensity_m
(),
//~ FftWField_m(0),
NBin_m
(
NBIN
),
...
...
src/Classic/Solvers/GreenWakeFunction.hh
View file @
8997fb4e
...
...
@@ -25,7 +25,6 @@ public: