OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
VarRadiusGeometry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Martin Duy Tat
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  * 1. Redistributions of source code must retain the above copyright notice,
7  * this list of conditions and the following disclaimer.
8  * 2. Redistributions in binary form must reproduce the above copyright notice,
9  * this list of conditions and the following disclaimer in the documentation
10  * and/or other materials provided with the distribution.
11  * 3. Neither the name of STFC nor the names of its contributors may be used to
12  * endorse or promote products derived from this software without specific
13  * prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef CLASSIC_VarRadiusGeometry_HH
29 #define CLASSIC_VarRadiusGeometry_HH
30 
54 
56 public:
65  VarRadiusGeometry(double length,
66  double rho,
67  double s_0,
68  double lambda_left,
69  double lambda_right);
73  virtual ~VarRadiusGeometry();
75  const VarRadiusGeometry &operator=(const VarRadiusGeometry &right);
77  virtual double getArcLength() const;
79  virtual double getElementLength() const;
83  virtual void setElementLength(double length);
85  double getRadius() const;
89  void setRadius(const double &rho);
91  double getS0() const;
95  void setS0(const double &s_0);
97  double getLambdaLeft() const;
101  void setLambdaLeft(const double &lambda_left);
103  double getLambdaRight() const;
107  void setLambdaRight(const double &lambda_right);
112  virtual Euclid3D getTransform(double fromS, double toS) const;
117  virtual Euclid3D getEntranceFrame() const;
122  virtual Euclid3D getExitFrame() const;
123 private:
124  double length_m;
125  double rho_m;
126  double s_0_m;
129 };
130 
131 // inlined (trivial) member functions
132 
133 inline
135  double rho,
136  double s_0,
137  double lambda_left,
138  double lambda_right):
139  length_m(length), rho_m(rho), s_0_m(s_0),
140  lambda_left_m(lambda_left), lambda_right_m(lambda_right) {
141 }
142 
143 inline
145  BGeometryBase(rhs),
146  length_m(rhs.length_m), rho_m(rhs.rho_m), s_0_m(rhs.s_0_m),
147  lambda_left_m(rhs.lambda_left_m), lambda_right_m(rhs.lambda_right_m) {
148 }
149 
150 
151 inline
153  const VarRadiusGeometry &rhs) {
154  length_m = rhs.length_m;
155  rho_m = rhs.rho_m;
156  s_0_m = rhs.s_0_m;
159  return *this;
160 }
161 inline
163 }
164 inline
166  return length_m;
167 }
168 inline
170  return length_m;
171 }
172 inline
174  length_m = length;
175 }
176 inline
178  return rho_m;
179 }
180 inline
181  void VarRadiusGeometry::setRadius(const double &rho) {
182  rho_m = rho;
183 }
184 inline
185  double VarRadiusGeometry::getS0() const {
186  return s_0_m;
187 }
188 inline
189  void VarRadiusGeometry::setS0(const double &s_0) {
190  s_0_m = s_0;
191 }
192 inline
194  return lambda_left_m;
195 }
196 inline
197  void VarRadiusGeometry::setLambdaLeft(const double &lambda_left) {
198  lambda_left_m = lambda_left;
199 }
200 inline
202  return lambda_right_m;
203 }
204 inline
205  void VarRadiusGeometry::setLambdaRight(const double &lambda_right) {
206  lambda_right_m = lambda_right;
207 }
208 inline
210  return getTransform(getOrigin(), getEntrance());
211 }
212 inline
214  return getTransform(getOrigin(), getExit());
215 }
216 
217 #endif
218 
void setLambdaLeft(const double &lambda_left)
virtual Euclid3D getTransform(double fromS, double toS) const
virtual double getEntrance() const
Get entrance position.
Definition: Geometry.cpp:41
virtual double getOrigin() const
Get origin position.
Definition: Geometry.cpp:36
virtual double getExit() const
Get exit position.
Definition: Geometry.cpp:46
double getRadius() const
virtual void setElementLength(double length)
Abstract base class for accelerator geometry classes.
Definition: Geometry.h:43
virtual double getArcLength() const
virtual double getElementLength() const
virtual Euclid3D getEntranceFrame() const
VarRadiusGeometry(double length, double rho, double s_0, double lambda_left, double lambda_right)
virtual Euclid3D getExitFrame() const
Displacement and rotation in space.
Definition: Euclid3D.h:68
double getLambdaRight() const
const VarRadiusGeometry & operator=(const VarRadiusGeometry &right)
void setLambdaRight(const double &lambda_right)
double getS0() const
double getLambdaLeft() const
void setRadius(const double &rho)
void setS0(const double &s_0)
virtual ~VarRadiusGeometry()