| 
    OPAL (Object Oriented Parallel Accelerator Library) 2022.1
    
   OPAL 
   | 
 
#include <MultipoleTStraight.h>


Public Member Functions | |
| MultipoleTStraight (const std::string &name) | |
| MultipoleTStraight (const MultipoleTStraight &right) | |
| ~MultipoleTStraight () | |
| virtual ElementBase * | clone () const override | 
| void | accept (BeamlineVisitor &visitor) const override | 
| virtual void | setMaxOrder (const std::size_t &maxOrder) override | 
| StraightGeometry & | getGeometry () override | 
| const StraightGeometry & | getGeometry () const override | 
| virtual void | initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override | 
  Public Member Functions inherited from MultipoleTBase | |
| MultipoleTBase () | |
| MultipoleTBase (const std::string &name) | |
| MultipoleTBase (const MultipoleTBase &right) | |
| ~MultipoleTBase () | |
| EMField & | getField () | 
| const EMField & | getField () const | 
| bool | apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) | 
| bool | apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B) | 
| void | initialise (PartBunchBase< double, 3 > *, double &startField, double &endField) | 
| void | finalise () | 
| bool | bends () const | 
| double | getDipoleConstant () const | 
| void | setDipoleConstant (const double &B0) | 
| std::size_t | getMaxOrder () const | 
| virtual void | setMaxOrder (const std::size_t &maxOrder) | 
| std::size_t | getTransMaxOrder () const | 
| void | setTransMaxOrder (const std::size_t &transMaxOrder) | 
| void | setTransProfile (const std::size_t &n, const double &Bn) | 
| double | getTransProfile (const std::size_t &n) const | 
| std::vector< double > | getTransProfile () const | 
| bool | setFringeField (const double &s0, const double &lambda_left, const double &lambda_right) | 
| std::vector< double > | getFringeLength () const | 
| void | setEntranceAngle (const double &entranceAngle) | 
| virtual void | setBendAngle (const double &angle) | 
| virtual double | getBendAngle () const | 
| double | getEntranceAngle () const | 
| void | setLength (const double &length) | 
| double | getLength () const | 
| void | setAperture (const double &vertAp, const double &horizAp) | 
| std::vector< double > | getAperture () const | 
| void | setRotation (const double &rot) | 
| double | getRotation () const | 
| double | getBoundingBoxLength () const | 
| void | setBoundingBoxLength (const double &boundingBoxLength) | 
| virtual void | getDimensions (double &zBegin, double &zEnd) const | 
  Public Member Functions inherited from Component | |
| Component (const std::string &name) | |
| Constructor with given name.  More... | |
| Component () | |
| Component (const Component &right) | |
| virtual | ~Component () | 
| virtual EMField & | getField ()=0 | 
| Return field.  More... | |
| virtual const EMField & | getField () const =0 | 
| Return field.  More... | |
| EVector | Efield (const Point3D &P) const | 
| Return the field in a point.  More... | |
| BVector | Bfield (const Point3D &P) const | 
| Return the field in a point.  More... | |
| EVector | Efield (const Point3D &P, double t) const | 
| Return the field in a point.  More... | |
| BVector | Bfield (const Point3D &P, double t) const | 
| Return the field in a point.  More... | |
| EBVectors | EBfield (const Point3D &P) const | 
| Return the field in a point.  More... | |
| EBVectors | EBfield (const Point3D &P, double t) const | 
| Return the field in a point.  More... | |
| virtual bool | apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B) | 
| virtual bool | apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) | 
| virtual bool | applyToReferenceParticle (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) | 
| virtual bool | getPotential (const Vector_t &, const double &, Vector_t &, double &) | 
| virtual double | getDesignEnergy () const | 
| virtual void | setDesignEnergy (const double &energy, bool changeable=true) | 
| virtual void | initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField)=0 | 
| virtual void | finalise ()=0 | 
| virtual bool | bends () const =0 | 
| virtual void | goOnline (const double &kineticEnergy) | 
| virtual void | goOffline () | 
| virtual bool | Online () | 
| virtual void | getDimensions (double &zBegin, double &zEnd) const =0 | 
| virtual ElementType | getType () const | 
| Get element type std::string.  More... | |
| virtual const ElementBase & | getDesign () const | 
| Return design element.  More... | |
| virtual void | trackBunch (PartBunchBase< double, 3 > *bunch, const PartData &, bool revBeam, bool revTrack) const | 
| Track particle bunch.  More... | |
| virtual void | trackMap (FVps< double, 6 > &map, const PartData &, bool revBeam, bool revTrack) const | 
| Track a map.  More... | |
| void | setExitFaceSlope (const double &) | 
  Public Member Functions inherited from ElementBase | |
