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