|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
Calculate the AsymmetricEnge function (e.g. More...
#include <AsymmetricEnge.h>


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... | |
| AsymmetricEnge * | clone () 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< Enge > | getEngeStart () 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< Enge > | getEngeEnd () 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< EndFieldModel > | getEndFieldModel (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< Enge > | engeStart_m |
| std::shared_ptr< Enge > | engeEnd_m |
Static Private Attributes | |
| static std::map< std::string, std::shared_ptr< EndFieldModel > > | efm_map |
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.
| endfieldmodel::AsymmetricEnge::AsymmetricEnge | ( | ) |
| 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.
|
private |
Definition at line 9 of file AsymmetricEnge.cpp.
|
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().

|
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.
|
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.
|
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.
References endfieldmodel::EndFieldModel::efm_map, and name.
Referenced by PyOpal::PyEndFieldModel::function(), and ScalingFFAMagnet::setupEndField().
|
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.
|
inline |
Get the enge function for the magnet exit.
Definition at line 118 of file AsymmetricEnge.h.
References engeEnd_m.
|
inline |
Get the enge function for the magnet entrance.
Definition at line 115 of file AsymmetricEnge.h.
References engeStart_m.
|
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 endfieldmodel::EndFieldModel::efm_map.
|
inline |
Return x0End, offset of the end Enge.
Definition at line 132 of file AsymmetricEnge.h.
References engeEnd_m.
|
inline |
Return x0Start, offset of the start Enge.
Definition at line 128 of file AsymmetricEnge.h.
References engeStart_m.
|
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.
|
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.
|
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.
References endfieldmodel::EndFieldModel::efm_map, and name.
Referenced by OpalScalingFFAMagnet::setupDefaultEndField(), OpalAsymmetricEnge::update(), and OpalEnge::update().
|
inline |
Set the enge function for the magnet exit.
Definition at line 124 of file AsymmetricEnge.h.
References engeEnd_m.
|
inline |
Set the enge function for the magnet entrance.
Definition at line 121 of file AsymmetricEnge.h.
References engeStart_m.
|
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().

|
inline |
Set x0End, offset of the end Enge.
Definition at line 140 of file AsymmetricEnge.h.
References engeEnd_m.
|
inline |
Set x0Start, offset of the start Enge.
Definition at line 136 of file AsymmetricEnge.h.
References engeStart_m.
|
staticprivateinherited |
Definition at line 108 of file EndFieldModel.h.
Referenced by endfieldmodel::EndFieldModel::getEndFieldModel(), endfieldmodel::EndFieldModel::getName(), and endfieldmodel::EndFieldModel::setEndFieldModel().
|
private |
Definition at line 112 of file AsymmetricEnge.h.
Referenced by AsymmetricEnge(), function(), getCentreLength(), getEndLength(), getEngeEnd(), getX0End(), rescale(), setEngeEnd(), and setX0End().
|
private |
Definition at line 111 of file AsymmetricEnge.h.
Referenced by AsymmetricEnge(), function(), getCentreLength(), getEndLength(), getEngeStart(), getX0Start(), print(), rescale(), setEngeStart(), and setX0Start().