| ElementBase (const std::string &name) | |
| Constructor with given name.  More... | |
| ElementBase () | |
| ElementBase (const ElementBase &) | |
| virtual | ~ElementBase () | 
| virtual const std::string & | getName () const | 
| Get element name.  More... | |
| virtual void | setName (const std::string &name) | 
| Set element name.  More... | |
| virtual ElementType | getType () const =0 | 
| Get element type std::string.  More... | |
| std::string | getTypeString () const | 
| virtual BGeometryBase & | getGeometry ()=0 | 
| Get geometry.  More... | |
| virtual const BGeometryBase & | getGeometry () const =0 | 
| Get geometry.  More... | |
| virtual double | getArcLength () const | 
| Get arc length.  More... | |
| virtual double | getElementLength () const | 
| Get design length.  More... | |
| virtual void | setElementLength (double length) | 
| Set design length.  More... | |
| virtual void | getElementDimensions (double &begin, double &end) const | 
| virtual double | getOrigin () const | 
| Get origin position.  More... | |
| virtual double | getEntrance () const | 
| Get entrance position.  More... | |
| virtual double | getExit () const | 
| Get exit position.  More... | |
| virtual Euclid3D | getTransform (double fromS, double toS) const | 
| Get transform.  More... | |
| virtual Euclid3D | getTransform (double s) const | 
| Get transform.  More... | |
| virtual Euclid3D | getTotalTransform () const | 
| Get transform.  More... | |
| virtual Euclid3D | getEntranceFrame () const | 
| Get transform.  More... | |
| virtual Euclid3D | getExitFrame () const | 
| Get transform.  More... | |
| virtual Euclid3D | getEntrancePatch () const | 
| Get patch.  More... | |
| virtual Euclid3D | getExitPatch () const | 
| Get patch.  More... | |
| virtual double | getAttribute (const std::string &aKey) const | 
| Get attribute value.  More... | |
| virtual bool | hasAttribute (const std::string &aKey) const | 
| Test for existence of an attribute.  More... | |
| virtual void | removeAttribute (const std::string &aKey) | 
| Remove an existing attribute.  More... | |
| virtual void | setAttribute (const std::string &aKey, double val) | 
| Set value of an attribute.  More... | |
| virtual Channel * | getChannel (const std::string &aKey, bool create=false) | 
| Construct a read/write channel.  More... | |
| virtual const ConstChannel * | getConstChannel (const std::string &aKey) const | 
| Construct a read-only channel.  More... | |
| virtual void | accept (BeamlineVisitor &visitor) const =0 | 
| Apply visitor.  More... | |
| virtual ElementBase * | clone () const =0 | 
| Return clone.  More... | |
| virtual ElementBase * | copyStructure () | 
| Make a structural copy.  More... | |
| bool | isSharable () const | 
| Test if the element can be shared.  More... | |
| virtual void | makeSharable () | 
| Set sharable flag.  More... | |
| bool | update (const AttributeSet &) | 
| Update element.  More... | |
| virtual void | setBoundaryGeometry (BoundaryGeometry *geo) | 
| virtual BoundaryGeometry * | getBoundaryGeometry () const | 
| return the attached boundary geometrt object if there is any  More... | |
| virtual bool | hasBoundaryGeometry () const | 
| virtual void | setWake (WakeFunction *wf) | 
| attach a wake field to the element  More... | |
| virtual WakeFunction * | getWake () const | 
| return the attached wake object if there is any  More... | |
| virtual bool | hasWake () const | 
| virtual void | setParticleMatterInteraction (ParticleMatterInteractionHandler *spys) | 
| virtual ParticleMatterInteractionHandler * | getParticleMatterInteraction () const | 
| virtual bool | hasParticleMatterInteraction () const | 
| void | setCSTrafoGlobal2Local (const CoordinateSystemTrafo &ori) | 
| CoordinateSystemTrafo | getCSTrafoGlobal2Local () const | 
| void | releasePosition () | 
| void | fixPosition () | 
| bool | isPositioned () const | 
| virtual CoordinateSystemTrafo | getEdgeToBegin () const | 
| virtual CoordinateSystemTrafo | getEdgeToEnd () const | 
| void | setAperture (const ApertureType &type, const std::vector< double > &args) | 
| std::pair< ApertureType, std::vector< double > > | getAperture () const | 
| virtual bool | isInside (const Vector_t &r) const | 
| void | setMisalignment (const CoordinateSystemTrafo &cst) | 
| void | getMisalignment (double &x, double &y, double &s) const | 
| CoordinateSystemTrafo | getMisalignment () const | 
| void | setActionRange (const std::queue< std::pair< double, double > > &range) | 
| void | setCurrentSCoordinate (double s) | 
| void | setRotationAboutZ (double rotation) | 
| Set rotation about z axis in bend frame.  More... | |
| double | getRotationAboutZ () const | 
| virtual BoundingBox | getBoundingBoxInLabCoords () const | 
| virtual int | getRequiredNumberOfTimeSteps () const | 
| void | setOutputFN (std::string fn) | 
| Set output filename.  More... | |
| std::string | getOutputFN () const | 
| Get output filename.  More... | |
| void | setFlagDeleteOnTransverseExit (bool=true) | 
| bool | getFlagDeleteOnTransverseExit () const | 
| void | setElementPosition (double elemedge) | 
| Access to ELEMEDGE attribute.  More... | |
| double | getElementPosition () const | 
| bool | isElementPositionSet () const | 
  Public Member Functions inherited from RCObject | |
