VTK  9.1.0
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=========================================================================*/
41#ifndef vtkXMLHyperTreeGridReader_h
42#define vtkXMLHyperTreeGridReader_h
43
44#include "vtkIOXMLModule.h" // For export macro
45#include "vtkXMLReader.h"
46
47#include <limits.h> // Use internal
48#include <map> // Use internal
49
50class vtkBitArray;
51class vtkHyperTree;
54class vtkIdTypeArray;
55
56class VTKIOXML_EXPORT vtkXMLHyperTreeGridReader : public vtkXMLReader
57{
58public:
60 void PrintSelf(ostream& os, vtkIndent indent) override;
62
64
70
72
76 vtkSetMacro(FixedLevel, unsigned int);
77 vtkGetMacro(FixedLevel, unsigned int);
79
81
91 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
92
93 void SetIndicesBoundingBox(unsigned int imin, unsigned int imax, unsigned int jmin,
94 unsigned int jmax, unsigned int kmin, unsigned int kmax);
95
96 void ClearAndAddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
97 void AddSelectedHT(unsigned int idg, unsigned int fixedLevel = UINT_MAX);
99
100 // These defer to the HyperTreeGrid output.
102
104
105 void SetupUpdateExtent(int piece, int numberOfPieces);
106
107 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
108
109 // The most important stuff is here.
110 // Read the rest of the file and create the HyperTreeGrid.
111 void ReadXMLData() override;
112
113protected:
116
117 // Finalize the selected HyperTrees by, for example, transform
118 // coordinates bounding box in indices coordinates bounding box
119 // after initialize HyperTreeGrid.
121
122 // Return true if HyperTree identified by treeIndx is selected for
123 // the load.
124 bool IsSelectedHT(const vtkHyperTreeGrid* grid, vtkIdType treeIndx) const;
125
126 // Return the fixedLevel choice for this HyperTree
127 unsigned int GetFixedLevelOfThisHT(unsigned int numberOfLevels, vtkIdType treeIndx) const;
128
129 const char* GetDataSetName() override;
130
132
133 void GetOutputUpdateExtent(int& piece, int& numberOfPieces);
134
135 // Setup the output with no data available. Used in error cases.
136 void SetupEmptyOutput() override;
137
138 // Initialize the total number of vertices
140
141 // Initialize global start of next piece
143
144 // Initialize current output data
145 void SetupOutputData() override;
146
147 // Setup the output's information
148 void SetupOutputInformation(vtkInformation* outInfo) override;
149
150 // Setup the number of pieces
151 void SetupPieces(int numPieces);
152
153 // Pipeline execute data driver called by vtkXMLReader
154 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
155
156 // Declare that this reader produces HyperTreeGrids
158
159 // Read the coordinates describing the grid
161
162 //----------- Used for the major version < 1
163
164 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
165 // format version 0.
167
168 // Used by ReadTopology to recursively build the tree
170 unsigned int numChildren, vtkBitArray* desc, vtkIdTypeArray* posByLevel);
171
172 //---------- Used for other the major version
173
174 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
175 // format version 1.
177
178 // Recover the structure of the HyperTreeGrid, used by ReadXMLData. File
179 // format version 2.
181
182 // Number of vertices in HyperTreeGrid being read
185
186 // Fixed the load maximum level
187 unsigned int FixedLevel;
188
189 bool Verbose = false;
190
191 bool FixedHTs = false;
193 {
197 IDS_SELECTED
198 };
199 SelectedType SelectedHTs = ALL;
200
201 // Selected HTs by coordinates of bounding box
202 double CoordinatesBoundingBox[6];
203 // Selected HTs by indice coordinate of bounding box
204 unsigned int IndicesBoundingBox[6];
205 // Selected HTs by indice of HTs in the map.
206 // The value is the fixedLevel, but if this value is
207 // UINT_MAX, this is FixedLevel that is used.
208 std::map<unsigned int, unsigned int> IdsSelected;
209
212
216
217private:
219 void operator=(const vtkXMLHyperTreeGridReader&) = delete;
220};
221
222#endif
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:34
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.
Definition: vtkHyperTree.h:177
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:113
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
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
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:66
@ level
Definition: vtkX3D.h:401
@ port
Definition: vtkX3D.h:453
int vtkIdType
Definition: vtkType.h:332