OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
#include <SectorField.h>
Public Member Functions | |
SectorField (const std::string &file_name) | |
virtual | ~SectorField () |
virtual bool | getFieldstrength (const Vector_t &R_c, Vector_t &E_c, Vector_t &B_c) const =0 |
virtual std::vector< double > | getPolarBoundingBoxMin () const |
virtual std::vector< double > | getPolarBoundingBoxMax () const |
void | getFieldDimensions (double &zBegin, double &zEnd, double &rBegin, double &rEnd) const |
void | getFieldDimensions (double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const |
bool | isInBoundingBox (const double R_p[]) const |
Static Public Member Functions | |
static void | convertToPolar (double *position) |
static void | convertToPolar (const double *position_polar, double *value) |
static void | convertToCartesian (double *position) |
static void | convertToCartesian (const double *position_polar, double *value) |
Protected Member Functions | |
void | setPolarBoundingBox (double bbMinR, double bbMinY, double bbMinPhi, double bbMaxR, double bbMaxY, double bbMaxPhi, double bbTolR, double bbTolY, double bbTolPhi) |
Protected Attributes | |
std::vector< double > | bbMin_m |
std::vector< double > | bbMax_m |
std::vector< double > | polarBBMin_m |
std::vector< double > | polarBBMax_m |
std::string | Filename_m |
Private Member Functions | |
std::vector< std::vector< double > > | getCorners (double bbMinR, double bbMinPhi, double bbMaxR, double bbMaxPhi) |
SectorField is an abstraction type for a sector field map i.e. a field map with a bent geometry as in a ring. Functions are provided for converting from cartesian coordinate systems to ring coordinate systems and vice versa and field calculation functions are defined for the field in cartesian coordinates and additionally ring coordinates.
The sector field map holds two bounding boxes - the standard rectangular bounding box in cartesian coordinates and additionally a sector bounding box in polar coordinates. The bounding box should always be given in polar coordinates - SectorField will do the conversion to cartesian coordinates (note this is a lossy procedure)
Ring coordinates are typically given as three vectors going like (radius, y, angle) also denoted by (r, y, phi). The ring coordinate system is defined with (x, y, z) = (0, 0, 0) the centre of the ring; y is the same in ring and cartesian coordinate systems. Positive phi is anticlockwise in the (x, z) plane.
Definition at line 55 of file SectorField.h.
SectorField::SectorField | ( | const std::string & | file_name | ) |
Make an empty sector field; set bounding box to max double
Definition at line 41 of file SectorField.cpp.
References bbMax_m, bbMin_m, polarBBMax_m, and polarBBMin_m.
|
virtual |
Destructor (does nothing)
Definition at line 52 of file SectorField.cpp.
|
static |
Convert a 3 vector from polar to cartesian coordinate system
position | position in polar coordinates at which the value is valid |
value | pointer to an allocated block of at least 3 doubles. The function will apply a rotation to the existing data to render it from polar coordinates (a_r, a_y, a_phi) to polar coordinates (a_x, a_y, a_z) appropriate for the specified position. |
Definition at line 77 of file SectorField.cpp.
|
static |
Convert a position from polar coordinates to cartesian
position | position in polar coordinates to convert to cartesian polar coordinates. Input should be an allocated block of at least 3 doubles containing values (r, y, phi). This is over written with 3 double containing values (x, y, z). |
Definition at line 70 of file SectorField.cpp.
Referenced by getCorners().
|
static |
Convert a 3 vector from cartesian to polar coordinate system
position | position in polar coordinates at which the value is valid |
value | pointer to an allocated block of at least 3 doubles. The function will apply a rotation to the existing data to render it from cartesian coordinates (a_x, a_y, a_z) to polar coordinates (a_r, a_y, a_phi) appropriate for the specified position. |
Definition at line 61 of file SectorField.cpp.
|
static |
Convert a position from cartesian to polar coordinates
position | position in cartesian coordinates to convert to cylindrical polar coordinates. Input should be an allocated block of at least 3 doubles containing values (x, y, z). This is over written with 3 double containing values (r, y, phi). |
Definition at line 54 of file SectorField.cpp.
References atan2(), and sqrt().
Referenced by SectorMagneticFieldMap::getFieldstrength(), and SectorMagneticFieldMap::IO::readLines().
|
private |
Definition at line 162 of file SectorField.cpp.
References convertToCartesian().
Referenced by setPolarBoundingBox().
void SectorField::getFieldDimensions | ( | double & | xIni, |
double & | xFinal, | ||
double & | yIni, | ||
double & | yFinal, | ||
double & | zIni, | ||
double & | zFinal | ||
) | const |
Fill inputs with the bounding box in Cartesian coordinates
xIni | lower bound on field x-position (horizontal) |
xFinal | upper bound on field x-position (horizontal) |
yIni | lower bound on field y-position (vertical) |
yFinal | upper bound on field y-position (vertical) |
zIni | lower bound on field z-position (longitudinal) |
zFinal | upper bound on field z-position (longitudinal) |
Definition at line 205 of file SectorField.cpp.
void SectorField::getFieldDimensions | ( | double & | zBegin, |
double & | zEnd, | ||
double & | rBegin, | ||
double & | rEnd | ||
) | const |
Fill inputs with the bounding box in Polar coordinates
zBegin | lower bound on field length in phi direction (units of distance) |
zEnd | upper bound on field length in phi direction (units of distance) |
rBegin | lower bound on field length in radial direction |
rEnd | lower bound on field length in radial direction |
Definition at line 197 of file SectorField.cpp.
References polarBBMax_m, and polarBBMin_m.
|
pure virtual |
Return the field value in polar coordinates
R_p | position in cylindrical coordinates at which to evaluate the field. Should be an array of length 4 like (r, y, phi, t) |
E_p | reference to an allocated 3-vector. The function will fill the block with the value of the field in cylindrical polar coordinates, (e_r, e_y, e_phi) Overwrites any existing data |
B_p | reference to an allocated 3-vector. The function will fill the block with the value of the field in cylindrical polar coordinates, (b_r, b_y, b_phi) Overwrites any existing data |
R_c | position in cartesian coordinates at which to evaluate the field. Should be an array of length 4 like (x, y, z, t) |
E_p | reference to an allocated 3-vector. The function will fill the block with the value of the field in cartesian coordinates, (e_x, e_y, e_z) Overwrites any existing data |
B_p | reference to an allocated 3-vector. The function will fill the block with the value of the field in cartesian coordinates, (b_x, b_y, b_z) Overwrites any existing data |
Implemented in SectorMagneticFieldMap.
|
virtual |
Get the maximum bounding box in polar coordinates
Definition at line 193 of file SectorField.cpp.
References polarBBMax_m.
Referenced by SectorMagneticFieldMap::getFieldstrength(), SectorMagneticFieldMap::getInfo(), SectorMagneticFieldMap::print(), and SBend3D::setFieldMapFileName().
|
virtual |
Get the minimum bounding box in polar coordinates
Definition at line 189 of file SectorField.cpp.
References polarBBMin_m.
Referenced by SectorMagneticFieldMap::applySymmetry(), SectorMagneticFieldMap::getFieldstrength(), SectorMagneticFieldMap::getInfo(), SectorMagneticFieldMap::print(), and SBend3D::setFieldMapFileName().
|
inline |
Return true if polar vector R_p is within polar bounding box
R_p | polar coordinates (r, y, phi) |
Definition at line 224 of file SectorField.h.
References polarBBMax_m, and polarBBMin_m.
Referenced by SectorMagneticFieldMap::getFieldstrength().
|
protected |
Set the bounding boxes from polar coordinates
Sets the bounding boxes, both polar and cartesian, based on a set of minimum and maximum polar coordinates. Note that MinPhi->MaxPhi are allowed in the domain -2pi to 2pi. If the difference is >= 2pi, then this will describe the full ring.
bbMinR | minimum radius - must be positive |
bbMinY | minimum y value |
bbMinPhi | minimum phi value - must be greater than -2*pi |
bbMaxR | maximum radius - must be greater than minimum radius |
bbMaxY | maximum y value - must be greater than minimum y value |
bbMaxPhi | maximum phi value - must be greater than minimum phi and less than 2*pi |
Definition at line 86 of file SectorField.cpp.
References bbMax_m, bbMin_m, begin(), end(), getCorners(), polarBBMax_m, and polarBBMin_m.
Referenced by SectorMagneticFieldMap::setInterpolator().
|
protected |
bounding box maximum as a 3-vector like (x_max, y_max, z_max)
Definition at line 211 of file SectorField.h.
Referenced by getFieldDimensions(), SectorField(), and setPolarBoundingBox().
|
protected |
bounding box minimum as a 3-vector like (x_min, y_min, z_min)
Definition at line 209 of file SectorField.h.
Referenced by getFieldDimensions(), SectorField(), and setPolarBoundingBox().
|
protected |
Keep the filename
Definition at line 217 of file SectorField.h.
Referenced by SectorMagneticFieldMap::getInfo(), and SectorMagneticFieldMap::print().
|
protected |
bounding box maximum as a 3-vector like (r_max, y_max, phi_max)
Definition at line 215 of file SectorField.h.
Referenced by getFieldDimensions(), getPolarBoundingBoxMax(), isInBoundingBox(), SectorField(), and setPolarBoundingBox().
|
protected |
bounding box minimum as a 3-vector like (r_min, y_min, phi_min)
Definition at line 213 of file SectorField.h.
Referenced by getFieldDimensions(), getPolarBoundingBoxMin(), isInBoundingBox(), SectorField(), and setPolarBoundingBox().