TKDEAdapter.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TKDEAdapter.h 33600 2010-05-21 09:24:32Z rdm $
00002 // Author:  Timur Pocheptsov  28/07/2009
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TTKDEAdapter
00013 #define ROOT_TTKDEAdapter
00014 
00015 #include <vector>
00016 
00017 #ifndef ROOT_TGLIsoMesh
00018 #include "TGLIsoMesh.h"
00019 #endif
00020 #ifndef ROOT_TKDEFGT
00021 #include "TKDEFGT.h"
00022 #endif
00023 
00024 //KDE adapter is a "data source" adapter for 
00025 //Marching cubes alhorithm. It produces scalar
00026 //values in regular grid's nodes, using TKDEFGT class
00027 //to estimate a density.
00028 //IMPORTANT: This class is not intended for end-user's code, 
00029 //it's used and _must_ be used only as an argument while 
00030 //instantiating mesh builder's class template.
00031 //That's why all members are protected
00032 //or private - end user cannot create object's of this class.
00033 //But mesh builder, derived from this class,
00034 //knows exactly how to use this class correctly. 
00035 //SetDimenions and SetE/GetE are public members, it will be derived by mesh 
00036 //builder's instantiation and used inside TGL5DPainter class.
00037 
00038 namespace Rgl {
00039 namespace Fgt {
00040 
00041 class TKDEAdapter : protected virtual Mc::TGridGeometry<Float_t> {
00042 protected:
00043    typedef Float_t ElementType_t;
00044 
00045    TKDEAdapter();
00046 
00047 public:
00048    void SetGeometry(const TGL5DDataSet *dataSet);
00049 
00050    void SetE(Double_t e);
00051    Double_t GetE()const;
00052 
00053 protected:
00054    UInt_t GetW()const;
00055    UInt_t GetH()const;
00056    UInt_t GetD()const;
00057 
00058    void SetDataSource(const TKDEFGT *dataSource);
00059 
00060    void FetchDensities()const;
00061 
00062    Float_t GetData(UInt_t i, UInt_t j, UInt_t k)const;
00063 
00064    void FreeVectors();
00065 private:
00066    typedef std::vector<Double_t> vector_t;
00067 
00068    mutable vector_t  fGrid;       //Grid to estimate density on.
00069    mutable vector_t  fDensities;  //Estimated densities.
00070 
00071    UInt_t    fW;//Number of cells along X.
00072    UInt_t    fH;//Number of cells along Y.
00073    UInt_t    fD;//Number of cells along Z.
00074    UInt_t    fSliceSize;//fW * fH.
00075 
00076    //Grid in a unit cube:
00077    Double_t  fXMin, fXStep;
00078    Double_t  fYMin, fYStep;
00079    Double_t  fZMin, fZStep;
00080 
00081    const TKDEFGT  *fDE;//Density estimator. This class does not own it.
00082 
00083    Double_t  fE;//For KDE.
00084 
00085    TKDEAdapter(const TKDEAdapter &rhs);
00086    TKDEAdapter &operator = (const TKDEAdapter &rhs);
00087 };
00088 
00089 }
00090 }
00091 
00092 #endif

Generated on Tue Jul 5 14:16:56 2011 for ROOT_528-00b_version by  doxygen 1.5.1