CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HarmBasis3DCyl.h
Go to the documentation of this file.
1 #ifndef HarmBasis3DCyl_h
2 #define HarmBasis3DCyl_h
3 
4 #include "rz_harm_poly.h"
5 
6 namespace magfieldparam {
7 
8 typedef std::vector<rz_harm_poly> harm_poly_vec;
9 typedef std::vector<harm_poly_vec> harm_poly_arr;
10 
12 // //
13 // HarmBasis3DCyl: set of basis harmonic polynomials in cylindrical CS //
14 // //
16 
18 
19 private:
20  unsigned Dim; //Dimension of the basis
21  unsigned Len; //Length of the basis, accounting negative M's
22 
23  int *L_k, *M_k; //Translation arrays from linear to (L,M) address;
24  double *P_k, *Br_k, *Bz_k, *Bphi_k; //Calculated values for (r,z) terms
25 
26  harm_poly_arr PtB; //Potential basis
27  harm_poly_arr BrB; //Br basis
28  harm_poly_arr BzB; //Bz basis
29  harm_poly_arr BphiB; //phi basis
30 
31  void EvalRZ(harm_poly_arr &B, double *val);
32  double GetVal(double *coeff, double *basis);
33 
34  void Print(harm_poly_arr &B,std::ostream &out = std::cout);
35 
36 public:
37  HarmBasis3DCyl(const unsigned N = 18); //The only legal constructor
38  virtual ~HarmBasis3DCyl();
39 
40  unsigned GetDim() { return Dim;}
41  unsigned GetLen() { return Len;}
42  void GetLM(const unsigned j, int &Lj, int &Mj) { Lj = L_k[j]; Mj = M_k[j];}
43 
44  //Sets point for the basis components evaluation
45  void SetPoint(const double r, const double z, const double phi)
46  { rz_harm_poly::SetPoint(r, z, phi);}
47 
48  //Fill tables with the basis component values. SetPoint(r,z,phi)
49  //must be called before EvalXXX() calls.
50  void EvalPtn() { EvalRZ(PtB, P_k);}
51  void EvalBr() { EvalRZ(BrB, Br_k);}
52  void EvalBz() { EvalRZ(BzB, Bz_k);}
53  void EvalBphi();
54 
55  //Return the basis component value for the linear address k.
56  //EvalXXX() must be called before GetXXX_k() call
57  double GetPtn_k (const unsigned k) { return P_k[k];}
58  double GetBr_k (const unsigned k) { return Br_k[k];}
59  double GetBz_k (const unsigned k) { return Bz_k[k];}
60  double GetBphi_k(const unsigned k) { return Bphi_k[k];}
61 
62  //Return the the potential and the field component values
63  //resulted by the basis expansion with coefficients in <coeff>
64  //EvalXXX() must be called before GetXXX() call
65  double GetPtn (double *coeff) { return GetVal(coeff, P_k);}
66  double GetBr (double *coeff) { return GetVal(coeff, Br_k);}
67  double GetBz (double *coeff) { return GetVal(coeff, Bz_k);}
68  double GetBphi(double *coeff) { return GetVal(coeff, Bphi_k);}
69 
70  void PrintPtB (std::ostream &out = std::cout) { Print(PtB, out);}
71  void PrintBrB (std::ostream &out = std::cout) { Print(BrB, out);}
72  void PrintBzB (std::ostream &out = std::cout) { Print(BzB, out);}
73  void PrintBphiB(std::ostream &out = std::cout) { Print(BphiB, out);}
74  void Print (std::ostream &out = std::cout);
75 
76 }; //class HarmBasis3DCyl
77 }
78 
79 #endif
double GetBphi(double *coeff)
double GetBr_k(const unsigned k)
double GetBr(double *coeff)
void PrintBrB(std::ostream &out=std::cout)
void PrintBphiB(std::ostream &out=std::cout)
HarmBasis3DCyl(const unsigned N=18)
double GetPtn(double *coeff)
double GetBz_k(const unsigned k)
double GetBphi_k(const unsigned k)
int j
Definition: DBlmapReader.cc:9
double GetPtn_k(const unsigned k)
static void SetPoint(const double r, const double z, const double phi)
Definition: rz_harm_poly.h:67
std::vector< harm_poly_vec > harm_poly_arr
Definition: HarmBasis3DCyl.h:9
std::vector< rz_harm_poly > harm_poly_vec
Definition: HarmBasis3DCyl.h:8
#define N
Definition: blowfish.cc:9
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void EvalRZ(harm_poly_arr &B, double *val)
void GetLM(const unsigned j, int &Lj, int &Mj)
void SetPoint(const double r, const double z, const double phi)
tuple cout
Definition: gather_cfg.py:145
void PrintBzB(std::ostream &out=std::cout)
void PrintPtB(std::ostream &out=std::cout)
double GetVal(double *coeff, double *basis)
double GetBz(double *coeff)