VTK  9.2.6
vtkXMLHyperTreeGridReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkXMLHyperTreeGridReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
43
44#ifndef vtkXMLHyperTreeGridReader_h
45#define vtkXMLHyperTreeGridReader_h
46
47#include "vtkIOXMLModule.h" // For export macro
48#include "vtkXMLReader.h"
49
50#include <limits.h> // Use internal
51#include <map> // Use internal
52
53class vtkBitArray;
54class vtkHyperTree;
57class vtkIdTypeArray;
58
59class VTKIOXML_EXPORT vtkXMLHyperTreeGridReader : public vtkXMLReader
60{
61public:
63 void PrintSelf(ostream& os, vtkIndent indent) override;
65
67
73
75
79 vtkSetMacro(FixedLevel, unsigned int);
80 vtkGetMacro(FixedLevel, unsigned int);
82
84
94 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
95
96 void SetIndicesBoundingBox(unsigned int imin, unsigned int imax, unsigned int jmin,
97 unsigned int jmax, unsigned int kmin, unsigned int kmax);
98
99 void ClearAndAddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
100 void AddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
102
103 // These defer to the HyperTreeGrid output.
105
107
108 void SetupUpdateExtent(int piece, int numberOfPieces);
109
110 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
111
112 // The most important stuff is here.
113 // Read the rest of the file and create the HyperTreeGrid.
114 void ReadXMLData() override;
115
116protected:
119
120 // Finalize the selected HyperTrees by, for example, transform
121 // coordinates bounding box in indices coordinates bounding box
122 // after initialize HyperTreeGrid.
124
125 // Return true if HyperTree identified by treeIndx is selected for
126 // the load.
127 bool IsSelectedHT(const vtkHyperTreeGrid* grid, vtkIdType treeIndx) const;
128
129 // Return the fixedLevel choice for this HyperTree
130 unsigned int GetFixedLevelOfThisHT(unsigned int numberOfLevels, vtkIdType treeIndx) const;
131
132 const char* GetDataSetName() override;
133
135
136 void GetOutputUpdateExtent(int& piece, int& numberOfPieces);
137
138 // Setup the output with no data available. Used in error cases.
139 void SetupEmptyOutput() override;
140
141 // Initialize the total number of vertices
143
144 // Initialize global start of next piece
146
147 // Initialize current output data
148 void SetupOutputData() override;
149
150 // Setup the output's information
151 void SetupOutputInformation(vtkInformation* outInfo) override;
152
153 // Setup the number of pieces
154 void SetupPieces(int numPieces);
155
156 // Pipeline execute data driver called by vtkXMLReader
157 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
158
159 // Declare that this reader produces HyperTreeGrids
161
162 // Read the coordinates describing the grid
164
165 //----------- Used for the major version < 1
166
167 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
168 // format version 0.
170
171 // Used by ReadTopology to recursively build the tree
173 unsigned int numChildren, vtkBitArray* desc, vtkIdTypeArray* posByLevel);
174
175 //---------- Used for other the major version
176
177 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
178 // format version 1.
180
181 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
182 // format version 2.
184
185 // Number of vertices in HyperTreeGrid being read
188
189 // Fixed the load maximum level
190 unsigned int FixedLevel;
191
192 bool Verbose = false;
193
194 bool FixedHTs = false;
203
204 // Selected HTs by coordinates of bounding box
206 // Selected HTs by indice coordinate of bounding box
207 unsigned int IndicesBoundingBox[6];
208 // Selected HTs by indice of HTs in the map.
209 // The value is the fixedLevel, but if this value is
210 // UINT_MAX, this is FixedLevel that is used.
211 std::map<unsigned int, unsigned int> IdsSelected;
212
215
219
220private:
222 void operator=(const vtkXMLHyperTreeGridReader&) = delete;
223};
224
225#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:37
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:40
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
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
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
~vtkXMLHyperTreeGridReader() override
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
vtkHyperTreeGrid * GetOutput(int idx)
Get the reader's output.
void SetupUpdateExtent(int piece, int numberOfPieces)
void SetupEmptyOutput() override
int vtkIdType
Definition vtkType.h:332