OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
|
Component placement handler in ring geometry. More...
#include <RingSection.h>
Private Member Functions | |
void | rotate (Vector_t &vector) const |
void | rotate_back (Vector_t &vector) const |
Vector_t & | normalise (Vector_t &vector) const |
void | rotateToTCoordinates (Vector_t &vec) const |
void | rotateToCyclCoordinates (Vector_t &vec) const |
void | updateComponentOrientation () |
Private Attributes | |
Component * | component_m |
Vector_t | componentPosition_m |
Vector_t | componentOrientation_m |
Vector_t | startPosition_m |
Vector_t | startOrientation_m |
Vector_t | endPosition_m |
Vector_t | endOrientation_m |
double | sin2_m |
double | cos2_m |
Component placement handler in ring geometry.
RingSection handles placement of a component when it is placed in a ring geometry. Here the primary index for section placement is azimuthal angle. RingSection assumes that ring objects occupy a space defined by a start plane and another end plane.
All vectors should be in cartesian coordinates (x,y,z); with z being the axis of the ring.
component_m | component that the OpalSection wraps - this is a borrowed reference (RingSection does not own the memory) |
startPosition_m | position of the centre of the start face in cylindrical polar coordinates |
startOrientation_m | vector normal to the start face pointing towards the field map |
endPosition_m | position of the centre of the end face in cylindrical polar coordinates |
endOrientation_m | vector normal to the end face pointing away from the field map |
componentPosition_m | field map position relative to component start |
componentRotation_m | field map rotation R |
So field maps are calculated in local coordinate system U_local = V+R*U_global where R is rotation matrix and V is componentPosition_m.
Return field values are returned like B_global = R^{-1}*B_local
Definition at line 58 of file RingSection.h.
RingSection::RingSection | ( | ) |
Construct a ring section - positions, orientations etc default to 0.
Definition at line 25 of file RingSection.cpp.
RingSection::RingSection | ( | const RingSection & | sec | ) |
Copy constructor; deepcopies the Component (and copies everything else)
Definition at line 32 of file RingSection.cpp.
RingSection::~RingSection | ( | ) |
Destructor - does nothing
Definition at line 40 of file RingSection.cpp.
bool RingSection::doesOverlap | ( | double | phiStart, |
double | phiEnd | ||
) | const |
Return true if the phi range overlaps bounding box elements
Definition at line 130 of file RingSection.cpp.
References cos(), getVirtualBoundingBox(), isOnOrPastStartPlane(), isPastEndPlane(), setEndNormal(), setEndPosition(), setStartNormal(), setStartPosition(), and sin().
|
inline |
Get the component wrapped by RingSection
Component* is not owned by caller or RingSection
Definition at line 131 of file RingSection.h.
References component_m.
Referenced by Ring::appendElement(), and PyOpal::Field::getElementName().
|
inline |
Get the rotation for the component relative to the section start
Definition at line 167 of file RingSection.h.
References componentOrientation_m.
|
inline |
Get the displacement for the component relative to the section start
Definition at line 161 of file RingSection.h.
References componentPosition_m.
|
inline |
Get the normal vector to the section end plane
Definition at line 155 of file RingSection.h.
References endOrientation_m.
Referenced by Ring::appendElement(), PyOpal::Field::getElementEndNormal(), and getVirtualBoundingBox().
|
inline |
Get a position on the section end plane
Definition at line 149 of file RingSection.h.
References endPosition_m.
Referenced by Ring::appendElement(), PyOpal::Field::getElementEndPosition(), and getVirtualBoundingBox().
bool RingSection::getFieldValue | ( | const Vector_t & | pos, |
const Vector_t & | centroid, | ||
const double & | t, | ||
Vector_t & | E, | ||
Vector_t & | B | ||
) | const |
Return field value in global coordinate system
pos | Position in global Cartesian coordinates |
t | time in lab frame |
centroid | Not sure what this is |
E | Vector to be filled with electric field values; will always overwrite with 0. before filling field |
B | Vector to be filled with magnetic field values; will always overwrite with 0. before filling field |
Note; does not check for component == nullptr; caller must assign component_m (using setComponent) before calling this function.
Definition at line 88 of file RingSection.cpp.
References Component::apply(), component_m, componentPosition_m, rotate(), rotate_back(), rotateToCyclCoordinates(), and rotateToTCoordinates().
|
inline |
Get the normal vector to the section start plane
Definition at line 143 of file RingSection.h.
References startOrientation_m.
Referenced by Ring::appendElement(), PyOpal::Field::getElementStartNormal(), and getVirtualBoundingBox().
|
inline |
Get a position on the plane of the section start
Definition at line 137 of file RingSection.h.
References startPosition_m.
Referenced by Ring::appendElement(), PyOpal::Field::getElementStartPosition(), and getVirtualBoundingBox().
std::vector< Vector_t > RingSection::getVirtualBoundingBox | ( | ) | const |
Get the "Virtual" bounding box for the RingSection
Defined by the point one radial distance along each face of the element either towards the centre of the ring or towards the outside of the ring
Return order is; start outside, start inside, end outside, end inside
An improvement would be to put the crossing point if the two faces cross before they reach the radial apertures described above.
Definition at line 112 of file RingSection.cpp.
References getEndNormal(), getEndPosition(), getStartNormal(), getStartPosition(), normalise(), and sqrt().
Referenced by doesOverlap().
void RingSection::handleOffset | ( | ) |
Check whether component_m is a global offset and handle
A global Offset will have initially endPosition_m and endOrientation_m set relative to the global origin, not the startPosition_m and the startOrientation_m (as OPAL expects).
If component_m is an offset with is_local == false then transform the offset from a coordinate system starting with globalStartPosition and globalStartNormal to a coordinate system starting with startPosition_m and startNormal_m.
Definition at line 187 of file RingSection.cpp.
References component_m, startOrientation_m, startPosition_m, and Offset::updateGeometry().
Referenced by Ring::appendElement().
bool RingSection::isOnOrPastStartPlane | ( | const Vector_t & | pos | ) | const |
Return true if pos is on or past start plane
pos | position to test |
Definition at line 63 of file RingSection.cpp.
References startOrientation_m, and startPosition_m.
Referenced by doesOverlap().
bool RingSection::isPastEndPlane | ( | const Vector_t & | pos | ) | const |
Return true if pos is past end plane
Definition at line 76 of file RingSection.cpp.
References endOrientation_m, and endPosition_m.
Referenced by doesOverlap().
Definition at line 220 of file RingSection.h.
References sqrt().
Referenced by getVirtualBoundingBox(), setEndNormal(), and setStartNormal().
RingSection & RingSection::operator= | ( | const RingSection & | sec | ) |
Definition at line 46 of file RingSection.cpp.
References ElementBase::clone(), component_m, componentOrientation_m, componentPosition_m, endOrientation_m, endPosition_m, startOrientation_m, and startPosition_m.
Definition at line 175 of file RingSection.cpp.
References cos2_m, and sin2_m.
Referenced by getFieldValue().
Definition at line 181 of file RingSection.cpp.
References cos2_m, and sin2_m.
Referenced by getFieldValue().
Definition at line 235 of file RingSection.h.
Referenced by getFieldValue().
Definition at line 231 of file RingSection.h.
Referenced by getFieldValue().
Set the component wrapped by RingSection
This borrows the Component* pointer (caller is responsible for cleanup)
Definition at line 125 of file RingSection.h.
References component(), and component_m.
Referenced by Ring::appendElement().
Set the rotation for the component relative to the section start
Definition at line 207 of file RingSection.h.
References componentOrientation_m, and updateComponentOrientation().
Referenced by Ring::appendElement().
Set the displacement for the component relative to the section start
Definition at line 158 of file RingSection.h.
References componentPosition_m.
Referenced by Ring::appendElement().
Set the normal vector to the section end plane
Definition at line 216 of file RingSection.h.
References endOrientation_m, and normalise().
Referenced by Ring::appendElement(), and doesOverlap().
Set a position on the section end plane
Definition at line 146 of file RingSection.h.
References endPosition_m.
Referenced by Ring::appendElement(), and doesOverlap().
Set the normal vector to the section start plane
Definition at line 212 of file RingSection.h.
References normalise(), and startOrientation_m.
Referenced by Ring::appendElement(), and doesOverlap().
Set a position on the plane of the section start
Definition at line 134 of file RingSection.h.
References startPosition_m.
Referenced by Ring::appendElement(), and doesOverlap().
|
private |
Definition at line 107 of file RingSection.cpp.
References componentOrientation_m, cos(), cos2_m, sin(), and sin2_m.
Referenced by setComponentOrientation().
|
private |
Definition at line 189 of file RingSection.h.
Referenced by getComponent(), getFieldValue(), handleOffset(), operator=(), and setComponent().
|
private |
Definition at line 192 of file RingSection.h.
Referenced by getComponentOrientation(), operator=(), setComponentOrientation(), and updateComponentOrientation().
|
private |
Definition at line 191 of file RingSection.h.
Referenced by getComponentPosition(), getFieldValue(), operator=(), and setComponentPosition().
|
private |
Definition at line 202 of file RingSection.h.
Referenced by rotate(), rotate_back(), and updateComponentOrientation().
|
private |
Definition at line 198 of file RingSection.h.
Referenced by getEndNormal(), isPastEndPlane(), operator=(), and setEndNormal().
|
private |
Definition at line 197 of file RingSection.h.
Referenced by getEndPosition(), isPastEndPlane(), operator=(), and setEndPosition().
|
private |
Definition at line 201 of file RingSection.h.
Referenced by rotate(), rotate_back(), and updateComponentOrientation().
|
private |
Definition at line 195 of file RingSection.h.
Referenced by getStartNormal(), handleOffset(), isOnOrPastStartPlane(), operator=(), and setStartNormal().
|
private |
Definition at line 194 of file RingSection.h.
Referenced by getStartPosition(), handleOffset(), isOnOrPastStartPlane(), operator=(), and setStartPosition().