Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TKDEAdapter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Timur Pocheptsov  28/07/2009
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TTKDEAdapter
0013 #define ROOT_TTKDEAdapter
0014 
0015 #include <vector>
0016 
0017 #include "TGLIsoMesh.h"
0018 #include "TKDEFGT.h"
0019 
0020 //KDE adapter is a "data source" adapter for
0021 //Marching cubes alhorithm. It produces scalar
0022 //values in regular grid's nodes, using TKDEFGT class
0023 //to estimate a density.
0024 //IMPORTANT: This class is not intended for end-user's code,
0025 //it's used and _must_ be used only as an argument while
0026 //instantiating mesh builder's class template.
0027 //That's why all members are protected
0028 //or private - end user cannot create object's of this class.
0029 //But mesh builder, derived from this class,
0030 //knows exactly how to use this class correctly.
0031 //SetDimenions and SetE/GetE are public members, it will be derived by mesh
0032 //builder's instantiation and used inside TGL5DPainter class.
0033 
0034 namespace Rgl {
0035 namespace Fgt {
0036 
0037 class TKDEAdapter : protected virtual Mc::TGridGeometry<Float_t> {
0038 protected:
0039    typedef Float_t ElementType_t;
0040 
0041    TKDEAdapter();
0042 
0043 public:
0044    void SetGeometry(const TGL5DDataSet *dataSet);
0045 
0046    void SetE(Double_t e);
0047    Double_t GetE()const;
0048 
0049 protected:
0050    UInt_t GetW()const;
0051    UInt_t GetH()const;
0052    UInt_t GetD()const;
0053 
0054    void SetDataSource(const TKDEFGT *dataSource);
0055 
0056    void FetchDensities()const;
0057 
0058    Float_t GetData(UInt_t i, UInt_t j, UInt_t k)const;
0059 
0060    void FreeVectors();
0061 private:
0062    typedef std::vector<Double_t> vector_t;
0063 
0064    mutable vector_t  fGrid;       //Grid to estimate density on.
0065    mutable vector_t  fDensities;  //Estimated densities.
0066 
0067    UInt_t    fW;//Number of cells along X.
0068    UInt_t    fH;//Number of cells along Y.
0069    UInt_t    fD;//Number of cells along Z.
0070    UInt_t    fSliceSize;//fW * fH.
0071 
0072    //Grid in a unit cube:
0073    Double_t  fXMin, fXStep;
0074    Double_t  fYMin, fYStep;
0075    Double_t  fZMin, fZStep;
0076 
0077    const TKDEFGT  *fDE;//Density estimator. This class does not own it.
0078 
0079    Double_t  fE;//For KDE.
0080 
0081    TKDEAdapter(const TKDEAdapter &rhs);
0082    TKDEAdapter &operator = (const TKDEAdapter &rhs);
0083 };
0084 
0085 }
0086 }
0087 
0088 #endif