OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
endfieldmodel::AsymmetricEnge Class Reference

Calculate the AsymmetricEnge function (e.g. More...

#include <AsymmetricEnge.h>

Inheritance diagram for endfieldmodel::AsymmetricEnge:
Inheritance graph
Collaboration diagram for endfieldmodel::AsymmetricEnge:
Collaboration graph

Public Member Functions

 AsymmetricEnge ()
 Default constructor. More...
 
 AsymmetricEnge (const std::vector< double > aStart, double x0Start, double lambdaStart, const std::vector< double > aEnd, double x0End, double lambdaEnd)
 Constructor taking enge parameters. More...
 
AsymmetricEngeclone () const
 Inheritable copy constructor. More...
 
std::ostream & print (std::ostream &out) const
 Print a human-readable description of the end field model. More...
 
double function (double x, int n) const
 Return the value of enge at some point x. More...
 
double getCentreLength () const
 Centre length is the average of x0End and x0Start. More...
 
double getEndLength () const
 End length is the average of lambdaEnd and lambdaStart. More...
 
std::shared_ptr< EngegetEngeStart () const
 Get the enge function for the magnet entrance. More...
 
void setEngeStart (std::shared_ptr< Enge > eStart)
 Set the enge function for the magnet entrance. More...
 
std::shared_ptr< EngegetEngeEnd () const
 Get the enge function for the magnet exit. More...
 
void setEngeEnd (std::shared_ptr< Enge > eEnd)
 Set the enge function for the magnet exit. More...
 
double getX0Start () const
 Return x0Start, offset of the start Enge. More...
 
void setX0Start (double x0)
 Set x0Start, offset of the start Enge. More...
 
double getX0End () const
 Return x0End, offset of the end Enge. More...
 
void setX0End (double x0)
 Set x0End, offset of the end Enge. More...
 
void setMaximumDerivative (size_t n)
 Setup the Enge recursion for derivatives. More...
 
void rescale (double scaleFactor)
 Rescale the Enge to a new length scale. More...
 

Static Public Member Functions

static std::shared_ptr< EndFieldModelgetEndFieldModel (std::string name)
 Look up the EndFieldModel that has a given name. More...
 
static void setEndFieldModel (std::string name, std::shared_ptr< EndFieldModel > efm)
 Add a value to the lookup table. More...
 
static std::string getName (std::shared_ptr< EndFieldModel > efm)
 Get the name corresponding to a given EndFieldModel. More...
 

Private Member Functions

 AsymmetricEnge (const AsymmetricEnge &rhs)
 

Private Attributes

std::shared_ptr< EngeengeStart_m
 
std::shared_ptr< EngeengeEnd_m
 

Static Private Attributes

static std::map< std::string, std::shared_ptr< EndFieldModel > > efm_map
 

Detailed Description

Calculate the AsymmetricEnge function (e.g.

for multipole end fields).

AsymmetricEnge function is given by
\(T(x) = (tanh( (x+x0)/\lambda )-tanh( (x-x0)/\lambda ))/2\)
The derivatives of tanh(x) are given by
\(d^p tanh(x)/dx^p = \sum_q I_{pq} tanh^{q}(x)\)
where \(I_{pq}\) are calculated using some recursion relation. Using these expressions, one can calculate a recursion relation for higher order derivatives and hence calculate analytical derivatives at arbitrary order.

Definition at line 50 of file AsymmetricEnge.h.

Constructor & Destructor Documentation

◆ AsymmetricEnge() [1/3]

endfieldmodel::AsymmetricEnge::AsymmetricEnge ( )

Default constructor.

Definition at line 5 of file AsymmetricEnge.cpp.

Referenced by clone().

◆ AsymmetricEnge() [2/3]

endfieldmodel::AsymmetricEnge::AsymmetricEnge ( const std::vector< double >  aStart,
double  x0Start,
double  lambdaStart,
const std::vector< double >  aEnd,
double  x0End,
double  lambdaEnd 
)

Constructor taking enge parameters.

Definition at line 13 of file AsymmetricEnge.cpp.

References engeEnd_m, and engeStart_m.

◆ AsymmetricEnge() [3/3]

endfieldmodel::AsymmetricEnge::AsymmetricEnge ( const AsymmetricEnge rhs)
private

Definition at line 9 of file AsymmetricEnge.cpp.

Member Function Documentation

◆ clone()

AsymmetricEnge * endfieldmodel::AsymmetricEnge::clone ( ) const
inlinevirtual

Inheritable copy constructor.

We take a deep copy of the engeStart and engeEnd

Implements endfieldmodel::EndFieldModel.

Definition at line 160 of file AsymmetricEnge.h.

References AsymmetricEnge().

Here is the call graph for this function:

◆ function()

double endfieldmodel::AsymmetricEnge::function ( double  x,
int  n 
) const
inlinevirtual

Return the value of enge at some point x.

Implements endfieldmodel::EndFieldModel.

Definition at line 144 of file AsymmetricEnge.h.

References engeEnd_m, engeStart_m, and Hypervolume::n.

◆ getCentreLength()

double endfieldmodel::AsymmetricEnge::getCentreLength ( ) const
inlinevirtual

Centre length is the average of x0End and x0Start.

Implements endfieldmodel::EndFieldModel.

Definition at line 168 of file AsymmetricEnge.h.

References engeEnd_m, and engeStart_m.

◆ getEndFieldModel()

std::shared_ptr< EndFieldModel > endfieldmodel::EndFieldModel::getEndFieldModel ( std::string  name)
staticinherited

Look up the EndFieldModel that has a given name.

Parameters
namename of the EndFieldModel
Returns
shared_ptr to the appropriate EndFieldModel.
Exceptions
GeneralClassicExceptionif name is not recognised

Definition at line 63 of file EndFieldModel.cpp.

References endfieldmodel::EndFieldModel::efm_map, and name.

Referenced by PyOpal::PyEndFieldModel::function(), and ScalingFFAMagnet::setupEndField().

◆ getEndLength()

double endfieldmodel::AsymmetricEnge::getEndLength ( ) const
inlinevirtual

End length is the average of lambdaEnd and lambdaStart.

Implements endfieldmodel::EndFieldModel.

Definition at line 172 of file AsymmetricEnge.h.

References engeEnd_m, and engeStart_m.

◆ getEngeEnd()

std::shared_ptr< Enge > endfieldmodel::AsymmetricEnge::getEngeEnd ( ) const
inline

Get the enge function for the magnet exit.

Definition at line 118 of file AsymmetricEnge.h.

References engeEnd_m.

◆ getEngeStart()

std::shared_ptr< Enge > endfieldmodel::AsymmetricEnge::getEngeStart ( ) const
inline

Get the enge function for the magnet entrance.

Definition at line 115 of file AsymmetricEnge.h.

References engeStart_m.

◆ getName()

std::string endfieldmodel::EndFieldModel::getName ( std::shared_ptr< EndFieldModel efm)
staticinherited

Get the name corresponding to a given EndFieldModel.

Parameters
efmEndFieldModel to lookup
Returns
name corresponding to the EndFieldModel. Note that this just does a dumb loop over the stored map values; so O(N).
Exceptions
GeneralClassicExceptionif efm is not recognised

Definition at line 77 of file EndFieldModel.cpp.

References endfieldmodel::EndFieldModel::efm_map.

◆ getX0End()

double endfieldmodel::AsymmetricEnge::getX0End ( ) const
inline

Return x0End, offset of the end Enge.

Definition at line 132 of file AsymmetricEnge.h.

References engeEnd_m.

◆ getX0Start()

double endfieldmodel::AsymmetricEnge::getX0Start ( ) const
inline

Return x0Start, offset of the start Enge.

Definition at line 128 of file AsymmetricEnge.h.

References engeStart_m.

◆ print()

std::ostream & endfieldmodel::AsymmetricEnge::print ( std::ostream &  out) const
virtual

Print a human-readable description of the end field model.

Implements endfieldmodel::EndFieldModel.

Definition at line 34 of file AsymmetricEnge.cpp.

References engeStart_m.

◆ rescale()

void endfieldmodel::AsymmetricEnge::rescale ( double  scaleFactor)
virtual

Rescale the Enge to a new length scale.

Implements endfieldmodel::EndFieldModel.

Definition at line 29 of file AsymmetricEnge.cpp.

References engeEnd_m, and engeStart_m.

◆ setEndFieldModel()

void endfieldmodel::EndFieldModel::setEndFieldModel ( std::string  name,
std::shared_ptr< EndFieldModel efm 
)
staticinherited

Add a value to the lookup table.

Parameters
namename of the EndFieldModel. If name already exists in the map, it is overwritten with the new value.
efmshared_ptr to the EndFieldModel.

Definition at line 72 of file EndFieldModel.cpp.

References endfieldmodel::EndFieldModel::efm_map, and name.

Referenced by OpalScalingFFAMagnet::setupDefaultEndField(), OpalAsymmetricEnge::update(), and OpalEnge::update().

◆ setEngeEnd()

void endfieldmodel::AsymmetricEnge::setEngeEnd ( std::shared_ptr< Enge eEnd)
inline

Set the enge function for the magnet exit.

Definition at line 124 of file AsymmetricEnge.h.

References engeEnd_m.

◆ setEngeStart()

void endfieldmodel::AsymmetricEnge::setEngeStart ( std::shared_ptr< Enge eStart)
inline

Set the enge function for the magnet entrance.

Definition at line 121 of file AsymmetricEnge.h.

References engeStart_m.

◆ setMaximumDerivative()

void endfieldmodel::AsymmetricEnge::setMaximumDerivative ( size_t  n)
inlinevirtual

Setup the Enge recursion for derivatives.

Implements endfieldmodel::EndFieldModel.

Definition at line 164 of file AsymmetricEnge.h.

References Hypervolume::n, and endfieldmodel::Enge::setEngeDiffIndices().

Here is the call graph for this function:

◆ setX0End()

void endfieldmodel::AsymmetricEnge::setX0End ( double  x0)
inline

Set x0End, offset of the end Enge.

Definition at line 140 of file AsymmetricEnge.h.

References engeEnd_m.

◆ setX0Start()

void endfieldmodel::AsymmetricEnge::setX0Start ( double  x0)
inline

Set x0Start, offset of the start Enge.

Definition at line 136 of file AsymmetricEnge.h.

References engeStart_m.

Member Data Documentation

◆ efm_map

std::map< std::string, std::shared_ptr< EndFieldModel > > endfieldmodel::EndFieldModel::efm_map
staticprivateinherited

◆ engeEnd_m

std::shared_ptr<Enge> endfieldmodel::AsymmetricEnge::engeEnd_m
private

◆ engeStart_m

std::shared_ptr<Enge> endfieldmodel::AsymmetricEnge::engeStart_m
private

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