VTK  9.5.20251120
vtkXMLHyperTreeGridReader.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
31
32#ifndef vtkXMLHyperTreeGridReader_h
33#define vtkXMLHyperTreeGridReader_h
34
35#include "vtkIOXMLModule.h" // For export macro
36#include "vtkXMLReader.h"
37
38#include <limits.h> // Use internal
39#include <map> // Use internal
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkBitArray;
43class vtkHyperTree;
46class vtkIdTypeArray;
47
48class VTKIOXML_EXPORT vtkXMLHyperTreeGridReader : public vtkXMLReader
49{
50public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
54
56
62
64
68 vtkSetMacro(FixedLevel, unsigned int);
69 vtkGetMacro(FixedLevel, unsigned int);
71
73
82 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
83
84 void SetIndicesBoundingBox(unsigned int imin, unsigned int imax, unsigned int jmin,
85 unsigned int jmax, unsigned int kmin, unsigned int kmax);
86
87 void ClearAndAddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
88 void AddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
90
91 // These defer to the HyperTreeGrid output.
93
95
96 void SetupUpdateExtent(int piece, int numberOfPieces);
97
98 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
99
100 // The most important stuff is here.
101 // Read the rest of the file and create the HyperTreeGrid.
102 void ReadXMLData() override;
103
104protected:
107
108 // Finalize the selected HyperTrees by, for example, transform
109 // coordinates bounding box in indices coordinates bounding box
110 // after initialize HyperTreeGrid.
112
113 // Return true if HyperTree identified by treeIndx is selected for
114 // the load.
115 bool IsSelectedHT(const vtkHyperTreeGrid* grid, vtkIdType treeIndx) const;
116
117 // Return the fixedLevel choice for this HyperTree
118 unsigned int GetFixedLevelOfThisHT(unsigned int numberOfLevels, vtkIdType treeIndx) const;
119
120 const char* GetDataSetName() override;
121
123
124 void GetOutputUpdateExtent(int& piece, int& numberOfPieces);
125
126 // Setup the output with no data available. Used in error cases.
127 void SetupEmptyOutput() override;
128
129 // Initialize the total number of vertices
131
132 // Initialize global start of next piece
134
135 // Initialize current output data
136 void SetupOutputData() override;
137
138 // Setup the output's information
139 void SetupOutputInformation(vtkInformation* outInfo) override;
140
141 // Setup the number of pieces
142 void SetupPieces(int numPieces);
143
144 // Pipeline execute data driver called by vtkXMLReader
145 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
146
147 // Declare that this reader produces HyperTreeGrids
149
150 // Read the coordinates describing the grid
152
153 //----------- Used for the major version < 1
154
155 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
156 // format version 0.
158
159 // Used by ReadTopology to recursively build the tree
161 unsigned int numChildren, vtkBitArray* desc, vtkIdTypeArray* posByLevel);
162
163 //---------- Used for other the major version
164
165 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
166 // format version 1.
168
169 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
170 // format version 2.
172
173 // Number of vertices in HyperTreeGrid being read
176
177 // Fixed the load maximum level
178 unsigned int FixedLevel;
179
180 bool Verbose = false;
181
182 bool FixedHTs = false;
191
192 // Selected HTs by coordinates of bounding box
194 // Selected HTs by indice coordinate of bounding box
195 unsigned int IndicesBoundingBox[6];
196 // Selected HTs by indice of HTs in the map.
197 // The value is the fixedLevel, but if this value is
198 // UINT_MAX, this is FixedLevel that is used.
199 std::map<unsigned int, unsigned int> IdsSelected;
200
203
207
208private:
210 void operator=(const vtkXMLHyperTreeGridReader&) = delete;
211};
212
213VTK_ABI_NAMESPACE_END
214#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:31
Objects for traversal a HyperTreeGrid.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
A data object structured as a tree.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
Represents an XML element and those nested inside.
static vtkXMLHyperTreeGridReader * New()
int FillOutputPortInformation(int, vtkInformation *) override
Fill the output port information objects for this algorithm.
vtkIdType GetNumberOfPoints() const
void CopyOutputInformation(vtkInformation *outInfo, int port) override
void SetCoordinatesBoundingBox(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
Set/Get the selected HyperTrees (HTs) to read : by default, all Hts, or by set coordinates bounding b...
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
unsigned int GetFixedLevelOfThisHT(unsigned int numberOfLevels, vtkIdType treeIndx) const
void CalculateHTs(const vtkHyperTreeGrid *grid)
void SetupPieces(int numPieces)
vtkIdType GetNumberOfPieces() const
void AddSelectedHT(unsigned int idg, unsigned int fixedLevel=UINT_MAX)
Set/Get the selected HyperTrees (HTs) to read : by default, all Hts, or by set coordinates bounding b...
vtkHyperTreeGrid * GetOutput()
Get the reader's output.
std::map< unsigned int, unsigned int > IdsSelected
bool IsSelectedHT(const vtkHyperTreeGrid *grid, vtkIdType treeIndx) const
void SubdivideFromDescriptor_0(vtkHyperTreeGridNonOrientedCursor *treeCursor, unsigned int level, unsigned int numChildren, vtkBitArray *desc, vtkIdTypeArray *posByLevel)
void ReadTrees_1(vtkXMLDataElement *elem)
void SetupOutputData() override
Setup the output's data with allocation.
void ReadTrees_2(vtkXMLDataElement *elem)
void SetupOutputInformation(vtkInformation *outInfo) override
Setup the output's information.
void ReadTrees_0(vtkXMLDataElement *elem)
void ReadGrid(vtkXMLDataElement *elem)
void GetOutputUpdateExtent(int &piece, int &numberOfPieces)
void SetIndicesBoundingBox(unsigned int imin, unsigned int imax, unsigned int jmin, unsigned int jmax, unsigned int kmin, unsigned int kmax)
Set/Get the selected HyperTrees (HTs) to read : by default, all Hts, or by set coordinates bounding b...
void ClearAndAddSelectedHT(unsigned int idg, unsigned int fixedLevel=UINT_MAX)
Set/Get the selected HyperTrees (HTs) to read : by default, all Hts, or by set coordinates bounding b...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetDataSetName() override
Get the name of the data set being read.
~vtkXMLHyperTreeGridReader() override
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
Read the primary element from the file.
vtkHyperTreeGrid * GetOutput(int idx)
Get the reader's output.
void SetupUpdateExtent(int piece, int numberOfPieces)
void SetupEmptyOutput() override
Setup the output with no data available.
int vtkIdType
Definition vtkType.h:367