VTK  9.4.20250102
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
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
83 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
84
85 void SetIndicesBoundingBox(unsigned int imin, unsigned int imax, unsigned int jmin,
86 unsigned int jmax, unsigned int kmin, unsigned int kmax);
87
88 void ClearAndAddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
89 void AddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
91
92 // These defer to the HyperTreeGrid output.
94
96
97 void SetupUpdateExtent(int piece, int numberOfPieces);
98
99 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
100
101 // The most important stuff is here.
102 // Read the rest of the file and create the HyperTreeGrid.
103 void ReadXMLData() override;
104
105protected:
108
109 // Finalize the selected HyperTrees by, for example, transform
110 // coordinates bounding box in indices coordinates bounding box
111 // after initialize HyperTreeGrid.
113
114 // Return true if HyperTree identified by treeIndx is selected for
115 // the load.
116 bool IsSelectedHT(const vtkHyperTreeGrid* grid, vtkIdType treeIndx) const;
117
118 // Return the fixedLevel choice for this HyperTree
119 unsigned int GetFixedLevelOfThisHT(unsigned int numberOfLevels, vtkIdType treeIndx) const;
120
121 const char* GetDataSetName() override;
122
124
125 void GetOutputUpdateExtent(int& piece, int& numberOfPieces);
126
127 // Setup the output with no data available. Used in error cases.
128 void SetupEmptyOutput() override;
129
130 // Initialize the total number of vertices
132
133 // Initialize global start of next piece
135
136 // Initialize current output data
137 void SetupOutputData() override;
138
139 // Setup the output's information
140 void SetupOutputInformation(vtkInformation* outInfo) override;
141
142 // Setup the number of pieces
143 void SetupPieces(int numPieces);
144
145 // Pipeline execute data driver called by vtkXMLReader
146 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
147
148 // Declare that this reader produces HyperTreeGrids
150
151 // Read the coordinates describing the grid
153
154 //----------- Used for the major version < 1
155
156 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
157 // format version 0.
159
160 // Used by ReadTopology to recursively build the tree
162 unsigned int numChildren, vtkBitArray* desc, vtkIdTypeArray* posByLevel);
163
164 //---------- Used for other the major version
165
166 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
167 // format version 1.
169
170 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
171 // format version 2.
173
174 // Number of vertices in HyperTreeGrid being read
177
178 // Fixed the load maximum level
179 unsigned int FixedLevel;
180
181 bool Verbose = false;
182
183 bool FixedHTs = false;
185 {
189 IDS_SELECTED
190 };
191 SelectedType SelectedHTs = ALL;
192
193 // Selected HTs by coordinates of bounding box
194 double CoordinatesBoundingBox[6];
195 // Selected HTs by indice coordinate of bounding box
196 unsigned int IndicesBoundingBox[6];
197 // Selected HTs by indice of HTs in the map.
198 // The value is the fixedLevel, but if this value is
199 // UINT_MAX, this is FixedLevel that is used.
200 std::map<unsigned int, unsigned int> IdsSelected;
201
204
208
209private:
211 void operator=(const vtkXMLHyperTreeGridReader&) = delete;
212};
213
214VTK_ABI_NAMESPACE_END
215#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:29
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.
Read VTK XML HyperTreeGrid files.
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
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.
Superclass for VTK's XML format readers.
int vtkIdType
Definition vtkType.h:315