OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
DefaultVisitor.h
Go to the documentation of this file.
1//
2// Class DefaultVisitor
3// The default interface for a BeamlineVisitor.
4// A default implementation for all visitors that can iterate over a
5// beam line representation.
6// This abstract base class implements the default behaviour for the
7// structural classes Beamline and FlaggedElmPtr.
8// It also holds the data required for all visitors in a protected area.
9//
10// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
11// All rights reserved
12//
13// This file is part of OPAL.
14//
15// OPAL is free software: you can redistribute it and/or modify
16// it under the terms of the GNU General Public License as published by
17// the Free Software Foundation, either version 3 of the License, or
18// (at your option) any later version.
19//
20// You should have received a copy of the GNU General Public License
21// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
22//
23#ifndef CLASSIC_DefaultVisitor_HH
24#define CLASSIC_DefaultVisitor_HH
25
27
28class ElementBase;
29
31public:
33 // Arguments:
34 // [ol]
35 // [li]The beamline to be used.
36 // [li]If true, the beam runs backwards through the line.
37 // [li]If true, we track against the beam.
38 // [/ol]
39 DefaultVisitor(const Beamline& beamline, bool backBeam, bool backTrack);
40
41 virtual ~DefaultVisitor() = 0;
42
44 virtual void execute();
45
46 virtual void visitComponent(const Component&);
47
49 virtual void visitBeamline(const Beamline&);
50
52 virtual void visitDrift(const Drift&);
53
55 virtual void visitFlaggedElmPtr(const FlaggedElmPtr&);
56
58 virtual void visitMarker(const Marker&);
59
61 virtual void visitMonitor(const Monitor&);
62
64 virtual void visitMultipole(const Multipole&);
65
67 virtual void visitMultipoleT(const MultipoleT&);
68
71
74
77
79 virtual void visitOffset(const Offset&);
80
82 virtual void visitRing(const Ring&);
83
85 virtual void visitRFCavity(const RFCavity&);
86
88 virtual void visitSolenoid(const Solenoid&);
89
91 virtual void visitTravelingWave(const TravelingWave&);
92
94 virtual void visitScalingFFAMagnet(const ScalingFFAMagnet& spiral);
95
97 virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet&);
98
100 virtual void visitProbe(const Probe& prob);
101
102protected:
103 // The top level beamline.
105
106 // The direction flags and corresponding factors.
107 bool back_beam; // true, if beam runs from right (s=C) to left (s=0).
108 bool back_track; // true, if tracking opposite to the beam direction.
109 bool back_path; // true, if tracking from right (s=C) to left (s=0).
110 // back_path = back_beam && ! back_track || back_track && ! back_beam.
111
112 double flip_B; // set to -1.0 to flip B fields, when back_beam is true.
113 double flip_s; // set to -1.0 to flip direction of s,
114 // when back_path is true.
115
116private:
117 // Not implemented.
121
122 // Default do-nothing routine.
123 virtual void applyDefault(const ElementBase&);
124
125 // The element order flag. Initially set to back_path.
126 // This flag is reversed locally for reflected beam lines.
128};
129
130#endif // CLASSIC_DefaultVisitor_HH
Interface for a single beam element.
Definition Component.h:50
Interface for drift space.
Definition Drift.h:31
Interface for a marker.
Definition Marker.h:32
Interface for general multipole.
Definition Multipole.h:45
Definition Probe.h:28
Ring describes a ring type geometry for tracking.
Definition Ring.h:62
Interface for solenoids.
Definition Solenoid.h:34
virtual void visitProbe(const Probe &prob)
Apply the algorithm to a Probe.
virtual ~DefaultVisitor()=0
virtual void visitOffset(const Offset &)
Apply the algorithm to an offset (placement).
virtual void visitDrift(const Drift &)
Apply the algorithm to a drift space.
virtual void visitComponent(const Component &)
Apply the algorithm to an arbitrary component.
virtual void visitRFCavity(const RFCavity &)
Apply the algorithm to a RF cavity.
void operator=(const DefaultVisitor &)
virtual void visitMarker(const Marker &)
Apply the algorithm to a marker.
virtual void visitMultipoleTCurvedVarRadius(const MultipoleTCurvedVarRadius &)
Apply the algorithm to an arbitrary curved multipole of variable radius.
virtual void visitTravelingWave(const TravelingWave &)
Apply the algorithm to a traveling wave.
virtual void visitMultipoleTCurvedConstRadius(const MultipoleTCurvedConstRadius &)
Apply the algorithm to an arbitrary curved multipole of constant radius.
virtual void visitMonitor(const Monitor &)
Apply the algorithm to a beam position monitor.
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)
Apply the algorithm to a FlaggedElmPtr.
virtual void applyDefault(const ElementBase &)
DefaultVisitor(const DefaultVisitor &)
virtual void visitSolenoid(const Solenoid &)
Apply the algorithm to a Solenoid.
DefaultVisitor(const Beamline &beamline, bool backBeam, bool backTrack)
Constructor.
virtual void visitScalingFFAMagnet(const ScalingFFAMagnet &spiral)
Apply the algorithm to a scaling FFA magnet.
const Beamline & itsLine
virtual void visitBeamline(const Beamline &)
Apply the algorithm to a beam line.
virtual void visitMultipoleT(const MultipoleT &)
Apply the algorithm to to an arbitrary multipole.
virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet &)
Apply the algorithm to a vertical FFA magnet.
virtual void visitMultipole(const Multipole &)
Apply the algorithm to a multipole.
virtual void execute()
Apply the algorithm to the top-level beamline.
virtual void visitRing(const Ring &)
Apply the algorithm to a Ring.
virtual void visitMultipoleTStraight(const MultipoleTStraight &)
Apply the algorithm to an arbitrary straight multipole.
An abstract sequence of beam line components.
Definition Beamline.h:34
A section of a beam line.