VTK  9.3.20240327
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 
36 
41 
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:
62 
65 
66  // note that these decref the input array and return an array with a
67  // new reference:
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  int ReadFaceCellArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells, vtkCellArray* outFaces,
94  vtkCellArray* outFaceOffsets);
95 
96  // Read a data array whose tuples coorrespond to points.
98 
99  // Get the number of points/cells in the given piece. Valid after
100  // UpdateInformation.
102  virtual vtkIdType GetNumberOfCellsInPiece(int piece) = 0;
103 
104  // The update request.
108 
109  // The range of pieces from the file that will form the UpdatePiece.
111  int EndPiece;
115 
116  // The Points element for each piece.
119 
121  unsigned long PointsOffset;
124  vtkXMLDataElement* eNested, int& cellstimestep, unsigned long& cellsoffset);
125 
130 
131 private:
133  void operator=(const vtkXMLUnstructuredDataReader&) = delete;
134 };
135 
136 VTK_ABI_NAMESPACE_END
137 #endif
Abstract superclass for all arrays.
object to represent cell connectivity
Definition: vtkCellArray.h:285
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:108
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:97
dynamic, self-adjusting array of unsigned char
Represents an XML element and those nested inside.
Superclass for VTK XML file readers.
Superclass for unstructured data XML readers.
void SetupEmptyOutput() override
Setup the output with no data available.
virtual vtkIdType GetNumberOfCellsInPiece(int piece)=0
vtkIdType GetNumberOfPoints() override
Get the number of points in the output.
void SetupOutputData() override
Setup the output's data with allocation.
int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray) override
vtkXMLDataElement * FindDataArrayWithName(vtkXMLDataElement *eParent, const char *name)
int ReadFaceArray(vtkIdType numberOfCells, vtkXMLDataElement *eCells, vtkIdTypeArray *outFaces, vtkIdTypeArray *outFaceOffsets)
int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells, vtkXMLDataElement *eCells, vtkCellArray *outCells)
int ReadPiece(vtkXMLDataElement *ePiece) override
~vtkXMLUnstructuredDataReader() override
virtual vtkIdType GetNumberOfPointsInPiece(int piece)
int CellsNeedToReadTimeStep(vtkXMLDataElement *eNested, int &cellstimestep, unsigned long &cellsoffset)
virtual void GetOutputUpdateExtent(int &piece, int &numberOfPieces, int &ghostLevel)=0
void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel)
Setup the reader as if the given update extent were requested by its output.
int ReadFaceCellArray(vtkIdType numberOfCells, vtkXMLDataElement *eCells, vtkCellArray *outFaces, vtkCellArray *outFaceOffsets)
vtkPointSet * GetOutputAsPointSet()
vtkIdTypeArray * ConvertToIdTypeArray(vtkDataArray *a)
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
void DestroyPieces() override
vtkUnsignedCharArray * ConvertToUnsignedCharArray(vtkDataArray *a)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkIdType GetNumberOfPieces()
Get the number of pieces in the file.
vtkIdType GetNumberOfCells() override
Get the number of cells in the output.
virtual void SetupOutputTotals()
void SetupPieces(int numPieces) override
void SetupOutputInformation(vtkInformation *outInfo) override
int PointsNeedToReadTimeStep(vtkXMLDataElement *eNested)
void CopyOutputInformation(vtkInformation *outInfo, int port) override
@ port
Definition: vtkX3D.h:447
@ name
Definition: vtkX3D.h:219
int vtkIdType
Definition: vtkType.h:315