OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VerticalFFAMagnet Class Reference

#include <VerticalFFAMagnet.h>

Inheritance diagram for VerticalFFAMagnet:
Inheritance graph
[legend]
Collaboration diagram for VerticalFFAMagnet:
Collaboration graph
[legend]

Public Member Functions

 VerticalFFAMagnet (const std::string &name)
 
 ~VerticalFFAMagnet ()
 
ElementBaseclone () const
 
bool apply (const size_t &i, const double &t, Vector_t &E, Vector_t &B)
 
bool apply (const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B)
 
bool getFieldValue (const Vector_t &R, Vector_t &B) const
 
void initialise (PartBunchBase< double, 3 > *bunch, double &startField, double &endField)
 
void initialise ()
 
void finalise ()
 
bool bends () const
 
void getDimensions (double &zBegin, double &zEnd) const
 
BGeometryBasegetGeometry ()
 
const BGeometryBasegetGeometry () const
 
EMFieldgetField ()
 
const EMFieldgetField () const
 
void accept (BeamlineVisitor &visitor) const
 
endfieldmodel::EndFieldModelgetEndField () const
 
void setEndField (endfieldmodel::EndFieldModel *endField)
 
size_t getMaxOrder () const
 
void setMaxOrder (size_t maxOrder)
 
double getB0 () const
 
void setB0 (double Bz)
 
double getFieldIndex () const
 
void setFieldIndex (double index)
 
double getNegativeVerticalExtent () const
 
void setNegativeVerticalExtent (double negativeExtent)
 
double getPositiveVerticalExtent () const
 
void setPositiveVerticalExtent (double positiveExtent)
 
double getBBLength () const
 
void setBBLength (double bbLength)
 
double getWidth () const
 
void setWidth (double width)
 
std::vector< std::vector
< double > > 
getDfCoefficients () const
 
- Public Member Functions inherited from Component
 Component (const std::string &name)
 Constructor with given name. More...
 
 Component ()
 
 Component (const Component &right)
 
virtual ~Component ()
 
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 void addKR (int i, double t, Vector_t &K)
 
virtual void addKT (int i, double t, Vector_t &K)
 
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 &R, const double &t, Vector_t &A, double &phi)
 
virtual double getDesignEnergy () const
 
virtual void setDesignEnergy (const double &energy, bool changeable)
 
virtual void goOnline (const double &kineticEnergy)
 
virtual void goOffline ()
 
virtual bool Online ()
 
virtual ElementBase::ElementType getType () const
 Get element type std::string. More...
 
virtual void setComponentType (std::string)
 
virtual std::string getComponentType () const
 
virtual const ElementBasegetDesign () 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...
 
std::string getTypeString () const
 
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 ChannelgetChannel (const std::string &aKey, bool create=false)
 Construct a read/write channel. More...
 
virtual const ConstChannelgetConstChannel (const std::string &aKey) const
 Construct a read-only channel. More...
 
virtual ElementImagegetImage () const
 Construct an image. More...
 
virtual ElementBasecopyStructure ()
 Make a structural copy. More...
 
bool isSharable () const
 Test if the element can be shared. More...
 
virtual void makeSharable ()
 Set sharable flag. More...
 
virtual ElementBasemakeAlignWrapper ()
 Allow misalignment. More...
 
virtual ElementBasemakeFieldWrapper ()
 Allow field errors. More...
 
virtual ElementBasemakeWrappers ()
 Allow errors. More...
 
virtual ElementBaseremoveAlignWrapper ()
 Remove align wrapper. More...
 
virtual const ElementBaseremoveAlignWrapper () const
 Remove align wrapper. More...
 
virtual ElementBaseremoveFieldWrapper ()
 Remove field wrapper. More...
 
virtual const ElementBaseremoveFieldWrapper () const
 Remove field wrapper. More...
 
virtual ElementBaseremoveWrappers ()
 Return the design element. More...
 
virtual const ElementBaseremoveWrappers () const
 Return the design element. More...
 
bool update (const AttributeSet &)
 Update element. More...
 
