Logo ROOT   6.14/05
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 #include "TGLIsoMesh.h"
18 #include "TKDEFGT.h"
19 
20 //KDE adapter is a "data source" adapter for
21 //Marching cubes alhorithm. It produces scalar
22 //values in regular grid's nodes, using TKDEFGT class
23 //to estimate a density.
24 //IMPORTANT: This class is not intended for end-user's code,
25 //it's used and _must_ be used only as an argument while
26 //instantiating mesh builder's class template.
27 //That's why all members are protected
28 //or private - end user cannot create object's of this class.
29 //But mesh builder, derived from this class,
30 //knows exactly how to use this class correctly.
31 //SetDimenions and SetE/GetE are public members, it will be derived by mesh
32 //builder's instantiation and used inside TGL5DPainter class.
33 
34 namespace Rgl {
35 namespace Fgt {
36 
37 class TKDEAdapter : protected virtual Mc::TGridGeometry<Float_t> {
38 protected:
40 
41  TKDEAdapter();
42 
43 public:
44  void SetGeometry(const TGL5DDataSet *dataSet);
45 
46  void SetE(Double_t e);
47  Double_t GetE()const;
48 
49 protected:
50  UInt_t GetW()const;
51  UInt_t GetH()const;
52  UInt_t GetD()const;
53 
54  void SetDataSource(const TKDEFGT *dataSource);
55 
56  void FetchDensities()const;
57 
58  Float_t GetData(UInt_t i, UInt_t j, UInt_t k)const;
59 
60  void FreeVectors();
61 private:
62  typedef std::vector<Double_t> vector_t;
63 
64  mutable vector_t fGrid; //Grid to estimate density on.
65  mutable vector_t fDensities; //Estimated densities.
66 
67  UInt_t fW;//Number of cells along X.
68  UInt_t fH;//Number of cells along Y.
69  UInt_t fD;//Number of cells along Z.
70  UInt_t fSliceSize;//fW * fH.
71 
72  //Grid in a unit cube:
76 
77  const TKDEFGT *fDE;//Density estimator. This class does not own it.
78 
79  Double_t fE;//For KDE.
80 
81  TKDEAdapter(const TKDEAdapter &rhs);
82  TKDEAdapter &operator = (const TKDEAdapter &rhs);
83 };
84 
85 }
86 }
87 
88 #endif
UInt_t GetW() const
Number of cells along X.
Definition: TKDEAdapter.cxx:89
float Float_t
Definition: RtypesCore.h:53
Double_t GetE() const
e for kdefgt.
Definition: TKDEAdapter.cxx:81
void FreeVectors()
Free grid and density vectors.
TKDEAdapter()
Constructor. "Half-baked" object.
Definition: TKDEAdapter.cxx:26
UInt_t GetD() const
Number of cells along Z.
UInt_t GetH() const
Number of cells along Y.
Definition: TKDEAdapter.cxx:97
TKDEAdapter & operator=(const TKDEAdapter &rhs)
const TKDEFGT * fDE
Definition: TKDEAdapter.h:77
Float_t GetData(UInt_t i, UInt_t j, UInt_t k) const
Get data at given position.
unsigned int UInt_t
Definition: RtypesCore.h:42
std::vector< Double_t > vector_t
Definition: TKDEAdapter.h:62
void FetchDensities() const
Do some initialization and calculate densities.
double Double_t
Definition: RtypesCore.h:55
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
void SetGeometry(const TGL5DDataSet *dataSet)
Set grid&#39;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.