CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/MagneticField/ParametrizedEngine/plugins/rz_poly.h

Go to the documentation of this file.
00001 #ifndef rz_poly_h
00002 #define rz_poly_h
00003 
00012 #include <vector>
00013 
00014 namespace magfieldparam {
00015 
00016 //_______________________________________________________________________________
00017 struct poly_term {
00018    double coeff;
00019    int    np[2];
00020 };
00021 
00022 //_______________________________________________________________________________
00023 typedef std::vector<poly_term> poly_vect;
00024 //_______________________________________________________________________________
00025 typedef std::vector<poly_vect> poly_arr;
00026 
00027 //_______________________________________________________________________________
00028 class rz_poly {   // represent a set of homogeneous polynomials
00029 
00030 private:
00031 
00032    poly_arr data;
00033    int max_nr, max_nz, n_active;
00034    double *r_pow;
00035    double *z_pow;
00036    bool   *is_off;
00037 
00038 public:
00039 
00040    rz_poly() : data(), max_nr(0), max_nz(0), n_active(0), 
00041                r_pow(0), z_pow(0), is_off(0) {};
00042 
00043    rz_poly(int N);
00044    rz_poly(const rz_poly& S);
00045    ~rz_poly();
00046    
00047    void SetOFF  (int npoly);
00048    void SetON   (int npoly);
00049    void SetAllON(int npoly) {if (is_off) std::fill(is_off, is_off+data.size(), false);}
00050    
00051    rz_poly Diff(int nvar, bool keep_empty = false);
00052    rz_poly Int (int nvar);
00053    
00054    rz_poly& operator*=(double  C);
00055    rz_poly& operator*=(double *C);
00056    
00057    double  GetSVal(double r, double z, double *C);
00058    double *GetVVal(double r, double z, double *rez_out = 0);
00059    
00060    int GetMaxRPow() {return max_nr-1;}
00061    int GetMaxZPow() {return max_nz-1;}
00062    int GetLength()  {return (int)data.size();}
00063    int GetNActive() {return n_active;}
00064    
00065    double *Expand(double *C);
00066    
00067    void Print();
00068 
00069 };
00070 }
00071 
00072 #endif