VTK  9.1.0
vtkXMLDataReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkXMLDataReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
27#ifndef vtkXMLDataReader_h
28#define vtkXMLDataReader_h
29
30#include "vtkIOXMLModule.h" // For export macro
31#include "vtkXMLReader.h"
32
33#include <memory> // for std::unique_ptr
34
35class VTKIOXML_EXPORT vtkXMLDataReader : public vtkXMLReader
36{
37public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
45
50
51 // For the specified port, copy the information this reader sets up in
52 // SetupOutputInformation to outInfo
53 void CopyOutputInformation(vtkInformation* outInfo, int port) override;
54
55protected:
58
59 // Add functionality to methods from superclass.
60 void CreateXMLParser() override;
61 void DestroyXMLParser() override;
62 void SetupOutputInformation(vtkInformation* outInfo) override;
63
64 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
65 void SetupOutputData() override;
66
67 // Setup the reader for a given number of pieces.
68 virtual void SetupPieces(int numPieces);
69 virtual void DestroyPieces();
70
71 // Read information from the file for the given piece.
72 int ReadPiece(vtkXMLDataElement* ePiece, int piece);
73 virtual int ReadPiece(vtkXMLDataElement* ePiece);
74
75 // Read data from the file for the given piece.
76 int ReadPieceData(int piece);
77 virtual int ReadPieceData();
78
79 void ReadXMLData() override;
80
81 // Read a data array whose tuples coorrespond to points or cells.
84
85 // Callback registered with the DataProgressObserver.
86 static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*, void*);
87 // Progress callback from XMLParser.
88 virtual void DataProgressCallback();
89
90 // The number of Pieces of data found in the file.
92
93 // The PointData and CellData element representations for each piece.
97
98 // The piece currently being read.
99 int Piece;
100
101 // The number of point/cell data arrays in the output. Valid after
102 // SetupOutputData has been called.
105
106 // The observer to report progress from reading data from XMLParser.
108
109private:
110 class MapStringToInt;
111 class MapStringToInt64;
112
113 // Specify the last time step read, useful to know if we need to rearead data
114 // //PointData
115 std::unique_ptr<MapStringToInt> PointDataTimeStep;
116 std::unique_ptr<MapStringToInt64> PointDataOffset;
117 int PointDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
118
119 // CellData
120 std::unique_ptr<MapStringToInt> CellDataTimeStep;
121 std::unique_ptr<MapStringToInt64> CellDataOffset;
122 int CellDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
123
124 vtkXMLDataReader(const vtkXMLDataReader&) = delete;
125 void operator=(const vtkXMLDataReader&) = delete;
126
128 FieldType type, vtkAbstractArray* data, vtkIdType startIndex, vtkIdType numValues) override;
129};
130
131#endif
Abstract superclass for all arrays.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:73
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
virtual int ReadPiece(vtkXMLDataElement *ePiece)
void CreateXMLParser() override
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
void DestroyXMLParser() override
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
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.
Definition: vtkXMLReader.h:66
virtual void ConvertGhostLevelsToGhostType(FieldType, vtkAbstractArray *, vtkIdType, vtkIdType)
Definition: vtkXMLReader.h:448
@ port
Definition: vtkX3D.h:453
@ type
Definition: vtkX3D.h:522
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:332