|
OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
|
#include <Tanh.h>
Public Member Functions | |
| Tanh (double x0, double lambda, int max_index) | |
| Tanh () | |
| Tanh (const Tanh &rhs) | |
| ~Tanh () | |
| Tanh * | clone () const |
| void | rescale (double scaleFactor) |
| double | function (double x, int n) const |
| double | getCentreLength () const |
| double | getEndLength () const |
| double | getTanh (double x, int n) const |
| double | getNegTanh (double x, int n) const |
| double | getLambda () const |
| double | getX0 () const |
| void | setLambda (double lambda) |
| void | setX0 (double x0) |
| virtual void | setMaximumDerivative (size_t n) |
| std::ostream & | print (std::ostream &out) const |
Static Public Member Functions | |
| static std::vector< std::vector< int > > | getTanhDiffIndices (size_t n) |
| static void | setTanhDiffIndices (size_t 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 Attributes | |
| double | _x0 |
| double | _lambda |
Static Private Attributes | |
| static std::vector< std::vector< std::vector< int > > > | _tdi |
| static std::map< std::string, std::shared_ptr< EndFieldModel > > | efm_map |
Calculate the Tanh function (e.g. for multipole end fields).
DoubleTanh 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.
| endfieldmodel::Tanh::Tanh | ( | double | x0, |
| double | lambda, | ||
| int | max_index ) |
Create a double tanh function
Here x0 is the centre length and lambda is the end length. max_index is used to set up for differentiation - don't try to calculate higher differentials than exist in max_index.
Definition at line 39 of file Tanh.cpp.
References _lambda, _x0, and setTanhDiffIndices().
Referenced by clone(), and Tanh().
|
inline |
|
inline |
| endfieldmodel::Tanh::~Tanh | ( | ) |
|
virtual |
Inherited copy constructor.
Implements endfieldmodel::EndFieldModel.
Definition at line 45 of file Tanh.cpp.
References Tanh(), and Tanh().
|
virtual |
Double Tanh is given by
\(d(x) = \)
Implements endfieldmodel::EndFieldModel.
Definition at line 72 of file Tanh.cpp.
References getNegTanh(), and getTanh().
|
inlinevirtual |
Nominal flat top length is twice x0 (one x0 in each direction)
Implements endfieldmodel::EndFieldModel.
Definition at line 79 of file Tanh.h.
References getX0().
|
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 efm_map.
Referenced by ScalingFFAMagnet::setupEndField().
|
inlinevirtual |
Return nominal fringe field length
Implements endfieldmodel::EndFieldModel.
Definition at line 82 of file Tanh.h.
References getLambda().
|
inline |
Return lambda (end length)
Definition at line 101 of file Tanh.h.
References _lambda.
Referenced by getEndLength().
|
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.
| double endfieldmodel::Tanh::getNegTanh | ( | double | x, |
| int | n ) const |
| double endfieldmodel::Tanh::getTanh | ( | double | x, |
| int | n ) const |
|
static |
Get all the tanh differential indices \(I_{pq}\).
Returns vector of vector of ints where p indexes the differential and q indexes the tanh power - so
Definition at line 107 of file Tanh.cpp.
References _tdi, and setTanhDiffIndices().
|
inline |
Return x0 (flat top length)
Definition at line 104 of file Tanh.h.
References _x0.
Referenced by getCentreLength().
|
virtual |
Prints a human readable string to out
Implements endfieldmodel::EndFieldModel.
|
virtual |
Rescale the end field by a factor x0
Implements endfieldmodel::EndFieldModel.
|
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 efm_map.
|
inline |
Set lambda (end length)
Definition at line 107 of file Tanh.h.
References _lambda.
Referenced by OpalVerticalFFAMagnet::update().
|
virtual |
Set the maximum derivative prior to tracking
Implements endfieldmodel::EndFieldModel.
Definition at line 76 of file Tanh.cpp.
References setTanhDiffIndices().
|
static |
Set the value of tanh differential indices to nth order differentials.
Definition at line 81 of file Tanh.cpp.
References _tdi, and endfieldmodel::CompactVector().
Referenced by getTanhDiffIndices(), setMaximumDerivative(), Tanh(), Tanh(), and OpalVerticalFFAMagnet::update().
|
inline |
Set x0 (flat top length)
Definition at line 110 of file Tanh.h.
References _x0.
Referenced by OpalVerticalFFAMagnet::update().
|
private |
Definition at line 118 of file Tanh.h.
Referenced by getLambda(), getNegTanh(), getTanh(), print(), rescale(), setLambda(), Tanh(), Tanh(), and Tanh().
|
staticprivate |
_tdi indexes powers of tanh in d^n tanh/dx^n as sum of powers of tanh
For some reason we index as n, +a, -a, but the third index is redundant
Definition at line 124 of file Tanh.h.
Referenced by getNegTanh(), getTanh(), getTanhDiffIndices(), and setTanhDiffIndices().
|
private |
|
staticprivateinherited |
Definition at line 108 of file EndFieldModel.h.
Referenced by getEndFieldModel(), getName(), and setEndFieldModel().