OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Mapper.h
Go to the documentation of this file.
1 #ifndef CLASSIC_Mapper_HH
2 #define CLASSIC_Mapper_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Mapper.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Mapper
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Algorithms
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:33 $
19 // $Author: fci $
20 //
21 // ------------------------------------------------------------------------
22 
24 #include "AbsBeamline/Patch.h"
25 #include "FixedAlgebra/FTps.h"
26 #include "FixedAlgebra/FVps.h"
27 #include "Algorithms/PartData.h"
28 
29 class AlignWrapper;
30 class BMultipoleField;
31 class Euclid3D;
32 template <class T, int N> class LinearMap;
33 template <class T, int N> class TransportMap;
34 
35 
36 // Class Mapper
37 // ------------------------------------------------------------------------
39 // An abstract visitor class implementing the default behaviour for all
40 // visitors capable of tracking a transfer map through a beam line.
41 // It implements some default behaviour for such visitors.
42 // [P]
43 // Phase space coordinates (in this order):
44 // [DL]
45 // [DT]x:[DD]
46 // horizontal displacement (metres).
47 // [DT]p_x/p_r:[DD]
48 // horizontal canonical momentum (no dimension).
49 // [DT]y:[DD]
50 // vertical displacement (metres).
51 // [DT]p_y/p_r:[DD]
52 // vertical canonical momentum (no dimension).
53 // [DT]delta_p/p_r:[DD]
54 // relative momentum error (no dimension).
55 // [DT]v*delta_t:[DD]
56 // time difference delta_t w.r.t. the reference frame which moves with
57 // uniform velocity
58 // [P]
59 // v_r = c*beta_r = p_r/m
60 // [P]
61 // along the design orbit, multiplied by the instantaneous velocity v of
62 // the particle (metres).
63 // [/DL]
64 // Where
65 // [DL]
66 // [DT]p_r:[DD]
67 // is the constant reference momentum defining the reference frame velocity.
68 // [DT]m:[DD]
69 // is the rest mass of the particles.
70 // [/DL]
71 // Other units used:
72 // [DL]
73 // [DT]reference momentum:[DD]
74 // electron-volts.
75 // [DT]accelerating voltage:[DD]
76 // volts.
77 // [DT]separator voltage:[DD]
78 // volts.
79 // [DT]frequencies:[DD]
80 // hertz.
81 // [DT]phase lags:[DD]
82 // multiples of (2*pi).
83 // [/DL]
84 
85 class Mapper: public AbstractMapper {
86 
87 public:
88 
90  // The beam line to be tracked is [b]bl[/b].
91  // The particle reference data are taken from [b]data[/b].
92  // If [b]revBeam[/b] is true, the beam runs from s = C to s = 0.
93  // If [b]revTrack[/b] is true, we track against the beam.
94  Mapper(const Beamline &bl, const PartData &data,
95  bool revBeam, bool revTrack);
96 
97  virtual ~Mapper();
98 
100  virtual void getMap(LinearMap<double, 6> &) const;
101 
103  virtual void getMap(TransportMap<double, 6> &) const;
104 
106  virtual void getMap(FVps<double, 6> &) const;
107 
109  virtual void setMap(const LinearMap<double, 6> &);
110 
112  virtual void setMap(const TransportMap<double, 6> &);
113 
115  virtual void setMap(const FVps<double, 6> &);
116 
117 
119  // This override calls the component to track the map.
120  virtual void visitComponent(const Component &);
121 
123  virtual void visitPatch(const Patch &pat);
124 
125 
127  virtual void visitAlignWrapper(const AlignWrapper &);
128 
129 
131  virtual void visitMapIntegrator(const MapIntegrator &);
132 
133 protected:
134 
136  // Propagate current map through a drift.
137  void applyDrift(double length);
138 
140  // Apply a thin multipole kick (integrated over length) to current map.
141  void applyThinMultipole(const BMultipoleField &field, double factor);
142 
144  // Special kick routine for thin SBend.
145  void applyThinSBend(const BMultipoleField &field, double scale, double h);
146 
148  // Propagate current map through a geometric transformation.
149  void applyTransform(const Euclid3D &, double refLength = 0.0);
150 
153 
154 private:
155 
156  // Not implemented.
157  Mapper();
158  Mapper(const Mapper &);
159  void operator=(const Mapper &);
160 };
161 
162 #endif // CLASSIC_Mapper_HH
Build transfer map.
void applyThinSBend(const BMultipoleField &field, double scale, double h)
Thin SBend kick.
Definition: Mapper.cpp:158
Transport map with values of type [b]T[/b] in [b]N[/b] variables.
Definition: Mapper.h:33
virtual void visitAlignWrapper(const AlignWrapper &)
Apply the algorithm to an align wrapper.
Definition: Mapper.cpp:91
void operator=(const Mapper &)
Define the position of a misaligned element.
Definition: AlignWrapper.h:39
Particle reference data.
Definition: PartData.h:38
virtual void visitComponent(const Component &)
Apply the algorithm to an arbitrary component.
Definition: Mapper.cpp:79
Linear map with values of type [b]T[/b] in [b]N[/b] variables.
Displacement and rotation in space.
Definition: Euclid3D.h:68
void applyThinMultipole(const BMultipoleField &field, double factor)
Thin multipole kick.
Definition: Mapper.cpp:135
Build transfer map.
Definition: Mapper.h:85
An abstract sequence of beam line components.
Definition: Beamline.h:37
virtual void getMap(LinearMap< double, 6 > &) const
Return the linear part of the accumulated map.
Definition: Mapper.cpp:49
virtual void setMap(const LinearMap< double, 6 > &)
Reset the linear part of the accumulated map for restart.
Definition: Mapper.cpp:64
virtual void visitPatch(const Patch &pat)
Apply the algorithm to a patch.
Definition: Mapper.cpp:84
void applyTransform(const Euclid3D &, double refLength=0.0)
Apply transform.
Definition: Mapper.cpp:168
The magnetic field of a multipole.
virtual ~Mapper()
Definition: Mapper.cpp:45
Interface for a geometric patch.
Definition: Patch.h:34
virtual void visitMapIntegrator(const MapIntegrator &)
Apply the algorithm to an integrator capable of mapping.
Definition: Mapper.cpp:113
Interface for a single beam element.
Definition: Component.h:51
FVps< double, 6 > itsMap
The transfer map being built.
Definition: Mapper.h:152
void applyDrift(double length)
Apply drift length.
Definition: Mapper.cpp:118
Integrate a map.
Definition: MapIntegrator.h:41