VTK: IO/XML/vtkXMLDataReader.h Source File

| VTK 9.3.1

vtkXMLDataReader.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
15 #ifndef vtkXMLDataReader_h
16 #define vtkXMLDataReader_h
17
18 #include "vtkIOXMLModule.h" // For export macro
19 #include "vtkXMLReader.h"
20
21 #include <memory> // for std::unique_ptr
22
23 VTK_ABI_NAMESPACE_BEGIN
24 class VTKIOXML_EXPORT vtkXMLDataReader : public vtkXMLReader
25 {
26 public:
27 vtkTypeMacro(vtkXMLDataReader, vtkXMLReader);
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
33 virtual vtkIdType GetNumberOfPoints() = 0;
34
38 virtual vtkIdType GetNumberOfCells() = 0;
39
40 // For the specified port, copy the information this reader sets up in
41 // SetupOutputInformation to outInfo
42 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
43
44 protected:
45 vtkXMLDataReader();
46 ~vtkXMLDataReader() override;
47
48 // Add functionality to methods from superclass.
49 void CreateXMLParser() override;
50 void DestroyXMLParser() override;
51 void SetupOutputInformation(vtkInformation* outInfo) override;
52
53 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
54 void SetupOutputData() override;
55
56 // Setup the reader for a given number of pieces.
57 virtual void SetupPieces(int numPieces);
58 virtual void DestroyPieces();
59
60 // Read information from the file for the given piece.
61 int ReadPiece(vtkXMLDataElement* ePiece, int piece);
62 virtual int ReadPiece(vtkXMLDataElement* ePiece);
63
64 // Read data from the file for the given piece.
65 int ReadPieceData(int piece);
66 virtual int ReadPieceData();
67
68 void ReadXMLData() override;
69
70 // Read a data array whose tuples coorrespond to points or cells.
71 virtual int ReadArrayForPoints(vtkXMLDataElement* da, vtkAbstractArray* outArray);
72 virtual int ReadArrayForCells(vtkXMLDataElement* da, vtkAbstractArray* outArray);
73
74 // Callback registered with the DataProgressObserver.
75 static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*, void*);
76 // Progress callback from XMLParser.
77 virtual void DataProgressCallback();
78
79 // The number of Pieces of data found in the file.
80 int NumberOfPieces;
81
82 // The PointData and CellData element representations for each piece.
83 vtkXMLDataElement** PointDataElements;
84 vtkXMLDataElement** CellDataElements;
85 vtkXMLDataElement** TimeDataElements;
86
87 // The piece currently being read.
88 int Piece;
89
90 // The number of point/cell data arrays in the output. Valid after
91 // SetupOutputData has been called.
92 int NumberOfPointArrays;
93 int NumberOfCellArrays;
94
95 // The observer to report progress from reading data from XMLParser.
96 vtkCallbackCommand* DataProgressObserver;
97
98 private:
99 class MapStringToInt;
100 class MapStringToInt64;
101
102 // Specify the last time step read, useful to know if we need to rearead data
103 // //PointData
104 std::unique_ptr<MapStringToInt> PointDataTimeStep;
105 std::unique_ptr<MapStringToInt64> PointDataOffset;
106 int PointDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
107
108 // CellData
109 std::unique_ptr<MapStringToInt> CellDataTimeStep;
110 std::unique_ptr<MapStringToInt64> CellDataOffset;
111 int CellDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
112
113 vtkXMLDataReader(const vtkXMLDataReader&) = delete;
114 void operator=(const vtkXMLDataReader&) = delete;
115
116 void ConvertGhostLevelsToGhostType(
117 FieldType type, vtkAbstractArray* data, vtkIdType startIndex, vtkIdType numValues) override;
118 };
119
120 VTK_ABI_NAMESPACE_END
121 #endif
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:76
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:49
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:26
vtkXMLDataReader
Superclass for VTK XML file readers.
Definition: vtkXMLDataReader.h:25
vtkXMLDataReader::CopyOutputInformation
void CopyOutputInformation(vtkInformation *outInfo, int port) override
vtkXMLDataReader::Piece
int Piece
Definition: vtkXMLDataReader.h:88
vtkXMLDataReader::ReadArrayForCells
virtual int ReadArrayForCells(vtkXMLDataElement *da, vtkAbstractArray *outArray)
vtkXMLDataReader::ReadXMLData
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
vtkXMLDataReader::ReadPiece
virtual int ReadPiece(vtkXMLDataElement *ePiece)
vtkXMLDataReader::CreateXMLParser
void CreateXMLParser() override
Internal utility methods.
vtkXMLDataReader::NumberOfPointArrays
int NumberOfPointArrays
Definition: vtkXMLDataReader.h:92
vtkXMLDataReader::DataProgressCallback
virtual void DataProgressCallback()
vtkXMLDataReader::GetNumberOfPoints
virtual vtkIdType GetNumberOfPoints()=0
Get the number of points in the output.
vtkXMLDataReader::NumberOfCellArrays
int NumberOfCellArrays
Definition: vtkXMLDataReader.h:93
vtkXMLDataReader::DataProgressObserver
vtkCallbackCommand * DataProgressObserver
Definition: vtkXMLDataReader.h:96
vtkXMLDataReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLDataReader::PointDataElements
vtkXMLDataElement ** PointDataElements
Definition: vtkXMLDataReader.h:83
vtkXMLDataReader::TimeDataElements
vtkXMLDataElement ** TimeDataElements
Definition: vtkXMLDataReader.h:85
vtkXMLDataReader::DataProgressCallbackFunction
static void DataProgressCallbackFunction(vtkObject *, unsigned long, void *, void *)
vtkXMLDataReader::CellDataElements
vtkXMLDataElement ** CellDataElements
Definition: vtkXMLDataReader.h:84
vtkXMLDataReader::ReadPieceData
int ReadPieceData(int piece)
vtkXMLDataReader::NumberOfPieces
int NumberOfPieces
Definition: vtkXMLDataReader.h:80
vtkXMLDataReader::SetupOutputInformation
void SetupOutputInformation(vtkInformation *outInfo) override
vtkXMLDataReader::ReadPieceData
virtual int ReadPieceData()
vtkXMLDataReader::SetupOutputData
void SetupOutputData() override
Setup the output's data with allocation.
vtkXMLDataReader::vtkXMLDataReader
vtkXMLDataReader()
vtkXMLDataReader::DestroyXMLParser
void DestroyXMLParser() override
Internal utility methods.
vtkXMLDataReader::ReadPrimaryElement
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
Read the primary element from the file.
vtkXMLDataReader::ReadPiece
int ReadPiece(vtkXMLDataElement *ePiece, int piece)
vtkXMLDataReader::ReadArrayForPoints
virtual int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray)
vtkXMLDataReader::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
Get the number of cells in the output.
vtkXMLDataReader::SetupPieces
virtual void SetupPieces(int numPieces)
vtkXMLDataReader::DestroyPieces
virtual void DestroyPieces()
vtkXMLDataReader::~vtkXMLDataReader
~vtkXMLDataReader() override
vtkXMLReader
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:48
vtkXMLReader::ConvertGhostLevelsToGhostType
virtual void ConvertGhostLevelsToGhostType(FieldType, vtkAbstractArray *, vtkIdType, vtkIdType)
Definition: vtkXMLReader.h:490
vtkXMLReader::FieldType
FieldType
Definition: vtkXMLReader.h:54
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkXMLReader.h