OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
PlanarArcGeometry.h
Go to the documentation of this file.
1#ifndef OPALX_PlanarArcGeometry_HH
2#define OPALX_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:
59 // Build PlanarArcGeometry from length [b]l[/b] and curvature [b]h[/b].
60 PlanarArcGeometry(double l, double h);
61
63 // Build PlanarArcGeometry from length zero and angle [b]phi[/b].
64 PlanarArcGeometry(double phi);
65
67 virtual ~PlanarArcGeometry();
69
71 // Return arc length along the design arc.
72 virtual double getArcLength() const;
73
75 // Return element length measured along the design arc.
76 virtual double getElementLength() const;
77
79 double getBendAngle() const;
80
82 double getCurvature() const;
83
85 virtual void setBendAngle(double);
86
88 void setCurvature(double);
89
91 // Assign the arc length for this class.
92 virtual void setElementLength(double);
93
95 // Return the distance from the entrance of the geometry to the origin
96 // (non-negative).
97 virtual double getOrigin() const;
98
100 // Return the arc length from the origin to the entrance of the
101 // geometry (non-positive).
102 double getEntrance() const;
103
105 // Return the arc length from the origin to the exit of the
106 // geometry (non-negative).
107 double getExit() const;
108
110 // Return the transform of the local coordinate system from the
111 // position [b]fromS[/b] to the position [b]toS[/b].
112 virtual Euclid3D getTransform(double fromS, double toS) const;
113
115 // Equivalent to getTransform(0.0, s).
116 // Return the transform of the local coordinate system from the
117 // origin and [b]s[/b].
118 virtual Euclid3D getTransform(double s) const;
119
121 // Equivalent to getTransform(getEntrance(), getExit()).
122 // Return the transform of the local coordinate system from the
123 // entrance to the exit of the element.
124 virtual Euclid3D getTotalTransform() const;
125
127 // Equivalent to getTransform(0.0, getEntrance()).
128 // Return the transform of the local coordinate system from the
129 // origin to the entrance of the element.
131
133 // Equivalent to getTransform(0.0, getExit()).
134 // Return the transform of the local coordinate system from the
135 // origin to the exit of the element.
136 Euclid3D getExitFrame() const;
137
138private:
139 double len;
140 double h;
141 double angle;
142};
143
144// inlined (trivial) member functions
145
146inline PlanarArcGeometry::PlanarArcGeometry(double l, double hh) : len(l), h(hh), angle(hh * l) {}
147
148inline PlanarArcGeometry::PlanarArcGeometry(double phi) : len(0.0), h(0.0), angle(phi) {}
149
151 : BGeometryBase(rhs), len(rhs.len), h(rhs.h), angle(rhs.angle) {}
152
154 len = rhs.len;
155 h = rhs.h;
156 angle = rhs.angle;
157 return *this;
158}
159
160#endif // OPALX_PlanarArcGeometry_HH
Abstract base class for accelerator geometry classes.
Definition Geometry.h:42
Displacement and rotation in space.
Definition Euclid3D.h:67
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.