virtual void setBoundaryGeometry (BoundaryGeometry *geo)
 
virtual BoundaryGeometrygetBoundaryGeometry () 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 WakeFunctiongetWake () 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
 
ElemType getElType () const
 returns element type as enumeration needed in the envelope tracker More...
 
void setElType (ElemType elt)
 set the element type as enumeration needed in the envelope tracker More...
 
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
< ElementBase::ApertureType,
std::vector< double > > 
getAperture () const
 
virtual bool isInside (const Vector_t &r) const
 
void setMisalignment (double x, double y, double s)
 
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
 
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

void calculateDfCoefficients ()
 
 VerticalFFAMagnet (const VerticalFFAMagnet &right)
 
VerticalFFAMagnetoperator= (const VerticalFFAMagnet &rhs)
 

Private Attributes

StraightGeometry straightGeometry_m
 
BMultipoleField dummy
 
size_t maxOrder_m = 0
 
double k_m = 0.
 
double Bz_m = 0.
 
double zNegExtent_m = 0.
 
double zPosExtent_m = 0.
 
double halfWidth_m = 0.
 
double bbLength_m = 0.
 
std::unique_ptr
< endfieldmodel::EndFieldModel
endField_m
 
std::vector< std::vector
< double > > 
dfCoefficients_m
 
const double mm =1000.
 
const double Tesla =10.
 

Additional Inherited Members

- Public Types inherited from ElementBase
enum  ApertureType { RECTANGULAR, ELLIPTICAL, CONIC_RECTANGULAR, CONIC_ELLIPTICAL }
 
enum  ElementType {
  ALIGNWRAPPER, BEAMBEAM, BEAMBEAM3D, BEAMLINE,
  BEAMSTRIPPING, CCOLLIMATOR, CORRECTOR, CORRECTORWRAPPER,
  CYCLOTRON, CYCLOTRONWRAPPER, CYCLOTRONVALLEY, DEGRADER,
  DIAGNOSTIC, DRIFT, FLEXIBLECOLLIMATOR, INTEGRATOR,
  LAMBERTSON, MARKER, MONITOR, MPSPLITINTEGRATOR,
  MULTIPOLE, MULTIPOLET, MULTIPOLEWRAPPER, OFFSET,
  PARALLELPLATE, PATCH, PROBE, RBEND,
  RBEND3D, RBENDWRAPPER, RFCAVITY, RFQUADRUPOLE,
  RING, SBEND3D, SBEND, SBENDWRAPPER,
  SEPARATOR, SEPTUM, SOLENOID, SOURCE,
  STRIPPER, TRAVELINGWAVE, VARIABLERFCAVITY, ANY
}
 
- Static Public Member Functions inherited from ElementBase
static std::string getTypeString (ElementType type)
 
- Protected Member Functions inherited from ElementBase
bool isInsideTransverse (const Vector_t &r, double f=1) const
 
- Protected Member Functions inherited from RCObject
 RCObject ()
 Default constructor. More...
 
 RCObject (const RCObject &)
 Copy constructor. More...
 
virtual ~RCObject ()=0
 
