OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
endfieldmodel::AsymmetricEnge Class Reference

#include <AsymmetricEnge.h>

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

Public Member Functions

 AsymmetricEnge ()
 
 AsymmetricEnge (const std::vector< double > aStart, double x0Start, double lambdaStart, const std::vector< double > aEnd, double x0End, double lambdaEnd)
 
AsymmetricEngeclone () const
 
std::ostream & print (std::ostream &out) const
 
double function (double x, int n) const
 
double getCentreLength () const
 
double getEndLength () const
 
std::shared_ptr< EngegetEngeStart () const
 
void setEngeStart (std::shared_ptr< Enge > eStart)
 
std::shared_ptr< EngegetEngeEnd () const
 
void setEngeEnd (std::shared_ptr< Enge > eEnd)
 
double getX0Start () const
 
void setX0Start (double x0)
 
double getX0End () const
 
void setX0End (double x0)
 
void setMaximumDerivative (size_t n)
 
void rescale (double scaleFactor)
 

Static Public Member Functions

static std::shared_ptr< EndFieldModelgetEndFieldModel (std::string name)
 
static void setEndFieldModel (std::string name, std::shared_ptr< EndFieldModel > efm)
 
static std::string getName (std::shared_ptr< EndFieldModel > efm)
 

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 10 of file AsymmetricEnge.cpp.

References engeEnd_m, and engeStart_m.

◆ AsymmetricEnge() [3/3]

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

Definition at line 7 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 141 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 125 of file AsymmetricEnge.h.

References engeEnd_m, and engeStart_m.

◆ getCentreLength()

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

Centre length is the average of x0End and x0Start

Implements endfieldmodel::EndFieldModel.

Definition at line 145 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
GeneralOpalExceptionif name is not recognised

Definition at line 63 of file EndFieldModel.cpp.

References endfieldmodel::EndFieldModel::efm_map.

Referenced by ScalingFFAMagnet::setupEndField().

◆ getEndLength()

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

End length is the average of lambdaEnd and lambdaStart

Implements endfieldmodel::EndFieldModel.

Definition at line 149 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 113 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 112 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
GeneralOpalExceptionif 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 119 of file AsymmetricEnge.h.

References engeEnd_m.

◆ getX0Start()

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

Return x0Start, offset of the start Enge

Definition at line 117 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 28 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 23 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 73 of file EndFieldModel.cpp.

References endfieldmodel::EndFieldModel::efm_map.

◆ setEngeEnd()

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

Set the enge function for the magnet exit

Definition at line 115 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 114 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 143 of file AsymmetricEnge.h.

References 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 123 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 121 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: