ROOT  6.06/09
Reference Guide
TKDEAdapter.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 28/07/2009
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TTKDEAdapter
13 #define ROOT_TTKDEAdapter
14 
15 #include <vector>
16 
17 #ifndef ROOT_TGLIsoMesh
18 #include "TGLIsoMesh.h"
19 #endif
20 #ifndef ROOT_TKDEFGT
21 #include "TKDEFGT.h"
22 #endif
23 
24 //KDE adapter is a "data source" adapter for
25 //Marching cubes alhorithm. It produces scalar
26 //values in regular grid's nodes, using TKDEFGT class
27 //to estimate a density.
28 //IMPORTANT: This class is not intended for end-user's code,
29 //it's used and _must_ be used only as an argument while
30 //instantiating mesh builder's class template.
31 //That's why all members are protected
32 //or private - end user cannot create object's of this class.
33 //But mesh builder, derived from this class,
34 //knows exactly how to use this class correctly.
35 //SetDimenions and SetE/GetE are public members, it will be derived by mesh
36 //builder's instantiation and used inside TGL5DPainter class.
37 
38 namespace Rgl {
39 namespace Fgt {
40 
41 class TKDEAdapter : protected virtual Mc::TGridGeometry<Float_t> {
42 protected:
44 
45  TKDEAdapter();
46 
47 public:
48  void SetGeometry(const TGL5DDataSet *dataSet);
49 
50  void SetE(Double_t e);
51  Double_t GetE()const;
52 
53 protected:
54  UInt_t GetW()const;
55  UInt_t GetH()const;
56  UInt_t GetD()const;
57 
58  void SetDataSource(const TKDEFGT *dataSource);
59 
60  void FetchDensities()const;
61 
62  Float_t GetData(UInt_t i, UInt_t j, UInt_t k)const;
63 
64  void FreeVectors();
65 private:
66  typedef std::vector<Double_t> vector_t;
67 
68  mutable vector_t fGrid; //Grid to estimate density on.
69  mutable vector_t fDensities; //Estimated densities.
70 
71  UInt_t fW;//Number of cells along X.
72  UInt_t fH;//Number of cells along Y.
73  UInt_t fD;//Number of cells along Z.
74  UInt_t fSliceSize;//fW * fH.
75 
76  //Grid in a unit cube:
80 
81  const TKDEFGT *fDE;//Density estimator. This class does not own it.
82 
83  Double_t fE;//For KDE.
84 
85  TKDEAdapter(const TKDEAdapter &rhs);
86  TKDEAdapter &operator = (const TKDEAdapter &rhs);
87 };
88 
89 }
90 }
91 
92 #endif
Double_t GetE() const
e for kdefgt.
Definition: TKDEAdapter.cxx:81
float Float_t
Definition: RtypesCore.h:53
void FreeVectors()
Free grid and density vectors.
TKDEAdapter()
Constructor. "Half-baked" object.
Definition: TKDEAdapter.cxx:26
UInt_t GetW() const
Number of cells along X.
Definition: TKDEAdapter.cxx:89
UInt_t GetH() const
Number of cells along Y.
Definition: TKDEAdapter.cxx:97
Float_t GetData(UInt_t i, UInt_t j, UInt_t k) const
Get data at given position.
TKDEAdapter & operator=(const TKDEAdapter &rhs)
UInt_t GetD() const
Number of cells along Z.
const TKDEFGT * fDE
Definition: TKDEAdapter.h:81
unsigned int UInt_t
Definition: RtypesCore.h:42
std::vector< Double_t > vector_t
Definition: TKDEAdapter.h:66
double Double_t
Definition: RtypesCore.h:55
void FetchDensities() const
Do some initialization and calculate densities.
void SetGeometry(const TGL5DDataSet *dataSet)
Set grid's dimensions.
Definition: TKDEAdapter.cxx:40
void SetE(Double_t e)
e for kdefgt.
Definition: TKDEAdapter.cxx:73
void SetDataSource(const TKDEFGT *dataSource)
Set density estimator as a data source.