VTK: IO/XML/vtkXMLUnstructuredDataReader.h Source File

| 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;
24 class vtkUnsignedCharArray;
25
26 class VTKIOXML_EXPORT vtkXMLUnstructuredDataReader : public vtkXMLDataReader
27 {
28 public:
29 vtkTypeMacro(vtkXMLUnstructuredDataReader, vtkXMLDataReader);
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:
60 vtkXMLUnstructuredDataReader();
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.
103 int UpdatePieceId;
104 int UpdateNumberOfPieces;
105 int UpdateGhostLevel;
106
107 // The range of pieces from the file that will form the UpdatePiece.
108 int StartPiece;
109 int EndPiece;
110 vtkIdType TotalNumberOfPoints;
111 vtkIdType TotalNumberOfCells;
112 vtkIdType StartPoint;
113
114 // The Points element for each piece.
115 vtkXMLDataElement** PointElements;
116 vtkIdType* NumberOfPoints;
117
118 int PointsTimeStep;
119 unsigned long PointsOffset;
120 int PointsNeedToReadTimeStep(vtkXMLDataElement* eNested);
121 int CellsNeedToReadTimeStep(
122 vtkXMLDataElement* eNested, int& cellstimestep, unsigned long& cellsoffset);
123
124 int CellArrayTimeStepRead;
125 bool CanReadCellArray;
126 const char* CellArrayCachedInputString;
127 const char* CellArrayCachedFileName;
128
129 private:
130 vtkXMLUnstructuredDataReader(const vtkXMLUnstructuredDataReader&) = delete;
131 void operator=(const vtkXMLUnstructuredDataReader&) = delete;
132 };
133
134 VTK_ABI_NAMESPACE_END
135 #endif
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:76
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:37
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkPointSet
concrete class for storing a set of points
Definition: vtkPointSet.h:68
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:40
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:26
vtkXMLDataReader
Superclass for VTK XML file readers.
Definition: vtkXMLDataReader.h:25
vtkXMLUnstructuredDataReader
Superclass for unstructured data XML readers.
Definition: vtkXMLUnstructuredDataReader.h:27
vtkXMLUnstructuredDataReader::SetupEmptyOutput
void SetupEmptyOutput() override
Setup the output with no data available.
vtkXMLUnstructuredDataReader::GetNumberOfCellsInPiece
virtual vtkIdType GetNumberOfCellsInPiece(int piece)=0
vtkXMLUnstructuredDataReader::GetNumberOfPoints
vtkIdType GetNumberOfPoints() override
Get the number of points in the output.
vtkXMLUnstructuredDataReader::PointElements
vtkXMLDataElement ** PointElements
Definition: vtkXMLUnstructuredDataReader.h:115
vtkXMLUnstructuredDataReader::PointsOffset
unsigned long PointsOffset
Definition: vtkXMLUnstructuredDataReader.h:119
vtkXMLUnstructuredDataReader::SetupOutputData
void SetupOutputData() override
Setup the output's data with allocation.
vtkXMLUnstructuredDataReader::ReadArrayForPoints
int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray) override
vtkXMLUnstructuredDataReader::FindDataArrayWithName
vtkXMLDataElement * FindDataArrayWithName(vtkXMLDataElement *eParent, const char *name)
vtkXMLUnstructuredDataReader::StartPoint
vtkIdType StartPoint
Definition: vtkXMLUnstructuredDataReader.h:112
vtkXMLUnstructuredDataReader::ReadFaceArray
int ReadFaceArray(vtkIdType numberOfCells, vtkXMLDataElement *eCells, vtkIdTypeArray *outFaces, vtkIdTypeArray *outFaceOffsets)
vtkXMLUnstructuredDataReader::UpdateNumberOfPieces
int UpdateNumberOfPieces
Definition: vtkXMLUnstructuredDataReader.h:104
vtkXMLUnstructuredDataReader::ReadCellArray
int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells, vtkXMLDataElement *eCells, vtkCellArray *outCells)
vtkXMLUnstructuredDataReader::CellArrayCachedFileName
const char * CellArrayCachedFileName
Definition: vtkXMLUnstructuredDataReader.h:127
vtkXMLUnstructuredDataReader::ReadPiece
int ReadPiece(vtkXMLDataElement *ePiece) override
vtkXMLUnstructuredDataReader::ReadPieceData
int ReadPieceData() override
vtkXMLUnstructuredDataReader::~vtkXMLUnstructuredDataReader
~vtkXMLUnstructuredDataReader() override
vtkXMLUnstructuredDataReader::GetNumberOfPointsInPiece
virtual vtkIdType GetNumberOfPointsInPiece(int piece)
vtkXMLUnstructuredDataReader::SetupNextPiece
virtual void SetupNextPiece()
vtkXMLUnstructuredDataReader::CellsNeedToReadTimeStep
int CellsNeedToReadTimeStep(vtkXMLDataElement *eNested, int &cellstimestep, unsigned long &cellsoffset)
vtkXMLUnstructuredDataReader::GetOutputUpdateExtent
virtual void GetOutputUpdateExtent(int &piece, int &numberOfPieces, int &ghostLevel)=0
vtkXMLUnstructuredDataReader::StartPiece
int StartPiece
Definition: vtkXMLUnstructuredDataReader.h:108
vtkXMLUnstructuredDataReader::SetupUpdateExtent
void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel)
Setup the reader as if the given update extent were requested by its output.
vtkXMLUnstructuredDataReader::GetOutputAsPointSet
vtkPointSet * GetOutputAsPointSet()
vtkXMLUnstructuredDataReader::ConvertToIdTypeArray
vtkIdTypeArray * ConvertToIdTypeArray(vtkDataArray *a)
vtkXMLUnstructuredDataReader::ReadXMLData
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
vtkXMLUnstructuredDataReader::CellArrayTimeStepRead
int CellArrayTimeStepRead
Definition: vtkXMLUnstructuredDataReader.h:124
vtkXMLUnstructuredDataReader::DestroyPieces
void DestroyPieces() override
vtkXMLUnstructuredDataReader::CellArrayCachedInputString
const char * CellArrayCachedInputString
Definition: vtkXMLUnstructuredDataReader.h:126
vtkXMLUnstructuredDataReader::ConvertToUnsignedCharArray
vtkUnsignedCharArray * ConvertToUnsignedCharArray(vtkDataArray *a)
vtkXMLUnstructuredDataReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLUnstructuredDataReader::GetNumberOfPieces
virtual vtkIdType GetNumberOfPieces()
Get the number of pieces in the file.
vtkXMLUnstructuredDataReader::GetNumberOfCells
vtkIdType GetNumberOfCells() override
Get the number of cells in the output.
vtkXMLUnstructuredDataReader::UpdateGhostLevel
int UpdateGhostLevel
Definition: vtkXMLUnstructuredDataReader.h:105
vtkXMLUnstructuredDataReader::SetupOutputTotals
virtual void SetupOutputTotals()
vtkXMLUnstructuredDataReader::CanReadCellArray
bool CanReadCellArray
Definition: vtkXMLUnstructuredDataReader.h:125
vtkXMLUnstructuredDataReader::NumberOfPoints
vtkIdType * NumberOfPoints
Definition: vtkXMLUnstructuredDataReader.h:116
vtkXMLUnstructuredDataReader::SetupPieces
void SetupPieces(int numPieces) override
vtkXMLUnstructuredDataReader::EndPiece
int EndPiece
Definition: vtkXMLUnstructuredDataReader.h:109
vtkXMLUnstructuredDataReader::PointsTimeStep
int PointsTimeStep
Definition: vtkXMLUnstructuredDataReader.h:118
vtkXMLUnstructuredDataReader::SetupOutputInformation
void SetupOutputInformation(vtkInformation *outInfo) override
vtkXMLUnstructuredDataReader::TotalNumberOfPoints
vtkIdType TotalNumberOfPoints
Definition: vtkXMLUnstructuredDataReader.h:110
vtkXMLUnstructuredDataReader::UpdatePieceId
int UpdatePieceId
Definition: vtkXMLUnstructuredDataReader.h:103
vtkXMLUnstructuredDataReader::PointsNeedToReadTimeStep
int PointsNeedToReadTimeStep(vtkXMLDataElement *eNested)
vtkXMLUnstructuredDataReader::CopyOutputInformation
void CopyOutputInformation(vtkInformation *outInfo, int port) override
vtkXMLUnstructuredDataReader::TotalNumberOfCells
vtkIdType TotalNumberOfCells
Definition: vtkXMLUnstructuredDataReader.h:111
vtkXMLUnstructuredDataReader::vtkXMLUnstructuredDataReader
vtkXMLUnstructuredDataReader()
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkXMLDataReader.h