CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
rz_poly.h
Go to the documentation of this file.
1 #ifndef rz_poly_h
2 #define rz_poly_h
3 
12 #include <vector>
13 
14 namespace magfieldparam {
15 
16 //_______________________________________________________________________________
17 struct poly_term {
18  double coeff;
19  int np[2];
20 };
21 
22 //_______________________________________________________________________________
23 typedef std::vector<poly_term> poly_vect;
24 //_______________________________________________________________________________
25 typedef std::vector<poly_vect> poly_arr;
26 
27 //_______________________________________________________________________________
28 class rz_poly { // represent a set of homogeneous polynomials
29 
30 private:
31 
34  double *r_pow;
35  double *z_pow;
36  bool *is_off;
37 
38 public:
39 
40  rz_poly() : data(), max_nr(0), max_nz(0), n_active(0),
41  r_pow(0), z_pow(0), is_off(0) {};
42 
43  rz_poly(int N);
44  rz_poly(const rz_poly& S);
45  ~rz_poly();
46 
47  void SetOFF (int npoly);
48  void SetON (int npoly);
49  void SetAllON(int npoly) {if (is_off) std::fill(is_off, is_off+data.size(), false);}
50 
51  rz_poly Diff(int nvar, bool keep_empty = false);
52  rz_poly Int (int nvar);
53 
54  rz_poly& operator*=(double C);
55  rz_poly& operator*=(double *C);
56 
57  double GetSVal(double r, double z, double *C);
58  double *GetVVal(double r, double z, double *rez_out = 0);
59 
60  int GetMaxRPow() {return max_nr-1;}
61  int GetMaxZPow() {return max_nz-1;}
62  int GetLength() {return (int)data.size();}
63  int GetNActive() {return n_active;}
64 
65  double *Expand(double *C);
66 
67  void Print();
68 
69 };
70 }
71 
72 #endif
double GetSVal(double r, double z, double *C)
Definition: rz_poly.cc:246
std::vector< poly_term > poly_vect
Definition: rz_poly.h:23
string fill
Definition: lumiContext.py:319
float float float z
void SetAllON(int npoly)
Definition: rz_poly.h:49
std::vector< poly_vect > poly_arr
Definition: rz_poly.h:25
void SetOFF(int npoly)
Definition: rz_poly.cc:88
void SetON(int npoly)
Definition: rz_poly.cc:97
rz_poly & operator*=(double C)
Definition: rz_poly.cc:217
#define N
Definition: blowfish.cc:9
double * GetVVal(double r, double z, double *rez_out=0)
Definition: rz_poly.cc:274
rz_poly Diff(int nvar, bool keep_empty=false)
Definition: rz_poly.cc:128
double * Expand(double *C)
Definition: rz_poly.cc:311
rz_poly Int(int nvar)
Definition: rz_poly.cc:184