VTK  9.7.20261008
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
14
15#ifndef vtkXMLDataReader_h
16#define vtkXMLDataReader_h
17
18#include "vtkIOXMLModule.h" // For export macro
19#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
20#include "vtkXMLReader.h"
21
22#include <memory> // for std::unique_ptr
23
24VTK_ABI_NAMESPACE_BEGIN
25class VTKIOXML_EXPORT VTK_MARSHALAUTO vtkXMLDataReader : public vtkXMLReader
26{
27public:
29 void PrintSelf(ostream& os, vtkIndent indent) override;
30
35
40
41 // For the specified port, copy the information this reader sets up in
42 // SetupOutputInformation to outInfo
43 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
44
45protected:
48
49 // Add functionality to methods from superclass.
50 void CreateXMLParser() override;
51 void DestroyXMLParser() override;
52 void SetupOutputInformation(vtkInformation* outInfo) override;
53
54 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
55 void SetupOutputData() override;
56
57 // Setup the reader for a given number of pieces.
58 virtual void SetupPieces(int numPieces);
59 virtual void DestroyPieces();
60
61 // Read information from the file for the given piece.
62 int ReadPiece(vtkXMLDataElement* ePiece, int piece);
63 virtual int ReadPiece(vtkXMLDataElement* ePiece);
64
65 // Read data from the file for the given piece.
66 int ReadPieceData(int piece);
67 virtual int ReadPieceData();
68
69 void ReadXMLData() override;
70
71 // Read a data array whose tuples coorrespond to points or cells.
74
75 // Callback registered with the DataProgressObserver.
76 static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*, void*);
77 // Progress callback from XMLParser.
78 virtual void DataProgressCallback();
79
80 // The number of Pieces of data found in the file.
82
83 // The PointData and CellData element representations for each piece.
87
88 // The piece currently being read.
89 int Piece;
90
91 // The number of point/cell data arrays in the output. Valid after
92 // SetupOutputData has been called.
95
96 // The observer to report progress from reading data from XMLParser.
98
99private:
100 class MapStringToInt;
101 class MapStringToInt64;
102
103 // Specify the last time step read, useful to know if we need to rearead data
104 // //PointData
105 std::unique_ptr<MapStringToInt> PointDataTimeStep;
106 std::unique_ptr<MapStringToInt64> PointDataOffset;
107 int PointDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
108
109 // CellData
110 std::unique_ptr<MapStringToInt> CellDataTimeStep;
111 std::unique_ptr<MapStringToInt64> CellDataOffset;
112 int CellDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
113
114 vtkXMLDataReader(const vtkXMLDataReader&) = delete;
115 void operator=(const vtkXMLDataReader&) = delete;
116
118 FieldType type, vtkAbstractArray* data, vtkIdType startIndex, vtkIdType numValues) override;
119};
120
121VTK_ABI_NAMESPACE_END
122#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.
Represents an XML element and those nested inside.
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
Setup the output's information.
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
virtual void ConvertGhostLevelsToGhostType(FieldType, vtkAbstractArray *, vtkIdType, vtkIdType)
int vtkIdType
Definition vtkType.h:363
#define VTK_MARSHALAUTO