Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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:
39  typedef Float_t ElementType_t;
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:
73  Double_t fXMin, fXStep;
74  Double_t fYMin, fYStep;
75  Double_t fZMin, fZStep;
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