OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
PlanarArcGeometry.h
Go to the documentation of this file.
1#ifndef CLASSIC_PlanarArcGeometry_HH
2#define CLASSIC_PlanarArcGeometry_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: PlanarArcGeometry.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: PlanarArcGeometry
13//
14// ------------------------------------------------------------------------
15// Class category: BeamlineGeometry
16// ------------------------------------------------------------------------
17//
18// $Date: 2000/03/27 09:32:34 $
19// $Author: fci $
20//
21// ------------------------------------------------------------------------
22
24
25// Class PlanarArcGeometry
26// ------------------------------------------------------------------------
28// A PlanarArcGeometry object represents a Geometry which is as simple
29// circular arc in the local XZ plane with no torsion. The origin is
30// defined at the centre of the geometry, and the geometry extends
31// from -length/2 to +length/2. Transformations generated by this
32// geometry are characterised by a displacement in the XZ plane and a
33// pure Y rotation.
34// [p]
35// This geometry can have two states:
36// [ul]
37// [li]Length L is non-zero:
38// The geometry is defined as a finite arc in the XZ plane.
39// In this state, the following changes are allowed:
40// [ul]
41// [li]Setting the angle phi: recompute the curvature as phi / L.
42// [li]Setting the curvature h: recompute the angle as h * L.
43// [li]Setting the length: if non-zero, recompute the angle as h * L,
44// otherwise set h to zero.
45// [/ul]
46// [li]Length is zero, implying curvature also zero:
47// The geometry is defined as sharp bend by phi in the XZ plane.
48// In this state, the following changes are allowed:
49// [ul]
50// [li]Setting the angle phi: leave both h and L as zero.
51// [li]Setting the curvature h: not accepted.
52// [li]Setting the length: if non-zero, recompute the angle as h * L.
53// [/ul]
54// [/ul]
55
57public:
58
60 // Build PlanarArcGeometry from length [b]l[/b] and curvature [b]h[/b].
61 PlanarArcGeometry(double l, double h);
62
64 // Build PlanarArcGeometry from length zero and angle [b]phi[/b].
65 PlanarArcGeometry(double phi);
66
68 virtual ~PlanarArcGeometry();
70
72 // Return arc length along the design arc.
73 virtual double getArcLength() const;
74
76 // Return element length measured along the design arc.
77 virtual double getElementLength() const;
78
80 double getBendAngle() const;
81
83 double getCurvature() const;
84
86 virtual void setBendAngle(double);
87
89 void setCurvature(double);
90
92 // Assign the arc length for this class.
93 virtual void setElementLength(double);
94
96 // Return the distance from the entrance of the geometry to the origin
97 // (non-negative).
98 virtual double getOrigin() const;
99
101 // Return the arc length from the origin to the entrance of the
102 // geometry (non-positive).
103 double getEntrance() const;
104
106 // Return the arc length from the origin to the exit of the
107 // geometry (non-negative).
108 double getExit() const;
109
111 // Return the transform of the local coordinate system from the
112 // position [b]fromS[/b] to the position [b]toS[/b].
113 virtual Euclid3D getTransform(double fromS, double toS) const;
114
116 // Equivalent to getTransform(0.0, s).
117 // Return the transform of the local coordinate system from the
118 // origin and [b]s[/b].
119 virtual Euclid3D getTransform(double s) const;
120
122 // Equivalent to getTransform(getEntrance(), getExit()).
123 // Return the transform of the local coordinate system from the
124 // entrance to the exit of the element.
125 virtual Euclid3D getTotalTransform() const;
126
128 // Equivalent to getTransform(0.0, getEntrance()).
129 // Return the transform of the local coordinate system from the
130 // origin to the entrance of the element.
132
134 // Equivalent to getTransform(0.0, getExit()).
135 // Return the transform of the local coordinate system from the
136 // origin to the exit of the element.
137 Euclid3D getExitFrame() const;
138
139private:
140
141 double len;
142 double h;
143 double angle;
144};
145
146// inlined (trivial) member functions
147
148inline PlanarArcGeometry::PlanarArcGeometry(double l, double hh):
149 len(l), h(hh), angle(hh *l)
150{}
151
152
154 len(0.0), h(0.0), angle(phi)
155{}
156
157
159 BGeometryBase(rhs),len(rhs.len), h(rhs.h), angle(rhs.angle)
160{}
161
162
163inline const PlanarArcGeometry &PlanarArcGeometry::operator=
164(const PlanarArcGeometry &rhs) {
165 len = rhs.len;
166 h = rhs.h;
167 angle = rhs.angle;
168 return *this;
169}
170
171#endif // CLASSIC_PlanarArcGeometry_HH
172
Displacement and rotation in space.
Definition: Euclid3D.h:68
Abstract base class for accelerator geometry classes.
Definition: Geometry.h:43
A simple arc in the XZ plane.
double getExit() const
Get exit.
Euclid3D getEntranceFrame() const
Get transform.
double getCurvature() const
Get curvature.
void setCurvature(double)
Set curvature.
double getBendAngle() const
Get angle.
virtual double getOrigin() const
Get origin.
virtual double getArcLength() const
Get arc length.
virtual void setElementLength(double)
Set length.
virtual void setBendAngle(double)
Set angle.
Euclid3D getExitFrame() const
Get transform.
double getEntrance() const
Get entrance.
PlanarArcGeometry(double l, double h)
Constructor.
virtual double getElementLength() const
Get element length.
const PlanarArcGeometry & operator=(const PlanarArcGeometry &)
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
virtual Euclid3D getTotalTransform() const
Get transform.