VTK  9.5.2
vtkHyperTreeGridSource.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
43
44#ifndef vtkHyperTreeGridSource_h
45#define vtkHyperTreeGridSource_h
46
47#include "vtkFiltersSourcesModule.h" // For export macro
49
50#include <map> // STL Header
51#include <string> // STL Header
52#include <vector> // STL Header
53
54VTK_ABI_NAMESPACE_BEGIN
55class vtkBitArray;
56class vtkDataArray;
58class vtkIdTypeArray;
61class vtkQuadric;
62
63class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
64{
65public:
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
70
75 unsigned int GetMaxDepth();
76
83 void SetMaxDepth(unsigned int levels);
84
86
89 vtkSetVector3Macro(Origin, double);
90 vtkGetVector3Macro(Origin, double);
92
94
97 vtkSetVector3Macro(GridScale, double);
98 vtkGetVector3Macro(GridScale, double);
99 void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
101
103
106 void SetDimensions(const unsigned int* dims);
107 void SetDimensions(unsigned int, unsigned int, unsigned int);
108 vtkGetVector3Macro(Dimensions, unsigned int);
110
112
116 vtkSetMacro(TransposedRootIndexing, bool);
117 vtkGetMacro(TransposedRootIndexing, bool);
121
123
126 vtkGetMacro(Orientation, unsigned int);
128
130
133 vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
134 vtkGetMacro(BranchFactor, unsigned int);
136
138
143 vtkSetMacro(UseDescriptor, bool);
144 vtkGetMacro(UseDescriptor, bool);
145 vtkBooleanMacro(UseDescriptor, bool);
147
149
154 vtkSetMacro(UseMask, bool);
155 vtkGetMacro(UseMask, bool);
156 vtkBooleanMacro(UseMask, bool);
158
160
165 vtkSetMacro(GenerateInterfaceFields, bool);
166 vtkGetMacro(GenerateInterfaceFields, bool);
167 vtkBooleanMacro(GenerateInterfaceFields, bool);
169
171
174 vtkSetStringMacro(Descriptor);
175 vtkGetStringMacro(Descriptor);
177
179
182 vtkSetStringMacro(Mask);
183 vtkGetStringMacro(Mask);
185
187
191 vtkGetObjectMacro(DescriptorBits, vtkBitArray);
193
198
200
203 virtual void SetMaskBits(vtkBitArray*);
204 vtkGetObjectMacro(MaskBits, vtkBitArray);
206
208
211 virtual void SetQuadric(vtkQuadric*);
212 vtkGetObjectMacro(Quadric, vtkQuadric);
214
216
219 void SetQuadricCoefficients(double[10]);
220 void GetQuadricCoefficients(double[10]);
223
228
230
236
237protected:
240
242
244
246
251
256
261
266 int treeIdx, int idx[3], int offset = 0);
267
274 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
275 int idx[3], int parentPos, int offset = 0);
276
281 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
282 int idx[3], int parentPos);
283
288 unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
289
293 double EvaluateQuadric(double[3]);
294
295 double Origin[3];
296 double GridScale[3];
297 unsigned int Dimension;
298
299 unsigned int Dimensions[3];
301 unsigned int MaxDepth;
302
303 unsigned int Orientation;
304 unsigned int BranchFactor;
305 unsigned int BlockSize;
309
313
315 char* Mask;
316 std::vector<std::string> LevelDescriptors;
317 std::vector<std::string> LevelMasks;
318
321 std::vector<vtkIdType> LevelBitsIndex;
322 std::vector<vtkIdType> LevelBitsIndexCnt;
323
325 std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
326
327 std::vector<int> LevelCounters;
328
330
332
333private:
335 void operator=(const vtkHyperTreeGridSource&) = delete;
336
337 // Multi-piece utilities
338 int Piece = 0;
339 int NumPieces = 1;
340 int CurrentTreeProcess = 0; // Track the process where next root trees should go
341
347 bool IsLevelDescriptorConsistent(bool isRootLevel, unsigned int nRefined, unsigned int nLeaves,
348 unsigned int nTotal, unsigned int nNextLevel, const std::ostringstream& descriptor);
349};
350
351VTK_ABI_NAMESPACE_END
352#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:29
general representation of visualization data
Objects for traversal a HyperTreeGrid.
void SetDimensions(const unsigned int *dims)
Set/Get the number of root cells + 1 in each dimension of the grid.
void SetIndexingModeToIJK()
Specify whether indexing mode of grid root cells must be transposed to x-axis first,...
virtual void SetQuadric(vtkQuadric *)
Set/Get the quadric function.
virtual void SetMaskBits(vtkBitArray *)
Set/Get the bitarray used as a material mask.
std::vector< vtkIdType > LevelBitsIndex
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int InitializeFromStringDescriptor()
Initialize grid from descriptor string when it is to be used.
static vtkHyperTreeGridSource * New()
void SetGridScale(double scale)
Set/Get the scale to be applied to root cells in each dimension of the grid.
void InitTreeFromDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, int treeIdx, int idx[3], int offset=0)
Initialize tree grid from descriptor and call subdivide if needed.
vtkMTimeType GetMTime() override
Override GetMTime because we delegate to a vtkQuadric.
virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray *)
Set the index array used to as a material mask.
double EvaluateQuadric(double[3])
Evaluate quadric at given point coordinates.
int FillOutputPortInformation(int, vtkInformation *) override
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
std::vector< vtkIdType > LevelBitsIndexCnt
unsigned int GetMaxDepth()
Return the maximum number of levels of the hypertree.
void SetDimensions(unsigned int, unsigned int, unsigned int)
Set/Get the number of root cells + 1 in each dimension of the grid.
void SetIndexingModeToKJI()
Specify whether indexing mode of grid root cells must be transposed to x-axis first,...
vtkBitArray * ConvertDescriptorStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray * LevelZeroMaterialIndex
void SubdivideFromStringDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, int childIdx, int idx[3], int parentPos, int offset=0)
Subdivide grid from descriptor string when it is to be used offset represents the offset reading in t...
std::vector< std::string > LevelMasks
void SubdivideFromBitsDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, int childIdx, int idx[3], int parentPos)
Subdivide grid from descriptor string when it is to be used.
vtkBitArray * ConvertMaskStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
int InitializeFromBitsDescriptor()
Initialize grid from bit array descriptors when it is to be used.
~vtkHyperTreeGridSource() override
void SubdivideFromQuadric(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3])
Subdivide grid from quadric when descriptor is not used.
void SetMaxDepth(unsigned int levels)
Set the maximum number of levels of the hypertrees.
double * GetQuadricCoefficients()
Helpers to set/get the 10 coefficients of the quadric function.
std::map< vtkIdType, vtkIdType > LevelZeroMaterialMap
void GetQuadricCoefficients(double[10])
Helpers to set/get the 10 coefficients of the quadric function.
std::vector< std::string > LevelDescriptors
int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *) override
Main routine to process individual trees in the grid.
void SetQuadricCoefficients(double[10])
Helpers to set/get the 10 coefficients of the quadric function.
virtual void SetDescriptorBits(vtkBitArray *)
Set/Get the bitarray used to describe the grid.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
dynamic, self-adjusting array of vtkIdType
abstract interface for implicit functions
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
evaluate implicit quadric function
Definition vtkQuadric.h:23
#define vtkDataArray
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287