OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Survey.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: Survey.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.2.4.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: Survey
10 // The Survey class implements a buffer for survey tables.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2002/12/09 15:06:08 $
15 // $Author: jsberg $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Tables/Survey.h"
27 #include "Attributes/Attributes.h"
28 #include "Algorithms/Surveyor.h"
30 #include "Physics/Physics.h"
31 #include "Tables/Flatten.h"
33 #include "Utilities/Options.h"
34 
35 #include <cmath>
36 #include <iomanip>
37 #include <iostream>
38 #include <sstream>
39 
40 
41 // Local structures.
42 // ------------------------------------------------------------------------
43 
44 namespace {
45 
46  // Describe a column with name and function to get it.
47  struct ColDesc {
48 
49  // The column name.
50  const char *colName;
51 
52  // Method to return the selected column from the given row.
53  double(Survey::*get)(const Survey::Row &, int, int) const;
54 
55  int printWidth;
56  int printPrecision;
57 
58  int ind_1;
59  int ind_2;
60  };
61 
62  // The column entries table.
63  const ColDesc allColumns[] = {
64  { "S", &Survey::getS, 14, 6, 0, 0 },
65 
66  { "X", &Survey::getX, 10, 6, 0, 0 },
67  { "Y", &Survey::getY, 10, 6, 0, 0 },
68  { "Z", &Survey::getZ, 10, 6, 0, 0 },
69 
70  { "THETA", &Survey::getTheta, 14, 10, 0, 0 },
71  { "PHI", &Survey::getPhi, 14, 10, 0, 0 },
72  { "PSI", &Survey::getPsi, 14, 10, 0, 0 },
73 
74  { "W11", &Survey::getW, 10, 6, 1, 1 },
75  { "W21", &Survey::getW, 10, 6, 2, 1 },
76  { "W31", &Survey::getW, 10, 6, 3, 1 },
77  { "W12", &Survey::getW, 10, 6, 1, 2 },
78  { "W22", &Survey::getW, 10, 6, 2, 2 },
79  { "W32", &Survey::getW, 10, 6, 3, 2 },
80  { "W13", &Survey::getW, 10, 6, 1, 3 },
81  { "W23", &Survey::getW, 10, 6, 2, 3 },
82  { "W33", &Survey::getW, 10, 6, 3, 3 },
83 
84  { 0, 0, 0, 0, 0, 0 }
85  };
86 
87 
88  // The print column entries table.
89  const ColDesc printColumns[] = {
90  { "S", &Survey::getS, 14, 6, 0, 0 },
91 
92  { "X", &Survey::getX, 10, 6, 0, 0 },
93  { "Y", &Survey::getY, 10, 6, 0, 0 },
94  { "Z", &Survey::getZ, 10, 6, 0, 0 },
95 
96  { "THETA", &Survey::getTheta, 14, 10, 0, 0 },
97  { "PHI", &Survey::getPhi, 14, 10, 0, 0 },
98  { "PSI", &Survey::getPsi, 14, 10, 0, 0 },
99 
100  { 0, 0, 0, 0, 0, 0 }
101  };
102 
103 
104  // Find a column by name.
105  const ColDesc *findCol(const Survey &table, const std::string &colName) {
106  for(const ColDesc *col = allColumns; col->colName; ++col) {
107  if(colName == col->colName) {
108  return col;
109  }
110  }
111 
112  throw OpalException("Survey::findCol()",
113  "Survey table \"" + table.getOpalName() +
114  "\" has no column named \"" + colName + "\".");
115  }
116 
117 
118  // Local class Column.
119  // Returns the value for a given column in the current row of a given
120  // table.
121  class Column: public Expressions::Scalar<double> {
122 
123  public:
124 
125  //: Constructor.
126  // Identify the table by its name [b]tab[/b], and the column by its
127  // name [b]col[/b] and the function [b]col[/b].
128  // The row is specified as the ``current'' row of the table.
129  Column(const Survey &tab, const std::string &scol, const ColDesc &col);
130 
131  Column(const Column &);
132  virtual ~Column();
133 
134  //: Make clone.
135  virtual Expressions::Scalar<double> *clone() const;
136 
137  //: Evaluate.
138  virtual double evaluate() const;
139 
140  //: Print expression.
141  virtual void print(std::ostream &os, int precedence = 99) const;
142 
143  private:
144 
145  // Not implemented.
146  Column();
147  const Column &operator=(const Column &);
148 
149  // The Table referred.
150  const Survey &itsTable;
151 
152  // Column name.
153  std::string colName;
154 
155  // The function returning the column value from the given row.
156  double(Survey::*get)(const Survey::Row &, int, int) const;
157 
158  // Indices for calling get().
159  int ind_1, ind_2;
160  };
161 
162 
163  // Implementation.
164  // ------------------------------------------------------------------------
165 
166  Column::Column(const Survey &tab,
167  const std::string &name,
168  const ColDesc &desc):
169  itsTable(tab),
170  colName(name),
171  get(desc.get),
172  ind_1(desc.ind_1),
173  ind_2(desc.ind_2)
174  {}
175 
176 
177  Column::Column(const Column &rhs):
178  Scalar<double>(rhs),
179  itsTable(rhs.itsTable),
180  colName(rhs.colName),
181  get(rhs.get),
182  ind_1(rhs.ind_1),
183  ind_2(rhs.ind_2)
184  {}
185 
186 
187  Column::~Column()
188  {}
189 
190 
191  Expressions::Scalar<double> *Column::clone() const {
192  return new Column(*this);
193  }
194 
195 
196  double Column::evaluate() const {
197  // Apply the function to the current row of the table.
198  return (itsTable.*get)(itsTable.getCurrent(), ind_1, ind_2);
199  }
200 
201 
202  void Column::print(std::ostream &os, int) const {
203  os << colName;
204  }
205 };
206 
207 
208 // Class Survey::Row
209 // ------------------------------------------------------------------------
210 
211 Survey::Row::Row(ElementBase *elem, int occur):
212  FlaggedElmPtr(elem) {
213  setCounter(occur);
214 }
215 
216 
218  FlaggedElmPtr(rhs)
219 {}
220 
221 
223 {}
224 
225 
226 double Survey::Row::getS() const {
227  return s;
228 }
229 
230 
232  return euclid;
233 }
234 
235 
236 // Class Survey
237 // ------------------------------------------------------------------------
238 
239 // The attributes of class Survey.
240 namespace {
241  enum {
242  LINE, // The lattice to be used.
243  RANGE, // The range in the lattice.
244  STATIC, // The flag for suppressing recalculation.
245  INIT, // If given, take initial values from another table.
246  X0, // The initial position X.
247  Y0, // The initial position Y.
248  Z0, // The initial position Z.
249  THETA0, // The initial azimuth THETA.
250  PHI0, // The initial elevation PHI.
251  PSI0, // The initial roll PSI.
252  L, // Sum of design lengths.
253  SIZE
254  };
255 }
256 
257 
259  Table(SIZE, "SURVEY",
260  "The \"SURVEY\" command defines a table of survey data which "
261  "can be matched or tabulated."),
262  itsTable(0), itsVisitor(0) {
264  ("LINE", "Name of the lattice to be surveyed");
266  ("RANGE", "The range in the lattice");
267  itsAttr[STATIC] = Attributes::makeBool
268  ("STATIC", "If true, the table is not recalculated at each iteration");
270  ("INIT", "If given, this table position is used to initialise");
272  ("X0", "Initial X position in m");
274  ("Y0", "Initial Y position in m");
276  ("Z0", "Initial Z position in m");
277  itsAttr[THETA0] = Attributes::makeReal
278  ("THETA0", "Initial azimuth angle in rad");
280  ("PHI0", "Initial pitch angle in rad");
282  ("PSI0", "Initial roll angle in rad");
283 
284  // READ ONLY.
286  ("L", "Sum of design lengths in m");
287  itsAttr[L].setReadOnly(true);
288 
290 }
291 
292 
293 Survey::Survey(const std::string &name, Survey *parent):
294  Table(name, parent), itsTable(new TLine(name)), itsVisitor(0)
295 {}
296 
297 
299  delete itsTable;
300  delete itsVisitor;
301 }
302 
303 
304 Survey *Survey::clone(const std::string &name) {
305  return new Survey(name, this);
306 }
307 
308 
310  // Find BeamSequence definition.
313 
314  // Make sure all is up-to-date.
316 
317  // Create flat list with space for data storage.
318  RangeRep range = Attributes::getRange(itsAttr[RANGE]);
319  Flatten<Row> flattener(*use->fetchLine(), *itsTable, range);
320  flattener.execute();
321 
322  if(itsTable->empty() && Options::warn) {
323  std::cerr << "\n### Warning ### Survey table \"" << getOpalName()
324  << "\" contains no elements.\n" << std::endl;
325  } else {
326  itsTable->front().setSelectionFlag(true);
327  itsTable->back().setSelectionFlag(true);
328  }
329 
330  // Fill the table.
331  itsVisitor = new Surveyor(*itsTable, false);
332  fill();
333 
334  // Set static flag.
335  if(Attributes::getBool(itsAttr[STATIC])) dynamic = false;
336  printTable(std::cout, getDefault());
337 }
338 
339 
340 void Survey::fill() {
341  if(refill) {
342  // Reset the surveyor.
343  double x, y, z, phi, theta, psi;
344  if(itsAttr[INIT]) {
346  Table *init = Table::find(rowrep.getTabName());
347 
348  if(matches(init)) {
349  PlaceRep pinit = rowrep.getPosition();
350  Survey *sinit = dynamic_cast<Survey *>(init);
351  sinit->fill();
352  const Row &row = sinit->findRow(pinit);
353  itsVisitor->setMap(sinit->getMap(row));
354  } else {
355  throw OpalException("Survey::fill()", "Table \"" + rowrep.getTabName() +
356  "\" is not suitable for initialising survey \"" +
357  getOpalName() + "\".");
358  }
359  } else {
360  x = Attributes::getReal(itsAttr[X0]);
361  y = Attributes::getReal(itsAttr[Y0]);
362  z = Attributes::getReal(itsAttr[Z0]);
363  phi = Attributes::getReal(itsAttr[PHI0]);
364  theta = Attributes::getReal(itsAttr[THETA0]);
365  psi = Attributes::getReal(itsAttr[PSI0]);
366 
367  // Use the OPAL-8 conventions.
368  Rotation3D rot = Rotation3D::YRotation(theta) *
370  itsVisitor->setMap(Euclid3D(Vector3D(x, y, z), rot));
371  }
372 
373  s = 0.0;
374 
375  for(TLine::iterator i = itsTable->begin(); i != itsTable->end(); ++i) {
376  // Advance through element.
377  i->accept(*itsVisitor);
378 
379  // Update accumulated length.
380  ElementBase &elem = *i->getElement();
381  if(! dynamic_cast<Beamline *>(&elem)) {
382  s += elem.getElementLength();
383  }
384 
385  // Copy row to table line.
386  itsVisitor->getMap(i->euclid);
387  i->s = s;
388  }
389 
390  Euclid3D map;
391  itsVisitor->getMap(map);
392  map.getAll(x, y, z, phi, theta, psi);
394  refill = false;
395  }
396 }
397 
398 
399 const Survey::Row &Survey::findRow(const PlaceRep &place) {
400  PlaceRep row(place);
401  row.initialize();
402  for(TLine::const_iterator i = itsTable->begin();
403  i != itsTable->end(); ++i) {
404  row.enter(*i);
405  if(row.isActive()) return *i;
406  row.leave(*i);
407  }
408 
409  std::ostringstream os;
410  os << row << std::ends;
411  throw OpalException("Survey::setRow()", "Row \"" + os.str() +
412  "\" not found in survey table \"" + getOpalName() + "\".");
413 }
414 
415 
416 double Survey::getCell(const PlaceRep &place, const std::string &name) {
417  const Row &row = findRow(place);
418  const ColDesc *col = findCol(*this, name);
419  return (this->*(col->get))(row, col->ind_1, col->ind_2);
420 }
421 
422 
424  CellArray columns;
425  for(const ColDesc *col = printColumns; col->colName; ++col) {
427  new Column(*this, col->colName, *col);
428  columns.push_back(Cell(expr, col->printWidth, col->printPrecision));
429  }
430  return columns;
431 }
432 
433 
434 std::vector<double> Survey::getColumn(const RangeRep &rng, const std::string &name) {
435  // Find proper column function.
436  const ColDesc *col = findCol(*this, name);
437  RangeRep range(rng);
438  range.initialize();
439  std::vector<double> column;
440 
441  for(current = itsTable->begin(); current != itsTable->end(); ++current) {
442  range.enter(*current);
443  if(range.isActive()) {
444  column.push_back((this->*(col->get))(*current, col->ind_1, col->ind_2));
445  }
446  range.leave(*current);
447  }
448 
449  return column;
450 }
451 
452 
454  return *current;
455 }
456 
457 
459  return itsTable->getElementLength();
460 }
461 
462 
463 const Beamline *Survey::getLine() const {
464  return itsTable;
465 }
466 
467 
468 std::vector<double>
469 Survey::getRow(const PlaceRep &pos, const std::vector<std::string> &columns) {
470  const Row &row = findRow(pos);
471  std::vector<double> result;
472 
473  if(columns.empty()) {
474  // Standard column selection.
475  for(const ColDesc *col = printColumns; col->colName != 0; ++col) {
476  result.push_back((this->*(col->get))(row, col->ind_1, col->ind_2));
477  }
478  } else {
479  // User column selection.
480  for(std::vector<std::string>::const_iterator name = columns.begin();
481  name != columns.end(); ++name) {
482  const ColDesc *col = findCol(*this, *name);
483  result.push_back((this->*(col->get))(row, col->ind_1, col->ind_2));
484  }
485  }
486 
487  return result;
488 }
489 
490 
491 bool Survey::isDependent(const std::string &name) const {
492  // Test if name refers to LINE attribute.
493  if(itsLine == name) return true;
494 
495  // Test if name occurs in table.
496  for(TLine::const_iterator i = itsTable->begin(); i != itsTable->end(); ++i) {
497  if(i->getElement()->getName() == name) return true;
498  }
499 
500  // Otherwise replacement is not required.
501  return false;
502 }
503 
504 
506 Survey::makeColumnExpression(const std::string &colName) const {
507  return new Column(*this, colName, *findCol(*this, colName));
508 }
509 
510 
511 bool Survey::matches(Table *rhs) const {
512  return dynamic_cast<Survey *>(rhs) != 0;
513 }
514 
515 
516 void Survey::printTable(std::ostream &os, const CellArray &cells) const {
517  // Write table specific header.
519  os << '\n';
520  os << "Geometric layout for line: " << itsAttr[LINE]
521  << ", range: " << itsAttr[RANGE] << "." << '\n';
522 
523  // Find line length.
524  int lineLength = 16;
525  for(CellArray::const_iterator cell = cells.begin();
526  cell < cells.end(); ++cell) {
527  lineLength += cell->printWidth;
528  }
529  os << std::string(lineLength, '-') << '\n';
530 
531  // Print table header.
532  os << "Element ";
533  for(CellArray::const_iterator cell = cells.begin();
534  cell < cells.end(); ++cell) {
535  std::ostringstream ss;
536  cell->itsExpr->print(ss, 0);
537  ss << std::ends;
538  std::string image = ss.str();
539 
540  if(int(image.length()) < cell->printWidth) {
541  // Right adjust the column header.
542  os << std::string(cell->printWidth - image.length(), ' ') << image;
543  } else {
544  // Truncate the column header.
545  os << ' ' << std::string(image, 0, cell->printWidth - 3) << "..";
546  }
547  }
548  os << '\n';
549  os << std::string(lineLength, '-') << '\n';
550 
551  // Save the formatting flags.
552  std::streamsize old_prec = os.precision(6);
553  os.setf(std::ios::fixed, std::ios::floatfield);
554 
555  // Write table body.
556  for(current = itsTable->begin(); current != itsTable->end(); ++current) {
557  if(current->getSelectionFlag()) {
558  std::string name = current->getElement()->getName();
559  if(int occur = current->getCounter()) {
560  std::ostringstream tos;
561  tos << name << '[' << occur << ']' << std::ends;
562  name = tos.str();
563  }
564 
565  if(name.length() > 16) {
566  // Truncate the element name.
567  os << std::string(name, 0, 13) << ".. ";
568  } else {
569  // Left adjust the element name.
570  os << name << std::string(16 - name.length(), ' ');
571  }
572 
573  for(CellArray::const_iterator cell = cells.begin();
574  cell != cells.end(); ++cell) {
575  os << std::setw(cell->printWidth)
576  << std::setprecision(cell->printPrecision)
577  << cell->itsExpr->evaluate();
578  }
579  os << '\n';
580  }
581  }
582 
583  // Write table specific summary.
584  os << std::string(lineLength, '-') << '\n';
585 
586  // Restore the formatting flags.
587  os.precision(old_prec);
588  os.setf(std::ios::fixed, std::ios::floatfield);
589 }
590 
591 
592 double Survey::getS(const Survey::Row &row, int, int) const {
593  return current->getS();
594 }
595 
596 
597 const Euclid3D &Survey::getMap(const Survey::Row &row) const {
598  return row.getMap();
599 }
600 
601 
602 double Survey::getX(const Survey::Row &row, int, int) const {
603  return row.getMap().getX();
604 }
605 
606 
607 double Survey::getY(const Survey::Row &row, int, int) const {
608  return row.getMap().getY();
609 }
610 
611 
612 double Survey::getZ(const Survey::Row &row, int, int) const {
613  return row.getMap().getZ();
614 }
615 
616 
617 double Survey::getPhi(const Survey::Row &row, int, int) const {
618  const Rotation3D &rot = row.getMap().getRotation();
619  return atan2(rot(1, 2), sqrt(rot(1, 0) * rot(1, 0) + rot(1, 1) * rot(1, 1)));
620 }
621 
622 
623 double Survey::getTheta(const Survey::Row &row, int, int) const {
624  const Rotation3D &rot = row.getMap().getRotation();
625  double arg = std::abs(rot(0, 2)) + std::abs(rot(2, 2));
626  return (arg > 1.0e-10) ? atan2(rot(0, 2), rot(2, 2)) : 0.0;
627 }
628 
629 
630 double Survey::getPsi(const Survey::Row &row, int, int) const {
631  const Rotation3D &rot = row.getMap().getRotation();
632  double arg = std::abs(rot(1, 0)) + std::abs(rot(1, 1));
633  return (arg > 1.0e-10) ? atan2(rot(1, 0), rot(1, 1)) : 0.0;
634 }
635 
636 
637 double Survey::getW(const Survey::Row &row, int ind_1, int ind_2) const {
638  return row.getMap().M(ind_1, ind_2);
639 }
void setReal(Attribute &attr, double val)
Set real value.
Definition: Attributes.cpp:236
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
A scalar expression.
Definition: Expressions.h:79
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
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
bool refill
Refill flag.
Definition: Table.h:158
double getX() const
Get displacement.
Definition: Euclid3D.h:216
virtual void print(std::ostream &, int precedence=99) const =0
Print expression.
constexpr double e
The value of .
Definition: Physics.h:40
Interface for basic beam line object.
Definition: ElementBase.h:128
void operator=(const Scalar &)
Row(ElementBase *, int)
Definition: Survey.cpp:211
TLine::const_iterator current
Definition: Survey.h:170
RangeRep getRange(const Attribute &attr)
Get range value.
Definition: Attributes.cpp:177
virtual bool matches(Table *rhs) const
Check compatibility.
Definition: Survey.cpp:511
void leave(const FlaggedElmPtr &) const
Leave an element or line.
Definition: RangeRep.cpp:81
virtual Survey * clone(const std::string &name)
Make clone.
Definition: Survey.cpp:304
The base class for all OPAL exceptions.
Definition: OpalException.h:28
double getZ() const
Get displacement.
Definition: Euclid3D.h:224
virtual double getElementLength() const
Get design length.
Definition: TBeamline.h:311
void enter(const FlaggedElmPtr &) const
Enter an element or line.
Definition: RangeRep.cpp:71
Attribute makeRange(const std::string &name, const std::string &help)
Create a range attribute.
Definition: Attributes.cpp:171
Flatten a beamline.
Definition: Flatten.h:42
void update()
Update all objects.
Definition: OpalData.cpp:723
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
bool isActive() const
Return status.
Definition: PlaceRep.cpp:98
bool dynamic
Flag dynamic table.
Definition: Table.h:153
const Euclid3D & getMap(const Row &) const
Position and orientation of local system.
Definition: Survey.cpp:597
bool warn
Warn flag.
Definition: Options.cpp:10
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
Representation of a table row reference.
Definition: TableRowRep.h:36
double M(int row, int col) const
Get component.
Definition: Euclid3D.h:228
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
TableRowRep getTableRow(const Attribute &attr)
Get table row value.
Definition: Attributes.cpp:442
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
bool getBool(const Attribute &attr)
Return logical value.
Definition: Attributes.cpp:66
bool isActive() const
Test for active range.
Definition: RangeRep.cpp:66
double s
Definition: Survey.h:179
void printTitle(std::ostream &)
Print the page title.
Definition: OpalData.cpp:705
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
static OpalData * getInstance()
Definition: OpalData.cpp:209
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:284
void initialize()
Initialise data for search.
Definition: RangeRep.cpp:55
static BeamSequence * find(const std::string &name)
Find a BeamSequence by name.
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
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
void getAll(double &x, double &y, double &z, double &vx, double &vy, double &vz) const
Unpack.
Definition: Euclid3D.cpp:52
virtual std::vector< double > getRow(const PlaceRep &, const std::vector< std::string > &)
Return a table row, possible user-defined.
Definition: Survey.cpp:469
void enter(const FlaggedElmPtr &) const
Enter an element or line.
Definition: PlaceRep.cpp:70
virtual const Beamline * getLine() const
Return embedded CLASSIC beamline.
Definition: Survey.cpp:463
void setCounter(int) const
Set clone counter.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition: Object.cpp:194
virtual Beamline * fetchLine() const =0
Return the embedded CLASSIC beam line.
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
virtual Scalar< T > * clone() const =0
Copy scalar expression.
static Table * find(const std::string &name)
Find named Table.
Definition: Table.cpp:41
const Row & getCurrent() const
Return current row of table.
Definition: Survey.cpp:453
static Rotation3D ZRotation(double angle)
Make rotation.
Definition: Rotation3D.cpp:147
PETE_TBTree< FnArcTan2, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > atan2(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
virtual void execute()
Apply the algorithm to the top-level beamline.
Definition: Flatten.h:92
void initialize()
Initialise data for search.
Definition: PlaceRep.cpp:64
Representation of a range within a beam line or sequence.
Definition: RangeRep.h:34
void leave(const FlaggedElmPtr &) const
Leave an element or line.
Definition: PlaceRep.cpp:84
An abstract sequence of beam line components.
Definition: Beamline.h:37
PlaceRep getPosition() const
Return the row position representation.
Definition: TableRowRep.cpp:57
void getMap(Euclid3D &) const
Return accumulated map.
Definition: Surveyor.cpp:52
Attribute makeTableRow(const std::string &name, const std::string &help)
Create a table row attribute.
Definition: Attributes.cpp:437
const Rotation3D & getRotation() const
Get rotation.
Definition: Euclid3D.cpp:64
double getPhi(const Row &, int=0, int=0) const
Rotation about X.
Definition: Survey.cpp:617
arg(a))
const Euclid3D & getMap() const
Return the accumulated geometry transform.
Definition: Survey.cpp:231
Tps< T > sqrt(const Tps< T > &x)
Square root.
Definition: TpsMath.h:91
A 3-dimension vector.
Definition: Vector3D.h:31
The base class for all OPAL beam lines and sequences.
Definition: BeamSequence.h:32
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
static Rotation3D YRotation(double angle)
Make rotation.
Definition: Rotation3D.cpp:139
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
Definition: Attributes.cpp:56
The SURVEY command.
Definition: Survey.h:38
const std::string name
Descriptor for printing a table cell.
Definition: Table.h:47
virtual Expressions::PtrToScalar< double > makeColumnExpression(const std::string &colName) const
Return column.
Definition: Survey.cpp:506
static Rotation3D XRotation(double angle)
Make rotation.
Definition: Rotation3D.cpp:131
virtual T evaluate() const =0
Evaluate.
void setMap(const Euclid3D &)
Reset accumulated map for restart.
Definition: Surveyor.cpp:57
std::string::iterator iterator
Definition: MSLang.h:16
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
const std::string & getTabName() const
Return the table name.
Definition: TableRowRep.cpp:52
The base class for all OPAL tables.
Definition: Table.h:42
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
Rotation in 3-dimensional space.
Definition: Rotation3D.h:46
virtual double getLength()
Return the length of the table.
Definition: Survey.cpp:458
double getY() const
Get displacement.
Definition: Euclid3D.h:220
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:205
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
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
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
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307