| int | addReference () const | 
| Increment reference count.  More... | |
| int | removeReference () const | 
| Decrement the reference count.  More... | |
| bool | isShared () const | 
| Test for sharing.  More... | |
Private Member Functions | |
| MultipoleTStraight | operator= (const MultipoleTStraight &rhs) | 
| virtual void | transformCoords (Vector_t &R) override | 
| virtual void | transformBField (Vector_t &B, const Vector_t &R) override | 
| virtual double | getRadius (const double &s) override | 
| virtual double | getScaleFactor (const double &x, const double &s) override | 
| virtual double | getBx (const Vector_t &R) override | 
| virtual double | getBs (const Vector_t &R) override | 
| virtual double | getFn (const std::size_t &n, const double &x, const double &s) override | 
Private Attributes | |
| StraightGeometry | straightGeometry_m | 
Additional Inherited Members | |
  Static Public Member Functions inherited from ElementBase | |
| static std::string | getTypeString (ElementType type) | 
  Protected Member Functions inherited from MultipoleTBase | |
| double | getFringeDeriv (const std::size_t &n, const double &s) | 
| double | getTransDeriv (const std::size_t &n, const double &x) | 
  Protected Member Functions inherited from ElementBase | |
| bool | isInsideTransverse (const Vector_t &r) const | 
  Protected Member Functions inherited from RCObject | |
| RCObject () | |
| Default constructor.  More... | |
| RCObject (const RCObject &) | |
| Copy constructor.  More... | |
| virtual | ~RCObject ()=0 | 
| RCObject & | operator= (const RCObject &right) | 
  Protected Attributes inherited from Component | |
| double | exit_face_slope_m | 
| PartBunchBase< double, 3 > * | RefPartBunch_m | 
| bool | online_m | 
  Protected Attributes inherited from ElementBase | |
| bool | shareFlag | 
| CoordinateSystemTrafo | csTrafoGlobal2Local_m | 
| CoordinateSystemTrafo | misalignment_m | 
| std::pair< ApertureType, std::vector< double > > | aperture_m | 
| double | elementEdge_m | 
| double | rotationZAxis_m | 
  Static Protected Attributes inherited from Component | |
| static const std::vector< double > | defaultAperture_m | 
MultipoleTiStraight defines a straight combined function magnet (up to arbitrary multipole component) with fringe fields
Class category: AbsBeamline 
$Author: Titus Dascalu, Martin Duy Tat, Chris Rogers
The field is obtained from the scalar potential 
 
\[ V = f_0(x,s) z + f_1 (x,s) \frac{z^3}{3!} + f_2 (x,s) \frac{z^5}{5!} + ... \]
 
 (x,z,s) -> Frenet-Serret local coordinates along the magnet 
 z -> vertical component 
 assume mid-plane symmetry 
 set field on mid-plane -> \( B_z = f_0(x,s) = T(x) \cdot S(s) \) 
 T(x) -> transverse profile; this is a polynomial describing the field expansion on the mid-plane inside the magnet (not in the fringe field); 1st term is the dipole strength, 2nd term is the quadrupole gradient * x, etc. 
 -> when setting the magnet, one gives the multipole coefficients of this polynomial (i.e. dipole strength, 
 quadrupole gradient, etc.) 
----------— example --------------------------------------------— 
 Setting a combined function magnet with dipole, quadrupole and sextupole components: 
 \( T(x) = B_0 + B_1 \cdot x + B_2 \cdot x^2 \)
 user gives \( B_0, B_1, B_2 \) 
----------— example end ----------------------------------------— 
 S(s) -> fringe field 
 recursion -> \( f_n (x,s) = (-1)^n \cdot \sum_{i=0}^{n} C_n^i \cdot T^{(2i)} \cdot S^{(2n-2i)} \) 
 for curved magnets the above recursion is more complicated 
 \( C_n^i \) -> binomial coeff; \( T^{(n)} \) -> n-th derivative
Definition at line 82 of file MultipoleTStraight.h.
      
  | 
  explicit | 
