OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Surveyor.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: Surveyor.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.3 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: Surveyor
10 // The visitor class for printing the survey of a beamline.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: Algorithms
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/05/03 08:16:05 $
17 // $Author: mad $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "Algorithms/Surveyor.h"
23 #include "AbsBeamline/Patch.h"
24 
25 
26 // Class Surveyor
27 // ------------------------------------------------------------------------
28 
29 Surveyor::Surveyor(Beamline &beamline, bool revTrack):
30  DefaultVisitor(beamline, false, revTrack),
31  itsMap()
32 {}
33 
34 
35 Surveyor::Surveyor(Beamline &beamline, double x0, double y0, double z0,
36  double theta0, double phi0, double psi0,
37  bool revTrack):
38  DefaultVisitor(beamline, false, revTrack),
39  itsMap(x0, y0, z0, theta0, phi0, psi0)
40 {}
41 
42 
43 Surveyor::Surveyor(Beamline &beamline, const Euclid3D &init, bool revTrack):
44  DefaultVisitor(beamline, false, revTrack), itsMap(init)
45 {}
46 
47 
49 {}
50 
51 
52 void Surveyor::getMap(Euclid3D &map) const {
53  map = itsMap;
54 }
55 
56 
57 void Surveyor::setMap(const Euclid3D &map) {
58  itsMap = map;
59 }
60 
61 
62 void Surveyor::visitPatch(const Patch &patch) {
63  Euclid3D elementMap = patch.getPatch();
64  if(back_path) elementMap = Inverse(elementMap);
65  itsMap.dotBy(elementMap);
66 }
67 
68 
69 void Surveyor::applyDefault(const ElementBase &element) {
70  Euclid3D elementMap = element.getGeometry().getTotalTransform();
71  if(back_path) elementMap = Inverse(elementMap);
72  itsMap.dotBy(elementMap);
73 }
virtual ~Surveyor()
Definition: Surveyor.cpp:48
Interface for basic beam line object.
Definition: ElementBase.h:128
Euclid3D itsMap
The accumulated survey map.
Definition: Surveyor.h:82
virtual BGeometryBase & getGeometry()=0
Get geometry.
virtual void applyDefault(const ElementBase &element)
Default action.
Definition: Surveyor.cpp:69
Default algorithms.
Euclid3D Inverse(const Euclid3D &t)
Euclidean inverse.
Definition: Euclid3D.h:204
const Euclid3D & dotBy(const Euclid3D &rhs)
Dot product with assign.
Definition: Euclid3D.cpp:102
virtual Euclid3D getTotalTransform() const
Get transform.
Definition: Geometry.cpp:51
Displacement and rotation in space.
Definition: Euclid3D.h:68
An abstract sequence of beam line components.
Definition: Beamline.h:37
void getMap(Euclid3D &) const
Return accumulated map.
Definition: Surveyor.cpp:52
virtual void visitPatch(const Patch &pat)
Apply the algorithm to a patch.
Definition: Surveyor.cpp:62
void setMap(const Euclid3D &)
Reset accumulated map for restart.
Definition: Surveyor.cpp:57
Interface for a geometric patch.
Definition: Patch.h:34
virtual const Euclid3D & getPatch() const =0
Get patch transform.