CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/MagneticField/Interpolation/interface/MFGrid3D.h

Go to the documentation of this file.
00001 #ifndef MFGrid3D_h
00002 #define MFGrid3D_h
00003 
00013 #include "MagneticField/Interpolation/interface/MFGrid.h"
00014 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
00015 #include "MagneticField/Interpolation/src/Grid1D.h"
00016 #include "MagneticField/Interpolation/src/Grid3D.h"
00017 
00018 class MFGrid3D : public MFGrid {
00019 public:
00020 
00021   explicit MFGrid3D( const GloballyPositioned<float>& vol) : MFGrid(vol) {}
00022 
00023 
00024   virtual Dimensions dimensions(void) const {
00025     Dimensions tmp;
00026     tmp.w = grid_.grida().nodes();
00027     tmp.h = grid_.gridb().nodes();
00028     tmp.d = grid_.gridc().nodes();
00029     return tmp;
00030   }
00031     
00033   virtual LocalPoint  nodePosition( int i, int j, int k) const {
00034     return fromGridFrame( grid_.grida().node(i), grid_.gridb().node(j), grid_.gridc().node(k));
00035   }
00036 
00038   virtual LocalVector nodeValue( int i, int j, int k) const {
00040     return MFGrid::LocalVector(grid_( i, j, k));
00041   }
00042 
00043   virtual Indexes index( const LocalPoint& p) const {
00044     Indexes result;
00045     double a, b, c;
00046     toGridFrame( p, a, b, c);
00047     result.i = grid_.grida().index(a);
00048     result.j = grid_.gridb().index(b);
00049     result.k = grid_.gridc().index(c);
00050     return result;
00051   }
00052 
00053   virtual LocalVector valueInTesla( const LocalPoint& p) const;
00054 
00056   virtual LocalVector uncheckedValueInTesla( const LocalPoint& p) const = 0;
00057 
00058 protected:
00059 
00060   typedef Basic3DVector<float>      BVector;
00061   typedef Grid3D                    GridType;
00062 
00063   GridType       grid_; // should become private...
00064 
00065   void setGrid( const GridType& grid) {
00066     grid_ = grid;
00067   }
00068 
00069 };
00070 
00071 #endif