#include <HarmBasis3DCyl.h>
Public Member Functions | |
void | EvalBphi () |
void | EvalBr () |
void | EvalBz () |
void | EvalPtn () |
double | GetBphi (double *coeff) |
double | GetBphi_k (const unsigned k) |
double | GetBr (double *coeff) |
double | GetBr_k (const unsigned k) |
double | GetBz (double *coeff) |
double | GetBz_k (const unsigned k) |
unsigned | GetDim () |
unsigned | GetLen () |
void | GetLM (const unsigned j, int &Lj, int &Mj) |
double | GetPtn (double *coeff) |
double | GetPtn_k (const unsigned k) |
HarmBasis3DCyl (const unsigned N=18) | |
void | Print (std::ostream &out=std::cout) |
void | PrintBphiB (std::ostream &out=std::cout) |
void | PrintBrB (std::ostream &out=std::cout) |
void | PrintBzB (std::ostream &out=std::cout) |
void | PrintPtB (std::ostream &out=std::cout) |
void | SetPoint (const double r, const double z, const double phi) |
virtual | ~HarmBasis3DCyl () |
Private Member Functions | |
void | EvalRZ (harm_poly_arr &B, double *val) |
double | GetVal (double *coeff, double *basis) |
void | Print (harm_poly_arr &B, std::ostream &out=std::cout) |
Private Attributes | |
double * | Bphi_k |
harm_poly_arr | BphiB |
double * | Br_k |
harm_poly_arr | BrB |
double * | Bz_k |
harm_poly_arr | BzB |
unsigned | Dim |
int * | L_k |
unsigned | Len |
int * | M_k |
double * | P_k |
harm_poly_arr | PtB |
Definition at line 17 of file HarmBasis3DCyl.h.
HarmBasis3DCyl::HarmBasis3DCyl | ( | const unsigned | N = 18 | ) |
Definition at line 13 of file HarmBasis3DCyl.cc.
References Bphi_k, BphiB, Br_k, BrB, Bz_k, BzB, Dim, magfieldparam::poly2d_base::IncNPwr(), gen::k, dttmaxenums::L, L_k, Len, M_k, N, P_k, and PtB.
{ //Construct a basis of dimension N // Dim = N; Len = N*(N+2); L_k = new int [Len]; M_k = new int [Len]; P_k = new double [Len]; Br_k = new double [Len]; Bz_k = new double [Len]; Bphi_k = new double [Len]; PtB.reserve(N); BrB.reserve(N); BzB.reserve(N); BphiB.reserve(N); rz_harm_poly::IncNPwr(N); //In order to prevent GetMaxPow() calls unsigned M, vLen, k = 0; for (unsigned L = 1; L <= N; ++L) { vLen = L+1; harm_poly_vec Pt_vec; Pt_vec.reserve(vLen); harm_poly_vec Br_vec; Br_vec.reserve(vLen); harm_poly_vec Bz_vec; Bz_vec.reserve(vLen); harm_poly_vec Bphi_vec; Bphi_vec.reserve(vLen); Pt_vec.push_back (rz_harm_poly(L)); Br_vec.push_back (Pt_vec[0].GetDiff(0)); Bz_vec.push_back (Pt_vec[0].GetDiff(1)); Bphi_vec.push_back(rz_harm_poly()); Bphi_vec[0].CheatL(L); L_k[k] = L; M_k[k] = 0; ++k; for (M = 1; M <= L; ++M) { Pt_vec.push_back (Pt_vec[M-1].LadderUp()); Br_vec.push_back (Pt_vec[M].GetDiff(0)); Bz_vec.push_back (Pt_vec[M].GetDiff(1)); Bphi_vec.push_back(Pt_vec[M].GetDecPow(0)); Bphi_vec[M].Scale(M); L_k[k] = L; M_k[k] = M; ++k; L_k[k] = L; M_k[k] = -M; ++k; } PtB.push_back (Pt_vec); BrB.push_back (Br_vec); BzB.push_back (Bz_vec); BphiB.push_back(Bphi_vec); } }
HarmBasis3DCyl::~HarmBasis3DCyl | ( | ) | [virtual] |
void HarmBasis3DCyl::EvalBphi | ( | ) |
Definition at line 98 of file HarmBasis3DCyl.cc.
References Bphi_k, BphiB, Dim, magfieldparam::poly2d_base::Eval(), magfieldparam::rz_harm_poly::GetCos(), magfieldparam::rz_harm_poly::GetSin(), gen::k, dttmaxenums::L, and P.
Referenced by magfieldparam::BFit3D::GetField().
{ //Fills the array Bphi_k[Len] with values of phi-basis polynomials. // unsigned M; double V; double *val = Bphi_k; rz_harm_poly *P; for (unsigned L = 1, k = 0; L <= Dim; ++L, ++k) { (*val) = 0.; ++val; for (M = 1; M <= L; ++M) { P = &(BphiB[k][M]); V = P->Eval(); (*val) = -V*P->GetSin(); ++val; (*val) = V*P->GetCos(); ++val; } } }
void magfieldparam::HarmBasis3DCyl::EvalBr | ( | ) | [inline] |
Definition at line 51 of file HarmBasis3DCyl.h.
References Br_k, BrB, and EvalRZ().
Referenced by magfieldparam::BFit3D::GetField().
void magfieldparam::HarmBasis3DCyl::EvalBz | ( | ) | [inline] |
Definition at line 52 of file HarmBasis3DCyl.h.
References Bz_k, BzB, and EvalRZ().
Referenced by magfieldparam::BFit3D::GetField().
void magfieldparam::HarmBasis3DCyl::EvalPtn | ( | ) | [inline] |
void HarmBasis3DCyl::EvalRZ | ( | harm_poly_arr & | B, |
double * | val | ||
) | [private] |
Definition at line 78 of file HarmBasis3DCyl.cc.
References Dim, magfieldparam::poly2d_base::Eval(), magfieldparam::rz_harm_poly::GetCos(), magfieldparam::rz_harm_poly::GetSin(), gen::k, dttmaxenums::L, and P.
Referenced by EvalBr(), EvalBz(), and EvalPtn().
{ //Fills the linear array val[Len] with values of basis polynomials. //Private function, intended for internal use only. // unsigned M; double V; rz_harm_poly *P; for (unsigned L = 1, k = 0; L <= Dim; ++L, ++k) { (*val) = B[k][0].Eval(); ++val; for (M = 1; M <= L; ++M) { P = &(B[k][M]); V = P->Eval(); (*val) = V*P->GetCos(); ++val; (*val) = V*P->GetSin(); ++val; } } }
double magfieldparam::HarmBasis3DCyl::GetBphi | ( | double * | coeff | ) | [inline] |
Definition at line 68 of file HarmBasis3DCyl.h.
References Bphi_k, and GetVal().
Referenced by magfieldparam::BFit3D::GetField().
double magfieldparam::HarmBasis3DCyl::GetBphi_k | ( | const unsigned | k | ) | [inline] |
Definition at line 60 of file HarmBasis3DCyl.h.
References Bphi_k, and gen::k.
Referenced by magfieldparam::BFit3D::GetBphi_k().
double magfieldparam::HarmBasis3DCyl::GetBr | ( | double * | coeff | ) | [inline] |
Definition at line 66 of file HarmBasis3DCyl.h.
References Br_k, and GetVal().
Referenced by magfieldparam::BFit3D::GetField().
double magfieldparam::HarmBasis3DCyl::GetBr_k | ( | const unsigned | k | ) | [inline] |
Definition at line 58 of file HarmBasis3DCyl.h.
Referenced by magfieldparam::BFit3D::GetBr_k().
double magfieldparam::HarmBasis3DCyl::GetBz | ( | double * | coeff | ) | [inline] |
Definition at line 67 of file HarmBasis3DCyl.h.
References Bz_k, and GetVal().
Referenced by magfieldparam::BFit3D::GetField().
double magfieldparam::HarmBasis3DCyl::GetBz_k | ( | const unsigned | k | ) | [inline] |
Definition at line 59 of file HarmBasis3DCyl.h.
Referenced by magfieldparam::BFit3D::GetBz_k().
unsigned magfieldparam::HarmBasis3DCyl::GetDim | ( | ) | [inline] |
unsigned magfieldparam::HarmBasis3DCyl::GetLen | ( | ) | [inline] |
Definition at line 41 of file HarmBasis3DCyl.h.
References Len.
Referenced by magfieldparam::BFit3D::GetLen().
{ return Len;}
void magfieldparam::HarmBasis3DCyl::GetLM | ( | const unsigned | j, |
int & | Lj, | ||
int & | Mj | ||
) | [inline] |
double magfieldparam::HarmBasis3DCyl::GetPtn | ( | double * | coeff | ) | [inline] |
double magfieldparam::HarmBasis3DCyl::GetPtn_k | ( | const unsigned | k | ) | [inline] |
double HarmBasis3DCyl::GetVal | ( | double * | coeff, |
double * | basis | ||
) | [private] |
Definition at line 118 of file HarmBasis3DCyl.cc.
void HarmBasis3DCyl::Print | ( | std::ostream & | out = std::cout | ) |
Definition at line 145 of file HarmBasis3DCyl.cc.
References PrintBphiB(), PrintBrB(), PrintBzB(), and PrintPtB().
{ out << "BASIS POLYNOMIALS FOR THE POTENTIAL:\n" << std::endl; PrintPtB(out); out << "\nBASIS POLYNOMIALS FOR R-COMPONENT OF THE FIELD:\n" << std::endl; PrintBrB(out); out << "\nBASIS POLYNOMIALS FOR Z-COMPONENT OF THE FIELD:\n" << std::endl; PrintBzB(out); out << "\nBASIS POLYNOMIALS FOR PHI-COMPONENT OF THE FIELD:\n" << std::endl; PrintBphiB(out); }
void HarmBasis3DCyl::Print | ( | harm_poly_arr & | B, |
std::ostream & | out = std::cout |
||
) | [private] |
Definition at line 129 of file HarmBasis3DCyl.cc.
Referenced by PrintBphiB(), PrintBrB(), PrintBzB(), magfieldparam::BFit3D::PrintPoly(), and PrintPtB().
{ unsigned jL, jM, wdt = 60; char fc1 = '-', fc0 = out.fill(fc1); for (jL = 0; jL < B.size(); ++jL) { out << std::setw(wdt) << fc1 << std::endl; out << "Basis subset " << jL+1 << std::endl; out << std::setw(wdt) << fc1 << std::endl; for (jM = 0; jM < B[jL].size(); ++jM) { B[jL][jM].Print(out); } } out.fill(fc0); }
void magfieldparam::HarmBasis3DCyl::PrintBphiB | ( | std::ostream & | out = std::cout | ) | [inline] |
Definition at line 73 of file HarmBasis3DCyl.h.
References BphiB, dbtoconf::out, and Print().
Referenced by Print(), and magfieldparam::BFit3D::PrintBphiPoly().
void magfieldparam::HarmBasis3DCyl::PrintBrB | ( | std::ostream & | out = std::cout | ) | [inline] |
Definition at line 71 of file HarmBasis3DCyl.h.
References BrB, dbtoconf::out, and Print().
Referenced by Print(), and magfieldparam::BFit3D::PrintBrPoly().
void magfieldparam::HarmBasis3DCyl::PrintBzB | ( | std::ostream & | out = std::cout | ) | [inline] |
Definition at line 72 of file HarmBasis3DCyl.h.
References BzB, dbtoconf::out, and Print().
Referenced by Print(), and magfieldparam::BFit3D::PrintBzPoly().
void magfieldparam::HarmBasis3DCyl::PrintPtB | ( | std::ostream & | out = std::cout | ) | [inline] |
Definition at line 70 of file HarmBasis3DCyl.h.
References dbtoconf::out, Print(), and PtB.
Referenced by Print(), and magfieldparam::BFit3D::PrintPtnPoly().
void magfieldparam::HarmBasis3DCyl::SetPoint | ( | const double | r, |
const double | z, | ||
const double | phi | ||
) | [inline] |
Definition at line 45 of file HarmBasis3DCyl.h.
Referenced by magfieldparam::BFit3D::GetField().
{ rz_harm_poly::SetPoint(r, z, phi);}
double * magfieldparam::HarmBasis3DCyl::Bphi_k [private] |
Definition at line 24 of file HarmBasis3DCyl.h.
Referenced by EvalBphi(), GetBphi(), GetBphi_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().
Definition at line 29 of file HarmBasis3DCyl.h.
Referenced by EvalBphi(), HarmBasis3DCyl(), and PrintBphiB().
double * magfieldparam::HarmBasis3DCyl::Br_k [private] |
Definition at line 24 of file HarmBasis3DCyl.h.
Referenced by EvalBr(), GetBr(), GetBr_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().
Definition at line 27 of file HarmBasis3DCyl.h.
Referenced by EvalBr(), HarmBasis3DCyl(), and PrintBrB().
double * magfieldparam::HarmBasis3DCyl::Bz_k [private] |
Definition at line 24 of file HarmBasis3DCyl.h.
Referenced by EvalBz(), GetBz(), GetBz_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().
Definition at line 28 of file HarmBasis3DCyl.h.
Referenced by EvalBz(), HarmBasis3DCyl(), and PrintBzB().
unsigned magfieldparam::HarmBasis3DCyl::Dim [private] |
Definition at line 20 of file HarmBasis3DCyl.h.
Referenced by EvalBphi(), EvalRZ(), GetDim(), and HarmBasis3DCyl().
int* magfieldparam::HarmBasis3DCyl::L_k [private] |
Definition at line 23 of file HarmBasis3DCyl.h.
Referenced by GetLM(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().
unsigned magfieldparam::HarmBasis3DCyl::Len [private] |
Definition at line 21 of file HarmBasis3DCyl.h.
Referenced by GetLen(), GetVal(), and HarmBasis3DCyl().
int * magfieldparam::HarmBasis3DCyl::M_k [private] |
Definition at line 23 of file HarmBasis3DCyl.h.
Referenced by GetLM(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().
double* magfieldparam::HarmBasis3DCyl::P_k [private] |
Definition at line 24 of file HarmBasis3DCyl.h.
Referenced by EvalPtn(), GetPtn(), GetPtn_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().
Definition at line 26 of file HarmBasis3DCyl.h.
Referenced by EvalPtn(), HarmBasis3DCyl(), and PrintPtB().