Constructor
| name | -> User-defined name | 
Definition at line 36 of file MultipoleTStraight.cpp.
Referenced by clone().
| MultipoleTStraight::MultipoleTStraight | ( | const MultipoleTStraight & | right | ) | 
Copy constructor
Definition at line 41 of file MultipoleTStraight.cpp.
References Component::RefPartBunch_m.
| MultipoleTStraight::~MultipoleTStraight | ( | ) | 
Destructor
Definition at line 48 of file MultipoleTStraight.cpp.
      
  | 
  inlineoverridevirtual | 
Accept a beamline visitor
Implements ElementBase.
Definition at line 153 of file MultipoleTStraight.h.
References BeamlineVisitor::visitMultipoleTStraight().

      
  | 
  overridevirtual | 
Inheritable copy constructor
Implements ElementBase.
Definition at line 51 of file MultipoleTStraight.cpp.
References MultipoleTStraight().
Referenced by ParallelCyclotronTracker::visitMultipoleTStraight().

      
  | 
  overrideprivatevirtual | 
Get s-component of the B-field 
This function has been overloaded because calculating 
the B-field directly is quicker and more accurate 
Reimplemented from MultipoleTBase.
Definition at line 77 of file MultipoleTStraight.cpp.
References MultipoleTBase::getFringeDeriv(), MultipoleTBase::getMaxOrder(), MultipoleTBase::getTransDeriv(), Hypervolume::n, and Attrib::Distribution::R.

      
  | 
  overrideprivatevirtual | 
Get x-component of the B-field 
This function has been overloaded because calculating 
the B-field directly is quicker and more accurate 
Reimplemented from MultipoleTBase.
Definition at line 63 of file MultipoleTStraight.cpp.
References MultipoleTBase::getFringeDeriv(), MultipoleTBase::getMaxOrder(), MultipoleTBase::getTransDeriv(), Hypervolume::n, and Attrib::Distribution::R.

      
  | 
  overrideprivatevirtual | 
Calculate fn(x, s) by expanding the differential operator (from Laplacian and scalar potential) in terms of polynomials
| n | -> nth derivative | 
| x | -> Coordinate x | 
| s | -> Coordinate s | 
Implements MultipoleTBase.
Definition at line 91 of file MultipoleTStraight.cpp.
References MultipoleTBase::getFringeDeriv(), MultipoleTBase::getTransDeriv(), and Hypervolume::n.

      
  | 
  inlineoverridevirtual | 
Return the cell geometry
Implements ElementBase.
Definition at line 173 of file MultipoleTStraight.h.
References straightGeometry_m.
      
  | 
  inlineoverridevirtual | 
Return the cell geometry
Implements ElementBase.
Definition at line 169 of file MultipoleTStraight.h.
References straightGeometry_m.
Referenced by OpalMultipoleTStraight::update().
      
  | 
  inlineoverrideprivatevirtual | 
Radius of curvature 
Straight magnet, infinite radius, infinity (1.0e300) is returned 
| s | -> Coordinate s | 
Implements MultipoleTBase.
Definition at line 160 of file MultipoleTStraight.h.
      
  | 
  inlineoverrideprivatevirtual | 
Returns the scale factor \( h_s = 1\)
| x | -> Coordinate x | 
| s | -> Coordinate s | 
Implements MultipoleTBase.
Definition at line 164 of file MultipoleTStraight.h.
      
  | 
  inlineoverridevirtual | 
Initialise the MultipoleT
| bunch | -> Bunch the global bunch object | 
| startField | -> Not used | 
| endField | -> Not used | 
Reimplemented from MultipoleTBase.
Definition at line 177 of file MultipoleTStraight.h.
References MultipoleTBase::getBoundingBoxLength(), Component::RefPartBunch_m, StraightGeometry::setElementLength(), and straightGeometry_m.

      
  | 
  private | 
      
  | 
  overridevirtual | 
Set the number of terms used in calculation of field components 
Maximum power of z in Bz is 2 * maxOrder_m 
| maxOrder | -> Number of terms in expansion in z | 
Reimplemented from MultipoleTBase.
Definition at line 59 of file MultipoleTStraight.cpp.
References MultipoleTBase::setMaxOrder().
Referenced by OpalMultipoleTStraight::update().

      
  | 
  inlineoverrideprivatevirtual | 
Transform B-field from Frenet-Serret coordinates to lab coordinates
Implements MultipoleTBase.
Definition at line 157 of file MultipoleTStraight.h.
      
  | 
  overrideprivatevirtual | 
Transform to Frenet-Serret coordinates for sector magnets
Implements MultipoleTBase.
Definition at line 55 of file MultipoleTStraight.cpp.
      
  | 
  private | 
Geometry
Definition at line 116 of file MultipoleTStraight.h.
Referenced by getGeometry(), and initialise().