VTK  9.3.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 ReadFaceArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells, vtkIdTypeArray* outFaces,
92  vtkIdTypeArray* outFaceOffsets);
93 
94  // Read a data array whose tuples coorrespond to points.
95  int ReadArrayForPoints(vtkXMLDataElement* da, vtkAbstractArray* outArray) override;
96 
97  // Get the number of points/cells in the given piece. Valid after
98  // UpdateInformation.
99  virtual vtkIdType GetNumberOfPointsInPiece(int piece);
100  virtual vtkIdType GetNumberOfCellsInPiece(int piece) = 0;
101 
102  // The update request.
106 
107  // The range of pieces from the file that will form the UpdatePiece.
109  int EndPiece;
113 
114  // The Points element for each piece.
117 
119  unsigned long PointsOffset;
120  int PointsNeedToReadTimeStep(vtkXMLDataElement* eNested);
121  int CellsNeedToReadTimeStep(
122  vtkXMLDataElement* eNested, int& cellstimestep, unsigned long& cellsoffset);
123 
128 
129 private:
131  void operator=(const vtkXMLUnstructuredDataReader&) = delete;
132 };
133 
134 VTK_ABI_NAMESPACE_END
135 #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:315
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:175
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
virtual int ReadPieceData()