VTK  9.0.1
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 
50 class vtkBitArray;
51 class vtkHyperTree;
52 class vtkHyperTreeGrid;
54 class vtkIdTypeArray;
55 
56 class VTKIOXML_EXPORT vtkXMLHyperTreeGridReader : public vtkXMLReader
57 {
58 public:
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 
113 protected:
116 
117  // Finalize the selected HyperTrees by, for example, transform
118  // coordinates bounding box in indices coordinates bounding box
119  // after initialize HyperTreeGrid.
120  void CalculateHTs(const vtkHyperTreeGrid* grid);
121 
122  // Return true if HyperTree identified by treeIndx is selected for
123  // the load.
124  bool IsSelectedHT(const vtkHyperTreeGrid* grid, unsigned int treeIndx) const;
125 
126  // Return the fixedLevel choice for this HyperTree
127  vtkIdType GetFixedLevelOfThisHT(vtkIdType numberOfLevels, unsigned int 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.
166 
167  // Used by ReadTopology to recursively build the tree
169  int numChildren, vtkBitArray* desc, vtkIdTypeArray* posByLevel);
170 
171  //---------- Used for other the major version
172 
173  // Recover the structure of the HyperTreeGrid, used by ReadXMLData.
175 
176  // Number of vertices in HyperTreeGrid being read
179 
180  // Fixed the load maximum level
181  unsigned int FixedLevel = UINT_MAX;
182 
183  bool Verbose = false;
184 
185  bool FixedHTs = false;
187  {
191  IDS_SELECTED
192  };
193  SelectedType SelectedHTs = ALL;
194 
195  // Selected HTs by coordinates of bounding box
196  double CoordinatesBoundingBox[6];
197  // Selected HTs by indice coordinate of bounding box
198  unsigned int IndicesBoundingBox[6];
199  // Selected HTs by indice of HTs in the map.
200  // The value is the fixedLevel, but if this value is
201  // UINT_MAX, this is FixedLevel that is used.
202  std::map<unsigned int, unsigned int> IdsSelected;
203 
206 
208  int EndPiece;
209  int Piece;
210 
211 private:
213  void operator=(const vtkXMLHyperTreeGridReader&) = delete;
214 };
215 
216 #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:179
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
Represents an XML element and those nested inside.
Read VTK XML HyperTreeGrid files.
int FillOutputPortInformation(int, vtkInformation *) override
Fill the output port information objects for this algorithm.
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
void CalculateHTs(const vtkHyperTreeGrid *grid)
vtkHyperTreeGrid * GetOutput()
Get the reader's output.
void SetupPieces(int numPieces)
void AddSelectedHT(unsigned int idg, unsigned int fixedLevel=UINT_MAX)
vtkHyperTreeGrid * GetOutput(int idx)
std::map< unsigned int, unsigned int > IdsSelected
const char * GetDataSetName() override
vtkIdType GetFixedLevelOfThisHT(vtkIdType numberOfLevels, unsigned int treeIndx) const
static vtkXMLHyperTreeGridReader * New()
void ReadTrees_1(vtkXMLDataElement *elem)
void SetupOutputData() override
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)
void ClearAndAddSelectedHT(unsigned int idg, unsigned int fixedLevel=UINT_MAX)
void SubdivideFromDescriptor_0(vtkHyperTreeGridNonOrientedCursor *treeCursor, unsigned int level, int numChildren, vtkBitArray *desc, vtkIdTypeArray *posByLevel)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkXMLHyperTreeGridReader() override
bool IsSelectedHT(const vtkHyperTreeGrid *grid, unsigned int treeIndx) const
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
void SetupUpdateExtent(int piece, int numberOfPieces)
void SetupEmptyOutput() override
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:44
@ level
Definition: vtkX3D.h:401
@ port
Definition: vtkX3D.h:453
int vtkIdType
Definition: vtkType.h:338