forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkRandomHyperTreeGridSource.h
118 lines (93 loc) · 3.43 KB
/
vtkRandomHyperTreeGridSource.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*=========================================================================
Program: Visualization Toolkit
Module: vtkRandomHyperTreeGridSource.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkRandomHyperTreeGridSource
* @brief Builds a randomized but reproducible vtkHyperTreeGrid.
*/
#ifndef vtkRandomHyperTreeGridSource_h
#define vtkRandomHyperTreeGridSource_h
#include "vtkFiltersSourcesModule.h" // For export macro
#include "vtkHyperTreeGridAlgorithm.h"
#include <vtkNew.h> // For vtkNew
class vtkDoubleArray;
class vtkExtentTranslator;
class vtkHyperTreeGridNonOrientedCursor;
class vtkMinimalStandardRandomSequence;
class VTKFILTERSSOURCES_EXPORT vtkRandomHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
{
public:
static vtkRandomHyperTreeGridSource* New();
vtkTypeMacro(vtkRandomHyperTreeGridSource, vtkHyperTreeGridAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* The Dimensions of the output vtkHyperTreeGrid.
* Default is 5x5x2.
* @{
*/
vtkGetVector3Macro(Dimensions, unsigned int);
vtkSetVector3Macro(Dimensions, unsigned int);
/**@}*/
/**
* The bounds of the output vtkHyperTreeGrid.
* The default is {-10, 10, -10, 10, -10, 10}.
*/
vtkGetVector6Macro(OutputBounds, double);
vtkSetVector6Macro(OutputBounds, double);
/**
* A seed for the random number generator used to construct the output
* vtkHyperTreeGrid.
* The default is 0.
* @{
*/
vtkGetMacro(Seed, vtkTypeUInt32);
vtkSetMacro(Seed, vtkTypeUInt32);
/**@}*/
/**
* The maximum number of levels to allow in the output vtkHyperTreeGrid.
* The default is 5.
* @{
*/
vtkGetMacro(MaxDepth, vtkIdType);
vtkSetClampMacro(MaxDepth, vtkIdType, 1, VTK_ID_MAX);
/**@}*/
/**
* The target fraction of nodes that will be split during generation.
* Valid range is [0., 1.]. The default is 0.5.
* @{
*/
vtkGetMacro(SplitFraction, double);
vtkSetClampMacro(SplitFraction, double, 0., 1.);
/**@}*/
protected:
vtkRandomHyperTreeGridSource();
~vtkRandomHyperTreeGridSource() override;
int RequestInformation(
vtkInformation* req, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
int RequestData(
vtkInformation* req, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
// We just do the work in RequestData.
int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*) final { return 1; }
int FillOutputPortInformation(int port, vtkInformation* info) override;
void SubdivideLeaves(vtkHyperTreeGridNonOrientedCursor* cursor, vtkIdType treeId);
bool ShouldRefine(vtkIdType level);
unsigned int Dimensions[3];
double OutputBounds[6];
vtkTypeUInt32 Seed;
vtkIdType MaxDepth;
double SplitFraction;
private:
vtkRandomHyperTreeGridSource(const vtkRandomHyperTreeGridSource&) = delete;
void operator=(const vtkRandomHyperTreeGridSource&) = delete;
vtkNew<vtkMinimalStandardRandomSequence> RNG;
vtkNew<vtkExtentTranslator> ExtentTranslator;
vtkDoubleArray* Levels;
};
#endif // vtkRandomHyperTreeGridSource_h