VTK  9.7.1
vtkXMLUnstructuredDataReader.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
14 #ifndef vtkXMLUnstructuredDataReader_h
15 #define vtkXMLUnstructuredDataReader_h
16 
17 #include "vtkIOXMLModule.h" // For export macro
18 #include "vtkXMLDataReader.h"
19 
20 VTK_ABI_NAMESPACE_BEGIN
21 class vtkCellArray;
22 class vtkIdTypeArray;
23 class vtkPointSet;
25 
26 class VTKIOXML_EXPORT vtkXMLUnstructuredDataReader : public vtkXMLDataReader
27 {
28 public:
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
35  vtkIdType GetNumberOfPoints() override;
36 
40  vtkIdType GetNumberOfCells() override;
41 
45  virtual vtkIdType GetNumberOfPieces();
46 
53  void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel);
54 
55  // For the specified port, copy the information this reader sets up in
56  // SetupOutputInformation to outInfo
57  void CopyOutputInformation(vtkInformation* outInfo, int port) override;
58 
59 protected:
61  ~vtkXMLUnstructuredDataReader() override;
62 
63  vtkPointSet* GetOutputAsPointSet();
64  vtkXMLDataElement* FindDataArrayWithName(vtkXMLDataElement* eParent, const char* name);
65 
66  // note that these decref the input array and return an array with a
67  // new reference:
68  vtkIdTypeArray* ConvertToIdTypeArray(vtkDataArray* a);
69  vtkUnsignedCharArray* ConvertToUnsignedCharArray(vtkDataArray* a);
70 
71  // Pipeline execute data driver. Called by vtkXMLReader.
72  void ReadXMLData() override;
73 
74  void SetupEmptyOutput() override;
75  virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces, int& ghostLevel) = 0;
76  virtual void SetupOutputTotals();
77  virtual void SetupNextPiece();
78  void SetupPieces(int numPieces) override;
79  void DestroyPieces() override;
80 
81  // Setup the output's information.
82  void SetupOutputInformation(vtkInformation* outInfo) override;
83 
84  void SetupOutputData() override;
85  int ReadPiece(vtkXMLDataElement* ePiece) override;
86  int ReadPieceData() override;
87  int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells,
88  vtkXMLDataElement* eCells, vtkCellArray* outCells);
89 
90  // Read faces and faceoffsets arrays for unstructured grid with polyhedon cells
91  int ReadPolyhedronCellArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells,
92  vtkCellArray* outFaces, vtkCellArray* outFaceOffsets);
93  // Backward compatibility layer to read unstructured grid with polyhedron cells.
94  int ReadFaceArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells, vtkIdTypeArray* outFaces,
95  vtkIdTypeArray* outFaceOffsets);
96  int ReadFaceCellArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells, vtkCellArray* outFaces,
97  vtkCellArray* outFaceOffsets);
98 
99  // Read a data array whose tuples coorrespond to points.
100  int ReadArrayForPoints(vtkXMLDataElement* da, vtkAbstractArray* outArray) override;
101 
102  // Get the number of points/cells in the given piece. Valid after
103  // UpdateInformation.
104  virtual vtkIdType GetNumberOfPointsInPiece(int piece);
105  virtual vtkIdType GetNumberOfCellsInPiece(int piece) = 0;
106 
107  // The update request.
111 
112  // The range of pieces from the file that will form the UpdatePiece.
114  int EndPiece;
118 
119  // The Points element for each piece.
122 
124  unsigned long PointsOffset;
125  int PointsNeedToReadTimeStep(vtkXMLDataElement* eNested);
126  int CellsNeedToReadTimeStep(
127  vtkXMLDataElement* eNested, int& cellstimestep, unsigned long& cellsoffset);
128 
133 
134 private:
136  void operator=(const vtkXMLUnstructuredDataReader&) = delete;
137 };
138 
139 VTK_ABI_NAMESPACE_END
140 #endif
virtual void SetupEmptyOutput()=0
Setup the output with no data available.
Represents an XML element and those nested inside.
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
concrete class for storing a set of points
Definition: vtkPointSet.h:58
Superclass for unstructured data XML readers.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
void CopyOutputInformation(vtkInformation *outInfo, int port) override
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
virtual void DestroyPieces()
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void SetupPieces(int numPieces)
void SetupOutputData() override
Setup the output's data with allocation.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual vtkIdType GetNumberOfPoints()=0
Get the number of points in the output.
virtual int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray)
dynamic, self-adjusting array of unsigned char
virtual vtkIdType GetNumberOfCells()=0
Get the number of cells in the output.
object to represent cell connectivity
Definition: vtkCellArray.h:177
Superclass for VTK XML file readers.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int ReadPiece(vtkXMLDataElement *ePiece, int piece)
void SetupOutputInformation(vtkInformation *outInfo) override
Setup the output's information.
virtual int ReadPieceData()