OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
StraightGeometry.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: StraightGeometry.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: StraightGeometry
10 // A concrete geometry representing a straight line segment which runs
11 // coaxial with the local z-axis.
12 //
13 // ------------------------------------------------------------------------
14 // Class category: BeamlineGeometry
15 // ------------------------------------------------------------------------
16 //
17 // $Date: 2000/03/27 09:32:34 $
18 // $Author: fci $
19 //
20 // ------------------------------------------------------------------------
21 
25 
26 #include <algorithm>
27 
28 // Class StraightGeometry.
29 // ------------------------------------------------------------------------
30 
32 {}
33 
34 
36  return len;
37 }
38 
39 
41  return len;
42 }
43 
44 
46  if (l < 0.0) {
47  throw GeneralClassicException("StraightGeometry::setElementLength",
48  "The length of an element has to be positive");
49  }
50  len = std::max(0.0, l);
51 }
52 
53 
55  return len / 2.0;
56 }
57 
58 
60  return -len / 2.0;
61 }
62 
63 
64 double StraightGeometry::getExit() const {
65  return len / 2.0;
66 }
67 
68 
69 Euclid3D StraightGeometry::getTransform(double fromS, double toS) const {
70  return Euclid3D::translation(0, 0, fromS - toS);
71 }
72 
73 
75  return Euclid3D::translation(0, 0, len);
76 }
77 
78 
80  return Euclid3D::translation(0, 0, s);
81 }
82 
83 
85  return Euclid3D::translation(0, 0, -len / 2.0);
86 }
87 
88 
90  return Euclid3D::translation(0, 0, len / 2.0);
91 }
double getExit() const
Get exit.
double getEntrance() const
Get entrance.
virtual double getElementLength() const
Get design length.
Euclid3D getTotalTransform() const
Get transform.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:84
static Euclid3D translation(double x, double y, double z)
Make translation.
Definition: Euclid3D.cpp:152
Displacement and rotation in space.
Definition: Euclid3D.h:68
Euclid3D getExitFrame() const
Get transform.
double getOrigin() const
Get origin.
Euclid3D getTransform(double fromS, double toS) const
Get transform.
virtual double getArcLength() const
Get arc length.
virtual ~StraightGeometry()
virtual void setElementLength(double length)
Set design length.
Euclid3D getEntranceFrame() const
Get transform.