VTK  9.4.20241226
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
23VTK_ABI_NAMESPACE_BEGIN
24class VTKIOXML_EXPORT vtkXMLDataReader : public vtkXMLReader
25{
26public:
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
34
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
44protected:
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.
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.
81
82 // The PointData and CellData element representations for each piece.
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.
94
95 // The observer to report progress from reading data from XMLParser.
97
98private:
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
117 FieldType type, vtkAbstractArray* data, vtkIdType startIndex, vtkIdType numValues) override;
118};
119
120VTK_ABI_NAMESPACE_END
121#endif
Abstract superclass for all arrays.
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition vtkObject.h:162
Represents an XML element and those nested inside.
Superclass for VTK XML file readers.
void CopyOutputInformation(vtkInformation *outInfo, int port) override
virtual int ReadArrayForCells(vtkXMLDataElement *da, vtkAbstractArray *outArray)
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
virtual int ReadPiece(vtkXMLDataElement *ePiece)
void CreateXMLParser() override
Internal utility methods.
virtual void DataProgressCallback()
virtual vtkIdType GetNumberOfPoints()=0
Get the number of points in the output.
vtkCallbackCommand * DataProgressObserver
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLDataElement ** PointDataElements
vtkXMLDataElement ** TimeDataElements
static void DataProgressCallbackFunction(vtkObject *, unsigned long, void *, void *)
vtkXMLDataElement ** CellDataElements
int ReadPieceData(int piece)
void SetupOutputInformation(vtkInformation *outInfo) override
virtual int ReadPieceData()
void SetupOutputData() override
Setup the output's data with allocation.
void DestroyXMLParser() override
Internal utility methods.
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
Read the primary element from the file.
int ReadPiece(vtkXMLDataElement *ePiece, int piece)
virtual int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray)
virtual vtkIdType GetNumberOfCells()=0
Get the number of cells in the output.
virtual void SetupPieces(int numPieces)
virtual void DestroyPieces()
~vtkXMLDataReader() override
Superclass for VTK's XML format readers.
virtual void ConvertGhostLevelsToGhostType(FieldType, vtkAbstractArray *, vtkIdType, vtkIdType)
int vtkIdType
Definition vtkType.h:315