VTK  9.0.1
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 
35 class VTKIOXML_EXPORT vtkXMLDataReader : public vtkXMLReader
36 {
37 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
45 
49  virtual vtkIdType GetNumberOfCells() = 0;
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 
55 protected:
57  ~vtkXMLDataReader() override;
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.
96 
97  // The piece currently being read.
98  int Piece;
99 
100  // The number of point/cell data arrays in the output. Valid after
101  // SetupOutputData has been called.
104 
105  // The observer to report progress from reading data from XMLParser.
107 
108 private:
109  class MapStringToInt;
110  class MapStringToInt64;
111 
112  // Specify the last time step read, useful to know if we need to rearead data
113  // //PointData
114  std::unique_ptr<MapStringToInt> PointDataTimeStep;
115  std::unique_ptr<MapStringToInt64> PointDataOffset;
116  int PointDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
117 
118  // CellData
119  std::unique_ptr<MapStringToInt> CellDataTimeStep;
120  std::unique_ptr<MapStringToInt64> CellDataOffset;
121  int CellDataNeedToReadTimeStep(vtkXMLDataElement* eNested);
122 
123  vtkXMLDataReader(const vtkXMLDataReader&) = delete;
124  void operator=(const vtkXMLDataReader&) = delete;
125 
127  FieldType type, vtkAbstractArray* data, vtkIdType startIndex, vtkIdType numValues) override;
128 };
129 
130 #endif
Abstract superclass for all arrays.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:54
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
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:44
virtual void ConvertGhostLevelsToGhostType(FieldType, vtkAbstractArray *, vtkIdType, vtkIdType)
Definition: vtkXMLReader.h:382
@ port
Definition: vtkX3D.h:453
@ type
Definition: vtkX3D.h:522
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:338