RCObjectoperator= (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
 

Detailed Description

Bending magnet with an exponential dependence on field in the vertical plane

VerticalFFAMagnet makes a rectangular bending magnet with a dipole field that has a dependence like B0 exp(mz)

Definition at line 28 of file VerticalFFAMagnet.h.

Constructor & Destructor Documentation

VerticalFFAMagnet::VerticalFFAMagnet ( const std::string &  name)
explicit

Construct a new VerticalFFAMagnet

Parameters
nameUser-defined name of the VerticalFFAMagnet

Definition at line 15 of file VerticalFFAMagnet.cpp.

References isDrift, and ElementBase::setElType().

Referenced by clone().

Here is the call graph for this function:

VerticalFFAMagnet::~VerticalFFAMagnet ( )

Destructor - deletes the field

Definition at line 37 of file VerticalFFAMagnet.cpp.

VerticalFFAMagnet::VerticalFFAMagnet ( const VerticalFFAMagnet right)
private

Copy constructor

Definition at line 20 of file VerticalFFAMagnet.cpp.

References Component::RefPartBunch_m.

Member Function Documentation

void VerticalFFAMagnet::accept ( BeamlineVisitor visitor) const
virtual

Accept a beamline visitor

Implements ElementBase.

Definition at line 76 of file VerticalFFAMagnet.cpp.

References BeamlineVisitor::visitVerticalFFAMagnet().

Here is the call graph for this function:

bool VerticalFFAMagnet::apply ( const size_t &  i,
const double &  t,
Vector_t E,
Vector_t B 
)
inlinevirtual

Calculate the field at the position of the ith particle

Parameters
iindex of the particle event; field is calculated at this position
ttime at which the field is to be calculated
Ecalculated electric field - always 0 (no E-field)
Bcalculated magnetic field
Returns
true if particle is outside the field map

Reimplemented from Component.

Definition at line 218 of file VerticalFFAMagnet.h.

References PartBunchBase< T, Dim >::P, PartBunchBase< T, Dim >::R, and Component::RefPartBunch_m.

bool VerticalFFAMagnet::apply ( const Vector_t R,
const Vector_t P,
const double &  t,
Vector_t E,
Vector_t B 
)
inlinevirtual

Calculate the field at some arbitrary position

Parameters
Rposition in the local coordinate system of the magnet
Pnot used
tnot used
Enot used
Bcalculated magnetic field
Returns
true if particle is outside the field map, else false

Reimplemented from Component.

Definition at line 223 of file VerticalFFAMagnet.h.

References getFieldValue().

Here is the call graph for this function:

bool VerticalFFAMagnet::bends ( ) const
inlinevirtual

Return false - VerticalFFAMagnet is a straight magnet

Nb: the VerticalFFAMagnet geometry is straight even though trajectories are not

Implements Component.

Definition at line 97 of file VerticalFFAMagnet.h.

void VerticalFFAMagnet::calculateDfCoefficients ( )
private

Definition at line 122 of file VerticalFFAMagnet.cpp.

References dfCoefficients_m, k_m, maxOrder_m, and Hypervolume::n.

Referenced by initialise().

ElementBase * VerticalFFAMagnet::clone ( ) const
virtual

Inheritable copy constructor

Implements ElementBase.

Definition at line 40 of file VerticalFFAMagnet.cpp.

References initialise(), and VerticalFFAMagnet().

Here is the call graph for this function:

void VerticalFFAMagnet::finalise ( )
virtual

Finalise the VerticalFFAMagnet - sets bunch to NULL

Implements Component.

Definition at line 64 of file VerticalFFAMagnet.cpp.

References Component::RefPartBunch_m.

double VerticalFFAMagnet::getB0 ( ) const
inline

Get the centre field at z=0

Definition at line 140 of file VerticalFFAMagnet.h.

References Bz_m, and Tesla.

double VerticalFFAMagnet::getBBLength ( ) const
inline

Get the length of the bounding box (centred on magnet centre)

Definition at line 164 of file VerticalFFAMagnet.h.

References bbLength_m, and mm.

std::vector< std::vector< double > > VerticalFFAMagnet::getDfCoefficients ( ) const
inline

Get the coefficients used for the field expansion

B_y is given by sum_n B_0 exp(ky) f_n x^n where f_n = sum_k c_{nk} partial_k f_0

Returns a vector of vectors, like c[n][k]. The expansion for the other field elements can be related back to c[n][k] (see elsewhere for details).

Definition at line 228 of file VerticalFFAMagnet.h.

References dfCoefficients_m.

void VerticalFFAMagnet::getDimensions ( double &  zBegin,
double &  zEnd 
) const
inlinevirtual

Not implemented

Implements Component.

Definition at line 100 of file VerticalFFAMagnet.h.

endfieldmodel::EndFieldModel* VerticalFFAMagnet::getEndField ( ) const
inline

Get the fringe field

Returns the fringe field model; VerticalFFAMagnet retains ownership of the returned memory.

Definition at line 122 of file VerticalFFAMagnet.h.

References endField_m.

Referenced by OpalVerticalFFAMagnet::update().

EMField & VerticalFFAMagnet::getField ( )
virtual

Return a dummy (0.) field value (what is this for?)

Implements Component.

Definition at line 46 of file VerticalFFAMagnet.cpp.

References dummy.

const EMField & VerticalFFAMagnet::getField ( ) const
virtual

Return a dummy (0.) field value (what is this for?)

Implements Component.

Definition at line 50 of file VerticalFFAMagnet.cpp.

References dummy.

double VerticalFFAMagnet::getFieldIndex ( ) const
inline

Get the field index

Definition at line 146 of file VerticalFFAMagnet.h.

References k_m, and mm.

bool VerticalFFAMagnet::getFieldValue ( const Vector_t R,
Vector_t B 
) const

Calculate the field at some arbitrary position in cartesian coordinates

Parameters
Rposition in the local coordinate system of the bend, in cartesian coordinates defined like (x, y, z)
Bcalculated magnetic field defined like (Bx, By, Bz)
Returns
true if particle is outside the field map, else false

Definition at line 81 of file VerticalFFAMagnet.cpp.

References abs(), bbLength_m, Bz_m, dfCoefficients_m, endField_m, exp(), halfWidth_m, k_m, maxOrder_m, Hypervolume::n, zNegExtent_m, and zPosExtent_m.

Referenced by apply().

Here is the call graph for this function:

BGeometryBase & VerticalFFAMagnet::getGeometry ( )
virtual

Return the cell geometry

Implements ElementBase.

Definition at line 68 of file VerticalFFAMagnet.cpp.

References straightGeometry_m.

const BGeometryBase & VerticalFFAMagnet::getGeometry ( ) const
virtual

Return the cell geometry

Implements ElementBase.

Definition at line 72 of file VerticalFFAMagnet.cpp.

References straightGeometry_m.

size_t VerticalFFAMagnet::getMaxOrder ( ) const
inline

Get the maximum power of x used in the off-midplane expansion;

Definition at line 133 of file VerticalFFAMagnet.h.

References maxOrder_m.

double VerticalFFAMagnet::getNegativeVerticalExtent ( ) const
inline

Get the maximum extent below z = 0

Definition at line 152 of file VerticalFFAMagnet.h.

References mm, and zNegExtent_m.

double VerticalFFAMagnet::getPositiveVerticalExtent ( ) const
inline

Get the maximum extent above z = 0

Definition at line 158 of file VerticalFFAMagnet.h.

References mm, and zPosExtent_m.

double VerticalFFAMagnet::getWidth ( ) const
inline

Get the full width of the bounding box (centred on magnet centre)

Definition at line 170 of file VerticalFFAMagnet.h.

References halfWidth_m, and mm.

void VerticalFFAMagnet::initialise ( PartBunchBase< double, 3 > *  bunch,
double &  startField,
double &  endField 
)
virtual

Initialise the VerticalFFAMagnet

Parameters
bunchthe global bunch object (but not used)
startFieldnot used
endFieldnot used

Implements Component.

Definition at line 59 of file VerticalFFAMagnet.cpp.

References initialise(), and Component::RefPartBunch_m.

Referenced by clone(), and OpalVerticalFFAMagnet::update().

Here is the call graph for this function:

void VerticalFFAMagnet::initialise ( )

Initialise the VerticalFFAMagnet

Sets up the field expansion and the geometry; call after changing any field parameters

Definition at line 54 of file VerticalFFAMagnet.cpp.

References bbLength_m, calculateDfCoefficients(), StraightGeometry::setElementLength(), and straightGeometry_m.

Referenced by initialise().

Here is the call graph for this function:

VerticalFFAMagnet& VerticalFFAMagnet::operator= ( const VerticalFFAMagnet rhs)
private
void VerticalFFAMagnet::setB0 ( double  Bz)
inline

Set the centre field at z=0

Definition at line 143 of file VerticalFFAMagnet.h.

References Bz_m, and Tesla.

Referenced by OpalVerticalFFAMagnet::update().

void VerticalFFAMagnet::setBBLength ( double  bbLength)
inline

Set the length of the bounding box (centred on magnet centre)

Definition at line 167 of file VerticalFFAMagnet.h.

References bbLength_m, and mm.

Referenced by OpalVerticalFFAMagnet::update().

void VerticalFFAMagnet::setEndField ( endfieldmodel::EndFieldModel endField)

Set the fringe field

  • endField: the new fringe field; VerticalFFAMagnet takes ownership of the memory associated with endField.

Definition at line 143 of file VerticalFFAMagnet.cpp.

References endField_m.

Referenced by OpalVerticalFFAMagnet::OpalVerticalFFAMagnet().

void VerticalFFAMagnet::setFieldIndex ( double  index)
inline

Set the field index

Definition at line 149 of file VerticalFFAMagnet.h.

References k_m, and mm.

Referenced by OpalVerticalFFAMagnet::update().

void VerticalFFAMagnet::setMaxOrder ( size_t  maxOrder)
inline

Set the maximum power of x used in the off-midplane expansion;

Definition at line 137 of file VerticalFFAMagnet.h.

References maxOrder_m.

Referenced by OpalVerticalFFAMagnet::update().

void VerticalFFAMagnet::setNegativeVerticalExtent ( double  negativeExtent)
inline

Set the maximum extent below z = 0

Definition at line 210 of file VerticalFFAMagnet.h.

References mm, and zNegExtent_m.

Referenced by OpalVerticalFFAMagnet::update().

void VerticalFFAMagnet::setPositiveVerticalExtent ( double  positiveExtent)
inline

set the maximum extent above z = 0

Definition at line 214 of file VerticalFFAMagnet.h.

References mm, and zPosExtent_m.

Referenced by OpalVerticalFFAMagnet::update().

void VerticalFFAMagnet::setWidth ( double  width)
inline

Set the full width of the bounding box (centred on magnet centre)

Definition at line 173 of file VerticalFFAMagnet.h.

References halfWidth_m, and mm.

Referenced by OpalVerticalFFAMagnet::update().

Member Data Documentation

double VerticalFFAMagnet::bbLength_m = 0.
private

Definition at line 202 of file VerticalFFAMagnet.h.

Referenced by getBBLength(), getFieldValue(), initialise(), and setBBLength().

double VerticalFFAMagnet::Bz_m = 0.
private

Definition at line 198 of file VerticalFFAMagnet.h.

Referenced by getB0(), getFieldValue(), and setB0().

std::vector<std::vector<double> > VerticalFFAMagnet::dfCoefficients_m
private

Definition at line 204 of file VerticalFFAMagnet.h.

Referenced by calculateDfCoefficients(), getDfCoefficients(), and getFieldValue().

BMultipoleField VerticalFFAMagnet::dummy
private

Definition at line 194 of file VerticalFFAMagnet.h.

Referenced by getField().

std::unique_ptr<endfieldmodel::EndFieldModel> VerticalFFAMagnet::endField_m
private

Definition at line 203 of file VerticalFFAMagnet.h.

Referenced by getEndField(), getFieldValue(), and setEndField().

double VerticalFFAMagnet::halfWidth_m = 0.
private

Definition at line 201 of file VerticalFFAMagnet.h.

Referenced by getFieldValue(), getWidth(), and setWidth().

double VerticalFFAMagnet::k_m = 0.
private
size_t VerticalFFAMagnet::maxOrder_m = 0
private
const double VerticalFFAMagnet::mm =1000.
private
StraightGeometry VerticalFFAMagnet::straightGeometry_m
private

Definition at line 193 of file VerticalFFAMagnet.h.

Referenced by getGeometry(), and initialise().

const double VerticalFFAMagnet::Tesla =10.
private

Definition at line 207 of file VerticalFFAMagnet.h.

Referenced by getB0(), and setB0().

double VerticalFFAMagnet::zNegExtent_m = 0.
private
double VerticalFFAMagnet::zPosExtent_m = 0.
private

The documentation for this class was generated from the following files: