CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/MagneticField/Interpolation/src/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 "Grid1D.h"
00016 #include "Grid3D.h"
00017 #include "FWCore/Utilities/interface/Visibility.h"
00018 
00019 class dso_internal MFGrid3D : public MFGrid {
00020 public:
00021 
00022   explicit MFGrid3D( const GloballyPositioned<float>& vol) : MFGrid(vol) {}
00023 
00024 
00025   virtual Dimensions dimensions(void) const {
00026     Dimensions tmp;
00027     tmp.w = grid_.grida().nodes();
00028     tmp.h = grid_.gridb().nodes();
00029     tmp.d = grid_.gridc().nodes();
00030     return tmp;
00031   }
00032     
00034   virtual LocalPoint  nodePosition( int i, int j, int k) const {
00035     return fromGridFrame( grid_.grida().node(i), grid_.gridb().node(j), grid_.gridc().node(k));
00036   }
00037 
00039   virtual LocalVector nodeValue( int i, int j, int k) const {
00041     return MFGrid::LocalVector(grid_( i, j, k));
00042   }
00043 
00044   virtual Indexes index( const LocalPoint& p) const {
00045     Indexes result;
00046     double a, b, c;
00047     toGridFrame( p, a, b, c);
00048     result.i = grid_.grida().index(a);
00049     result.j = grid_.gridb().index(b);
00050     result.k = grid_.gridc().index(c);
00051     return result;
00052   }
00053 
00054   virtual LocalVector valueInTesla( const LocalPoint& p) const;
00055 
00057   virtual LocalVector uncheckedValueInTesla( const LocalPoint& p) const = 0;
00058 
00059 protected:
00060 
00061   typedef Basic3DVector<float>      BVector;
00062   typedef Grid3D                    GridType;
00063 
00064   GridType       grid_; // should become private...
00065 
00066   void setGrid( const GridType& grid) {
00067     grid_ = grid;
00068   }
00069 
00070 };
00071 
00072 #endif