OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Survey.h
Go to the documentation of this file.
1 #ifndef OPAL_Survey_HH
2 #define OPAL_Survey_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Survey.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.2 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Survey
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2001/08/13 15:25:22 $
17 // $Author: jowett $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "AbstractObjects/Table.h"
25 #include "Beamlines/TBeamline.h"
26 #include <iosfwd>
27 #include <vector>
28 
29 class PlaceRep;
30 class RangeRep;
31 class Surveyor;
32 
33 
34 // Class Survey
35 // ------------------------------------------------------------------------
37 
38 class Survey: public Table {
39 
40 public:
41 
43  class Row: public FlaggedElmPtr {
44 
45  friend class ::Survey;
46 
47  public:
48 
49  Row(ElementBase *, int);
50  explicit Row(const FlaggedElmPtr &);
51  ~Row();
52 
54  const Euclid3D &getMap() const;
55 
57  double getS() const;
58 
59  private:
60 
63 
65  double s;
66  };
67 
69  Survey();
70 
71  virtual ~Survey();
72 
74  virtual Survey *clone(const std::string &name);
75 
77  virtual void execute();
78 
80  virtual void fill();
81 
83  virtual double getCell(const PlaceRep &row, const std::string &col);
84 
86  virtual CellArray getDefault() const;
87 
89  virtual std::vector<double>
90  getColumn(const RangeRep &range, const std::string &col);
91 
93  const Row &getCurrent() const;
94 
95 
97  virtual double getLength();
98 
100  virtual const Beamline *getLine() const;
101 
103  virtual std::vector<double>
104  getRow(const PlaceRep &, const std::vector<std::string> &);
105 
106 
108  double getS(const Row &, int = 0, int = 0) const;
109 
111  const Euclid3D &getMap(const Row &) const;
112 
114  double getX(const Row &, int = 0, int = 0) const;
115 
117  double getY(const Row &, int = 0, int = 0) const;
118 
120  double getZ(const Row &, int = 0, int = 0) const;
121 
123  double getPhi(const Row &, int = 0, int = 0) const;
124 
126  double getTheta(const Row &, int = 0, int = 0) const;
127 
129  double getPsi(const Row &, int = 0, int = 0) const;
130 
132  // First index (1 ... 3) is coordinate, second index (1 ... 3) is vector.
133  double getW(const Row &, int i1, int i2) const;
134 
135 
137  // Return true, if this table depends on the named object.
138  virtual bool isDependent(const std::string &name) const;
139 
141  // Return an expression which denotes the selected column,
142  // identified by its name.
144  makeColumnExpression(const std::string &colName) const;
145 
147  // True, if [b]rhs[/b] is a survey table.
148  virtual bool matches(Table *rhs) const;
149 
151  virtual void printTable(std::ostream &, const CellArray &) const;
152 
153 private:
154 
155  // Not implemented.
156  Survey(const Survey &);
157  void operator=(const Survey &);
158 
159  // Clone constructor.
160  Survey(const std::string &name, Survey *parent);
161 
162 
163  // Set the current table row for a given place specification.
164  const Row &findRow(const PlaceRep &row);
165 
166  // The contained beamline type.
168 
169  // Access to current table row.
170  mutable TLine::const_iterator current;
171 
172  // The table contents.
174 
175  // The algorithm for filling the buffer.
177 
178  // Current accumulated design length.
179  double s;
180 
181  // The name of the surveyed line.
182  std::string itsLine;
183 
185  static const int numColumns = 7;
186 };
187 
188 #endif // OPAL_Survey_HH
static const int numColumns
Number of table columns.
Definition: Survey.h:185
std::vector< Cell > CellArray
An array of cell descriptors.
Definition: Table.h:63
virtual void execute()
Check validity of survey definition.
Definition: Survey.cpp:309
virtual double getCell(const PlaceRep &row, const std::string &col)
Return a selected value in a selected row.
Definition: Survey.cpp:416
double getZ(const Row &, int=0, int=0) const
Z component of displacement.
Definition: Survey.cpp:612
virtual bool isDependent(const std::string &name) const
Find dependency.
Definition: Survey.cpp:491
Interface for basic beam line object.
Definition: ElementBase.h:128
Row(ElementBase *, int)
Definition: Survey.cpp:211
TLine::const_iterator current
Definition: Survey.h:170
virtual bool matches(Table *rhs) const
Check compatibility.
Definition: Survey.cpp:511
virtual Survey * clone(const std::string &name)
Make clone.
Definition: Survey.cpp:304
Euclid3D euclid
The accumulated geometry transform.
Definition: Survey.h:62
const Euclid3D & getMap(const Row &) const
Position and orientation of local system.
Definition: Survey.cpp:597
virtual std::vector< double > getColumn(const RangeRep &range, const std::string &col)
Return column [b]col[/b] of this table, limited by [b]range[/b].
Definition: Survey.cpp:434
virtual CellArray getDefault() const
Return the default print columns.
Definition: Survey.cpp:423
double getPsi(const Row &, int=0, int=0) const
Rotation about Z.
Definition: Survey.cpp:630
The class for one row of the survey table.
Definition: Survey.h:43
Survey()
Exemplar constructor.
Definition: Survey.cpp:258
virtual ~Survey()
Definition: Survey.cpp:298
std::string itsLine
Definition: Survey.h:182
double s
Definition: Survey.h:179
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
double getX(const Row &, int=0, int=0) const
X component of displacement.
Definition: Survey.cpp:602
double getY(const Row &, int=0, int=0) const
Y component of displacement.
Definition: Survey.cpp:607
double getS() const
Return the accumulated length.
Definition: Survey.cpp:226
TBeamline< Row > TLine
Definition: Survey.h:167
virtual std::vector< double > getRow(const PlaceRep &, const std::vector< std::string > &)
Return a table row, possible user-defined.
Definition: Survey.cpp:469
void operator=(const Survey &)
virtual const Beamline * getLine() const
Return embedded CLASSIC beamline.
Definition: Survey.cpp:463
Displacement and rotation in space.
Definition: Euclid3D.h:68
double getW(const Row &, int i1, int i2) const
Local axis vectors.
Definition: Survey.cpp:637
const Row & getCurrent() const
Return current row of table.
Definition: Survey.cpp:453
double s
The accumulated length.
Definition: Survey.h:65
Representation of a range within a beam line or sequence.
Definition: RangeRep.h:34
An abstract sequence of beam line components.
Definition: Beamline.h:37
double getPhi(const Row &, int=0, int=0) const
Rotation about X.
Definition: Survey.cpp:617
const Euclid3D & getMap() const
Return the accumulated geometry transform.
Definition: Survey.cpp:231
const Row & findRow(const PlaceRep &row)
Definition: Survey.cpp:399
Surveyor * itsVisitor
Definition: Survey.h:176
double getTheta(const Row &, int=0, int=0) const
Rotation about Y.
Definition: Survey.cpp:623
virtual void fill()
Fill the buffer using the survey algorithm.
Definition: Survey.cpp:340
The SURVEY command.
Definition: Survey.h:38
const std::string name
virtual Expressions::PtrToScalar< double > makeColumnExpression(const std::string &colName) const
Return column.
Definition: Survey.cpp:506
The base class for all OPAL tables.
Definition: Table.h:42
virtual double getLength()
Return the length of the table.
Definition: Survey.cpp:458
TLine * itsTable
Definition: Survey.h:173
virtual void printTable(std::ostream &, const CellArray &) const
Print list for the table.
Definition: Survey.cpp:516
Survey algorithm.
Definition: Surveyor.h:32
double getS(const Row &, int=0, int=0) const
Arc length for given row.
Definition: Survey.cpp:592
A section of a beam line.
Definition: FlaggedElmPtr.h:36