OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
BeamlineVisitor.h
Go to the documentation of this file.
1 //
2 // Class BeamlineVisitor
3 // The abstract class BeamlineVisitor is the base class for all visitors
4 // (algorithms) that can iterator over a beam line representation.
5 // A BeamlineVisitor applies itself to the representation via the
6 // ``Visitor'' pattern, see
7 // [p]
8 // E. Gamma, R. Helm, R. Johnson, and J. Vlissides,
9 // [BR]
10 // Design Patterns, Elements of Reusable Object-Oriented Software.
11 // [p]
12 // By using only pure abstract classes as an interface between the
13 // BeamlineVisitor and the beam line representation,
14 // we decouple the former from the implementation details of the latter.
15 // [p]
16 // The interface is defined in such a way that a visitor cannot modify the
17 // structure of a beam line, but it can assign special data like misalignments
18 // or integrators without problems.
19 //
20 // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
21 // All rights reserved
22 //
23 // This file is part of OPAL.
24 //
25 // OPAL is free software: you can redistribute it and/or modify
26 // it under the terms of the GNU General Public License as published by
27 // the Free Software Foundation, either version 3 of the License, or
28 // (at your option) any later version.
29 //
30 // You should have received a copy of the GNU General Public License
31 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
32 //
33 #ifndef CLASSIC_BeamlineVisitor_HH
34 #define CLASSIC_BeamlineVisitor_HH
35 
36 // Generic element classes interacting with a BeamlineVisitor.
37 class Component;
38 
39 // Beam line structure classes.
40 class Beamline;
41 class FlaggedElmPtr;
42 
43 // Specific element classes interacting with a BeamlineVisitor
44 class CCollimator;
45 class Corrector;
46 class Cyclotron;
47 class Degrader;
48 class Drift;
49 class FlexibleCollimator;
50 class Marker;
51 class Monitor;
52 class Multipole;
53 class MultipoleT;
54 class MultipoleTStraight;
57 class Offset;
58 class OutputPlane;
59 class Probe;
60 class RBend;
61 class RBend3D;
62 class RFCavity;
63 class Ring;
64 class SBend;
65 class SBend3D;
66 class ScalingFFAMagnet;
67 class Septum;
68 class Solenoid;
69 class Source;
70 class Stripper;
71 class TravelingWave;
72 #ifdef ENABLE_OPAL_FEL
73 class Undulator;
74 #endif
75 class Vacuum;
76 class VariableRFCavity;
78 class VerticalFFAMagnet;
79 
81 
82 public:
83 
85  virtual ~BeamlineVisitor();
86 
88  virtual void execute() = 0;
89 
91  virtual void visitBeamline(const Beamline &) = 0;
92 
94  virtual void visitCCollimator(const CCollimator &) = 0;
95 
97  virtual void visitComponent(const Component &) = 0;
98 
100  virtual void visitCorrector(const Corrector &) = 0;
101 
103  virtual void visitCyclotron(const Cyclotron &) = 0;
104 
106  virtual void visitDegrader(const Degrader &) = 0;
107 
109  virtual void visitDrift(const Drift &) = 0;
110 
112  virtual void visitFlaggedElmPtr(const FlaggedElmPtr &) = 0;
113 
115  virtual void visitFlexibleCollimator(const FlexibleCollimator &) = 0;
116 
118  virtual void visitMarker(const Marker &) = 0;
119 
121  virtual void visitMonitor(const Monitor &) = 0;
122 
124  virtual void visitMultipole(const Multipole &) = 0;
125 
127  virtual void visitMultipoleT(const MultipoleT &) = 0;
128 
130  virtual void visitMultipoleTStraight(const MultipoleTStraight &) = 0;
131 
134 
137 
139  virtual void visitOffset(const Offset &) = 0;
140 
142  virtual void visitOutputPlane(const OutputPlane &) = 0;
143 
145  virtual void visitProbe(const Probe &) = 0;
146 
148  virtual void visitRBend(const RBend &) = 0;
149 
151  virtual void visitRBend3D(const RBend3D &);
152 
154  virtual void visitRFCavity(const RFCavity &) = 0;
155 
157  virtual void visitRing(const Ring &) = 0;
158 
160  virtual void visitSBend(const SBend &) = 0;
161 
163  virtual void visitSBend3D(const SBend3D &) = 0;
164 
166  virtual void visitScalingFFAMagnet(const ScalingFFAMagnet &) = 0;
167 
169  virtual void visitSeptum(const Septum &) = 0;
170 
172  virtual void visitSolenoid(const Solenoid &) = 0;
173 
175  virtual void visitSource(const Source &) = 0;
176 
178  virtual void visitStripper(const Stripper &) = 0;
179 
181  virtual void visitTravelingWave(const TravelingWave &) = 0;
182 
183 #ifdef ENABLE_OPAL_FEL
184  virtual void visitUndulator(const Undulator &) = 0;
186 #endif
187 
189  virtual void visitVacuum(const Vacuum &) = 0;
190 
192  virtual void visitVariableRFCavity(const VariableRFCavity &) = 0;
193 
196  (const VariableRFCavityFringeField &) = 0;
197 
199  virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet &) = 0;
200 
201 private:
202 
203  // Not implemented.
205  void operator=(const BeamlineVisitor &);
206 };
207 
208 inline
210 
211 }
212 
213 #endif // CLASSIC_BeamlineVisitor_HH
virtual void visitRBend(const RBend &)=0
Apply the algorithm to a rectangular bend.
virtual void visitScalingFFAMagnet(const ScalingFFAMagnet &)=0
Apply the algorithm to a scaling FFA magnet.
virtual void visitMultipoleTStraight(const MultipoleTStraight &)=0
Apply the algorithm to an arbitrary straight multipole.
virtual void visitOutputPlane(const OutputPlane &)=0
Apply the algorithm to an outputplane.
Interface for a marker.
Definition: Marker.h:32
virtual void visitVacuum(const Vacuum &)=0
Apply the algorithm to a vacuum space.
virtual void visitRFCavity(const RFCavity &)=0
Apply the algorithm to a RF cavity.
virtual void visitMultipoleTCurvedVarRadius(const MultipoleTCurvedVarRadius &)=0
Apply the algorithm to an arbitrary curved multipole of variable radius.
virtual void visitCorrector(const Corrector &)=0
Apply the algorithm to a closed orbit corrector.
virtual void visitComponent(const Component &)=0
Apply the algorithm to an arbitrary component.
virtual void visitMarker(const Marker &)=0
Apply the algorithm to a marker.
Interface for solenoids.
Definition: Solenoid.h:36
Definition: Offset.h:53
Interface for solenoids.
Definition: RBend3D.h:39
virtual void visitMultipoleTCurvedConstRadius(const MultipoleTCurvedConstRadius &)=0
Apply the algorithm to an arbitrary curved multipole of constant radius.
virtual void visitSeptum(const Septum &)=0
Apply the algorithm to a septum magnet.
virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet &)=0
Apply the algorithm to a vertical FFA magnet.
An abstract sequence of beam line components.
Definition: Beamline.h:34
Interface for general multipole.
Definition: Multipole.h:47
Interface for drift space.
Definition: Drift.h:33
Definition: SBend.h:68
virtual void visitMonitor(const Monitor &)=0
Apply the algorithm to a beam position monitor.
Interface for general corrector.
Definition: Corrector.h:35
Definition: Vacuum.h:61
void operator=(const BeamlineVisitor &)
virtual void visitTravelingWave(const TravelingWave &)=0
Apply the algorithm to a traveling wave.
virtual void visitFlexibleCollimator(const FlexibleCollimator &)=0
Apply the algorithm to a flexible collimator.
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)=0
Apply the algorithm to a FlaggedElmPtr.
virtual void visitMultipole(const Multipole &)=0
Apply the algorithm to a multipole.
virtual void visitRing(const Ring &)=0
Apply the algorithm to a ring.
virtual void visitCyclotron(const Cyclotron &)=0
Apply the algorithm to a cyclotron.
virtual void visitSource(const Source &)=0
Apply the algorithm to a source.
virtual void visitSBend3D(const SBend3D &)=0
Apply the algorithm to a sector bend with 3D field map.
virtual void visitRBend3D(const RBend3D &)
Apply the algorithm to a rectangular bend.
virtual void visitDrift(const Drift &)=0
Apply the algorithm to a drift space.
virtual void visitStripper(const Stripper &)=0
Apply the algorithm to a particle stripper.
virtual ~BeamlineVisitor()
virtual void visitDegrader(const Degrader &)=0
Apply the algorithm to a degrader.
virtual void execute()=0
Execute the algorithm on the attached beam line.
virtual void visitVariableRFCavityFringeField(const VariableRFCavityFringeField &)=0
Apply the algorithm to a variable RF cavity with Fringe Field.
virtual void visitMultipoleT(const MultipoleT &)=0
Apply the algorithm to an arbitrary multipole.
Definition: RBend.h:58
Definition: Source.h:30
virtual void visitSBend(const SBend &)=0
Apply the algorithm to a sector bend.
virtual void visitSolenoid(const Solenoid &)=0
Apply the algorithm to a solenoid.
virtual void visitCCollimator(const CCollimator &)=0
Apply the algorithm to a collimator.
Definition: Probe.h:28
virtual void visitVariableRFCavity(const VariableRFCavity &)=0
Apply the algorithm to a variable RF cavity.
virtual void visitOffset(const Offset &)=0
Apply the algorithm to an offset (placement).
A section of a beam line.
Definition: FlaggedElmPtr.h:36
Ring describes a ring type geometry for tracking.
Definition: Ring.h:53
virtual void visitProbe(const Probe &)=0
Apply the algorithm to a probe.
virtual void visitBeamline(const Beamline &)=0
Apply the algorithm to a beam line.
Definition: Septum.h:23
Interface for a single beam element.
Definition: Component.h:50