Logo ROOT   6.16/01
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
34namespace Rgl {
35namespace Fgt {
36
37class TKDEAdapter : protected virtual Mc::TGridGeometry<Float_t> {
38protected:
40
42
43public:
44 void SetGeometry(const TGL5DDataSet *dataSet);
45
46 void SetE(Double_t e);
47 Double_t GetE()const;
48
49protected:
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();
61private:
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
83};
84
85}
86}
87
88#endif
#define e(i)
Definition: RSha256.hxx:103
unsigned int UInt_t
Definition: RtypesCore.h:42
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
TKDEAdapter()
Constructor. "Half-baked" object.
Definition: TKDEAdapter.cxx:26
void SetGeometry(const TGL5DDataSet *dataSet)
Set grid's dimensions.
Definition: TKDEAdapter.cxx:40
Float_t GetData(UInt_t i, UInt_t j, UInt_t k) const
Get data at given position.
UInt_t GetH() const
Number of cells along Y.
Definition: TKDEAdapter.cxx:97
TKDEAdapter & operator=(const TKDEAdapter &rhs)
void SetDataSource(const TKDEFGT *dataSource)
Set density estimator as a data source.
void SetE(Double_t e)
e for kdefgt.
Definition: TKDEAdapter.cxx:73
void FetchDensities() const
Do some initialization and calculate densities.
UInt_t GetD() const
Number of cells along Z.
std::vector< Double_t > vector_t
Definition: TKDEAdapter.h:62
const TKDEFGT * fDE
Definition: TKDEAdapter.h:77
void FreeVectors()
Free grid and density vectors.
UInt_t GetW() const
Number of cells along X.
Definition: TKDEAdapter.cxx:89
Double_t GetE() const
e for kdefgt.
Definition: TKDEAdapter.cxx:81
TKDEAdapter(const TKDEAdapter &rhs)