28#include "gsl/gsl_sf_gamma.h"
29#include "gsl/gsl_sf_pow_int.h"
45 for(std::size_t i = 0; i <=
n; i++) {
49 f_n *= gsl_sf_pow_int(-1.0,
static_cast<int>(
n));
50 Bx += f_n * gsl_sf_pow_int(
R[1], 2 *
static_cast<int>(
n) + 1) / gsl_sf_fact(2 *
n + 1);
59 for(std::size_t i = 0; i <=
n; i++) {
63 f_n *= gsl_sf_pow_int(-1.0,
static_cast<int>(
n));
64 Bs += f_n * gsl_sf_pow_int(
R[1], 2 *
static_cast<int>(
n) + 1) / gsl_sf_fact(2 *
n + 1);
74 for (std::size_t i = 0; i <=
n; i++) {
78 f_n *= gsl_sf_pow_int(-1.0,
static_cast<int>(
n));
size_t getMaxFOrder() const
Get the number of terms used in calculation of field components.
double getFringeDeriv(const std::size_t &n, const double &s)
Returns the value of the fringe field n-th derivative at s.
double getLength() const
Get the length of the magnet.
double getTransDeriv(const std::size_t &n, const double &x) const
Returns the value of the transverse field n-th derivative at x Transverse field is a polynomial in x...
double getBs(const Vector_t &R) override
Get s-component of the B-field This function has been overloaded because calculating the B-field di...
double getFn(size_t n, double x, double s) override
Calculate fn(x, s) by expanding the differential operator (from Laplacian and scalar potential) in te...
StraightGeometry straightGeometry_m
Geometry.
MultipoleTStraight(MultipoleT *element)
Constructor.
void transformCoords(Vector_t &R) override
Transform to Frenet-Serret coordinates for sector magnets.
void initialise() override
Initialise the element.
Vector_t localCartesianToOpalCartesian(const Vector_t &r) override
double getBx(const Vector_t &R) override
Get x-component of the B-field This function has been overloaded because calculating the B-field di...
virtual void setElementLength(double length)
Set design length.