VTK  9.5.20250904
vtkRandomHyperTreeGridSource.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
11#ifndef vtkRandomHyperTreeGridSource_h
12#define vtkRandomHyperTreeGridSource_h
13
14#include "vtkFiltersSourcesModule.h" // For export macro
16#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
17
18#include <vector>
19#include <vtkNew.h> // For vtkNew
20
21VTK_ABI_NAMESPACE_BEGIN
22class vtkDoubleArray;
26
27class VTKFILTERSSOURCES_EXPORT VTK_MARSHALAUTO vtkRandomHyperTreeGridSource
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
40 vtkGetVector3Macro(Dimensions, unsigned int);
41 vtkSetVector3Macro(Dimensions, unsigned int);
48 vtkGetVector6Macro(OutputBounds, double);
49 vtkSetVector6Macro(OutputBounds, double);
50
57 vtkGetMacro(Seed, vtkTypeUInt32);
58 vtkSetMacro(Seed, vtkTypeUInt32);
66 vtkGetMacro(MaxDepth, vtkIdType);
67 vtkSetClampMacro(MaxDepth, vtkIdType, 1, VTK_ID_MAX);
75 vtkGetMacro(SplitFraction, double);
76 vtkSetClampMacro(SplitFraction, double, 0., 1.);
90 vtkGetMacro(MaskedFraction, double);
91 vtkSetClampMacro(MaskedFraction, double, 0., 1.);
99 vtkGetMacro(ActualMaskedCellFraction, double);
102protected:
105
107 vtkInformation* req, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
108
110 vtkInformation* req, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
111
112 // We just do the work in RequestData.
113 int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*) final { return 1; }
114
115 int FillOutputPortInformation(int port, vtkInformation* info) override;
116
125
127
128 unsigned int Dimensions[3];
129 double OutputBounds[6];
130 vtkTypeUInt32 Seed;
133
134private:
136 void operator=(const vtkRandomHyperTreeGridSource&) = delete;
137
139 // We have 2 different RNG for retrocompatibility, since the mask
140 // has been added later on.
142 vtkNew<vtkExtentTranslator> ExtentTranslator;
143 vtkDoubleArray* Levels;
144 double MaskedFraction = 0;
145 double ActualMaskedCellFraction = 0;
146 std::vector<double> MaskingCostPerLevel{ 1.0 };
147
159 bool ShouldMask(double siblingsMasked = 0.0, int level = 0, double errorMargin = 0.0);
160
164 double GenerateMask(vtkHyperTreeGridNonOrientedCursor* cursor, vtkIdType treeId,
165 double unmaskedFraction = 1.0, bool isParentMasked = false, double siblingsMasked = 0.0,
166 double errorMargin = 0.0);
167
171 void InitializeMaskingNodeCostPerLevel();
172
181 double GetMaskingNodeCost(int level);
182};
183
184VTK_ABI_NAMESPACE_END
185#endif // vtkRandomHyperTreeGridSource_h
general representation of visualization data
dynamic, self-adjusting array of double
Generates a structured extent from unstructured.
Superclass for algorithms that produce a hyper tree grid as output.
Objects for traversal a HyperTreeGrid.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Park and Miller Sequence of pseudo random numbers.
Allocate and hold a VTK object.
Definition vtkNew.h:167
Builds a randomized but reproducible vtkHyperTreeGrid.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkRandomHyperTreeGridSource * New()
void SubdivideLeaves(vtkHyperTreeGridNonOrientedCursor *cursor, vtkIdType treeId)
Recursively subdivides the leafs of the tree using a pseudo random number generator and the SplitFrac...
int FillOutputPortInformation(int port, vtkInformation *info) override
Define default input and output port types.
int RequestData(vtkInformation *req, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
This is called by the superclass.
~vtkRandomHyperTreeGridSource() override
int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *) final
Main routine to process individual trees in the grid This is pure virtual method to be implemented by...
int RequestInformation(vtkInformation *req, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
bool ShouldRefine(vtkIdType level)
int vtkIdType
Definition vtkType.h:332
#define VTK_ID_MAX
Definition vtkType.h:336
#define VTK_MARSHALAUTO