OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
RingSection.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2014, Chris Rogers
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 RING_SECTION_H
29#define RING_SECTION_H
30
31#include <vector>
32
34
68public:
72
74 RingSection(const RingSection& sec);
75
77
80
87 bool isOnOrPastStartPlane(const Vector_t<double, 3>& pos) const;
88
94 bool isPastEndPlane(const Vector_t<double, 3>& pos) const;
95
110 bool getFieldValue(
111 const Vector_t<double, 3>& pos, const Vector_t<double, 3>& centroid, const double& t,
113
125 std::vector<Vector_t<double, 3>> getVirtualBoundingBox() const;
126
128 bool doesOverlap(double phiStart, double phiEnd) const;
129
134 inline void setComponent(Component* component) { component_m = component; }
135
140 inline Component* getComponent() const { return component_m; }
141
144
147
149 inline void setStartNormal(Vector_t<double, 3> orientation);
150
153
156
159
161 inline void setEndNormal(Vector_t<double, 3> orientation);
162
165
168 componentPosition_m = position;
169 }
170
173
175 inline void setComponentOrientation(Vector_t<double, 3> orientation);
176
179
180private:
181 void rotate(Vector_t<double, 3>& vector) const;
182 void rotate_back(Vector_t<double, 3>& vector) const;
184 inline void rotateToTCoordinates(Vector_t<double, 3>& vec) const;
185 inline void rotateToCyclCoordinates(Vector_t<double, 3>& vec) const;
186
188
191
194
197
199 double sin2_m;
200 double cos2_m;
201};
202
203typedef std::vector<RingSection*> RingSectionList;
204
209
211 startOrientation_m = normalise(orientation);
212}
213
215 endOrientation_m = normalise(orientation);
216}
217
219 double magnitude =
220 sqrt(orientation(0) * orientation(0) + orientation(1) * orientation(1)
221 + orientation(2) * orientation(2));
222 if (magnitude > 0.) orientation = orientation / magnitude;
223 return orientation;
224}
225
227 vec = Vector_t<double, 3>({vec(1), vec(2), vec(0)});
228}
229
231 vec = Vector_t<double, 3>({vec(2), vec(0), vec(1)});
232}
233
234#endif // RING_SECTION_H
Defines the abstract interface for a single beamline component in the accelerator model.
ippl::Vector< T, Dim > Vector_t
std::vector< RingSection * > RingSectionList
Component placement handler in ring geometry.
Definition RingSection.h:67
void setComponentOrientation(Vector_t< double, 3 > orientation)
Vector_t< double, 3 > getStartPosition() const
RingSection & operator=(const RingSection &sec)
Vector_t< double, 3 > componentOrientation_m
void rotateToCyclCoordinates(Vector_t< double, 3 > &vec) const
void setEndPosition(Vector_t< double, 3 > pos)
Vector_t< double, 3 > getEndPosition() const
void setComponent(Component *component)
bool getFieldValue(const Vector_t< double, 3 > &pos, const Vector_t< double, 3 > &centroid, const double &t, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const
Vector_t< double, 3 > & normalise(Vector_t< double, 3 > &vector) const
void setStartNormal(Vector_t< double, 3 > orientation)
Vector_t< double, 3 > getEndNormal() const
void setComponentPosition(Vector_t< double, 3 > position)
Vector_t< double, 3 > getStartNormal() const
std::vector< Vector_t< double, 3 > > getVirtualBoundingBox() const
Component * getComponent() const
void rotateToTCoordinates(Vector_t< double, 3 > &vec) const
bool isOnOrPastStartPlane(const Vector_t< double, 3 > &pos) const
double sin2_m
Component * component_m
bool doesOverlap(double phiStart, double phiEnd) const
Vector_t< double, 3 > endPosition_m
double cos2_m
void updateComponentOrientation()
void setEndNormal(Vector_t< double, 3 > orientation)
Vector_t< double, 3 > startOrientation_m
void setStartPosition(Vector_t< double, 3 > pos)
void rotate_back(Vector_t< double, 3 > &vector) const
Vector_t< double, 3 > componentPosition_m
bool isPastEndPlane(const Vector_t< double, 3 > &pos) const
void rotate(Vector_t< double, 3 > &vector) const
Vector_t< double, 3 > startPosition_m
Vector_t< double, 3 > endOrientation_m
Vector_t< double, 3 > getComponentOrientation() const
Vector_t< double, 3 > getComponentPosition() const