|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
#include <Enge.h>
Public Member Functions | |
| Enge () | |
| Enge (const std::vector< double > a, double x0, double lambda) | |
| ~Enge () | |
| Enge * | clone () const |
| void | rescale (double scaleFactor) |
| double | function (double x, int n) const |
| double | getEndLength () const |
| double | getCentreLength () const |
| std::ostream & | print (std::ostream &out) const |
| std::vector< double > | getCoefficients () const |
| void | setCoefficients (std::vector< double > a) |
| double | getLambda () const |
| void | setLambda (double lambda) |
| double | getX0 () const |
| void | setX0 (double x0) |
| void | setMaximumDerivative (size_t n) |
| double | getEnge (double x, int n) const |
| double | getDoubleEnge (double x, int n) const |
| double | hN (double x, int n) const |
| double | gN (double x, int n) const |
Static Public Member Functions | |
| static void | setEngeDiffIndices (size_t n) |
| static std::vector< std::vector< int > > | getQIndex (int n) |
| static std::vector< std::vector< int > > | getHIndex (int n) |
| static std::shared_ptr< EndFieldModel > | getEndFieldModel (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 | |
| Enge (const Enge &enge) | |
| Enge & | operator= (const Enge &enge) |
Private Attributes | |
| std::vector< double > | _a |
| double | _lambda |
| double | _x0 |
Static Private Attributes | |
| static std::vector< std::vector< std::vector< int > > > | _q |
| static std::vector< std::vector< std::vector< int > > > | _h |
| static std::map< std::string, std::shared_ptr< EndFieldModel > > | efm_map |
Enge class is a symmetric Enge function for analytical field models
Enge function is
\(f(x) = 1/(1+exp(h(x-x0)))+1/(1+exp(h(-x-x0)))-1\).
where h is a polynomial in x/lambda with polynomial coefficients a
|
inline |
Default constructor
Definition at line 50 of file Enge.h.
References _a, _lambda, and setEngeDiffIndices().
Referenced by clone(), Enge(), and operator=().
| endfieldmodel::Enge::Enge | ( | const std::vector< double > | a, |
| double | x0, | ||
| double | lambda ) |
|
inline |
|
private |
|
virtual |
|
inlinevirtual |
Return the value of enge(x+x0) + enge(-x-x0) at some point x
Implements endfieldmodel::EndFieldModel.
Definition at line 155 of file Enge.h.
References getDoubleEnge().
|
inlinevirtual |
Nominal centre length is x0/2
Implements endfieldmodel::EndFieldModel.
Definition at line 176 of file Enge.h.
References _x0.
|
inline |
|
inline |
Returns \(Enge(x-x0) + Enge(-x-x0)-1\) and its derivatives
Definition at line 167 of file Enge.h.
References _x0, and getEnge().
Referenced by function().
|
staticinherited |
Look up the EndFieldModel that has a given name
| name | name of the EndFieldModel |
| GeneralClassicException | if name is not recognised |
Definition at line 63 of file EndFieldModel.cpp.
Referenced by PyOpal::PyEndFieldModel::function(), and ScalingFFAMagnet::setupEndField().
|
inlinevirtual |
Nominal end length is lambda
Implements endfieldmodel::EndFieldModel.
Definition at line 180 of file Enge.h.
References _lambda.
| double endfieldmodel::Enge::getEnge | ( | double | x, |
| int | n ) const |
Returns the value of the Enge function or its \(n^{th}\) derivative.
Please call setEngeDiffIndices(n) before calling if n > max_index
Definition at line 40 of file Enge.cpp.
References getQIndex(), and gN().
Referenced by getDoubleEnge().
|
inlinestatic |
|
inline |
|
staticinherited |
Get the name corresponding to a given EndFieldModel
| efm | EndFieldModel to lookup |
| GeneralClassicException | if efm is not recognised |
Definition at line 77 of file EndFieldModel.cpp.
References efm_map.
|
inlinestatic |
|
inline |
| double endfieldmodel::Enge::gN | ( | double | x, |
| int | n ) const |
| double endfieldmodel::Enge::hN | ( | double | x, |
| int | n ) const |
|
virtual |
|
virtual |
Rescale so Enge(x) -> Enge(scaleFactor*x)
Sets x0 to scaleFactor*x0 and lambda to scaleFactor*lambda
Implements endfieldmodel::EndFieldModel.
|
inline |
|
staticinherited |
Add a value to the lookup table
| name | name of the EndFieldModel. If name already exists in the map, it is overwritten with the new value. |
| efm | shared_ptr to the EndFieldModel. |
Definition at line 72 of file EndFieldModel.cpp.
Referenced by OpalScalingFFAMagnet::setupDefaultEndField(), OpalAsymmetricEnge::update(), and OpalEnge::update().
|
static |
Recursively calculate the indices for Enge and H
This will calculate the indices for Enge and H that are required to calculate the differential up to order n.
Definition at line 91 of file Enge.cpp.
References _h, _q, and endfieldmodel::CompactVector().
Referenced by Enge(), endfieldmodel::AsymmetricEnge::setMaximumDerivative(), and setMaximumDerivative().
|
inline |
|
inlinevirtual |
Calls setEngeDiffIndices to set the maximum derivative
Implements endfieldmodel::EndFieldModel.
Definition at line 151 of file Enge.h.
References setEngeDiffIndices().
|
inline |
|
private |
Definition at line 142 of file Enge.h.
Referenced by clone(), Enge(), Enge(), getCoefficients(), hN(), print(), and setCoefficients().
|
staticprivate |
Indexes the derivatives of g in terms of h
Definition at line 148 of file Enge.h.
Referenced by getHIndex(), gN(), and setEngeDiffIndices().
|
private |
Definition at line 143 of file Enge.h.
Referenced by clone(), Enge(), Enge(), getEndLength(), getLambda(), hN(), print(), rescale(), and setLambda().
|
staticprivate |
Indexes the derivatives of enge in terms of g
Definition at line 146 of file Enge.h.
Referenced by getQIndex(), and setEngeDiffIndices().
|
private |
Definition at line 143 of file Enge.h.
Referenced by clone(), Enge(), getCentreLength(), getDoubleEnge(), getX0(), print(), rescale(), and setX0().
|
staticprivateinherited |
Definition at line 108 of file EndFieldModel.h.
Referenced by getEndFieldModel(), getName(), and setEndFieldModel().