VTK
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 class VTKIOXML_EXPORT vtkXMLDataReader : public vtkXMLReader
34 {
35 public:
36 
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
43  virtual vtkIdType GetNumberOfPoints()=0;
44 
48  virtual vtkIdType GetNumberOfCells()=0;
49 
50  // For the specified port, copy the information this reader sets up in
51  // SetupOutputInformation to outInfo
52  void CopyOutputInformation(vtkInformation *outInfo, int port) override;
53 
54 protected:
56  ~vtkXMLDataReader() override;
57 
58  // Add functionality to methods from superclass.
59  void CreateXMLParser() override;
60  void DestroyXMLParser() override;
61  void SetupOutputInformation(vtkInformation *outInfo) override;
62 
63  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
64  void SetupOutputData() override;
65 
66  // Setup the reader for a given number of pieces.
67  virtual void SetupPieces(int numPieces);
68  virtual void DestroyPieces();
69 
70  // Read information from the file for the given piece.
71  int ReadPiece(vtkXMLDataElement* ePiece, int piece);
72  virtual int ReadPiece(vtkXMLDataElement* ePiece);
73 
74  // Read data from the file for the given piece.
75  int ReadPieceData(int piece);
76  virtual int ReadPieceData();
77 
78  void ReadXMLData() override;
79 
80  // Read a data array whose tuples coorrespond to points or cells.
81  virtual int ReadArrayForPoints(vtkXMLDataElement* da,
82  vtkAbstractArray* outArray);
83  virtual int ReadArrayForCells(vtkXMLDataElement* da,
84  vtkAbstractArray* outArray);
85 
86 
87  // Callback registered with the DataProgressObserver.
88  static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
89  void*);
90  // Progress callback from XMLParser.
91  virtual void DataProgressCallback();
92 
93  // The number of Pieces of data found in the file.
95 
96  // The PointData and CellData element representations for each piece.
99 
100  // The piece currently being read.
101  int Piece;
102 
103  // The number of point/cell data arrays in the output. Valid after
104  // SetupOutputData has been called.
107 
108  // The observer to report progress from reading data from XMLParser.
110 
111  // Specify the last time step read, useful to know if we need to rearead data
112  // //PointData
114  vtkTypeInt64 *PointDataOffset;
115  int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
116 
117  //CellData
119  vtkTypeInt64 *CellDataOffset;
120  int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
121 
122 private:
123  vtkXMLDataReader(const vtkXMLDataReader&) = delete;
124  void operator=(const vtkXMLDataReader&) = delete;
125 
128  vtkIdType numValues) override;
129 
130 };
131 
132 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
Represents an XML element and those nested inside.
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
vtkXMLDataElement ** CellDataElements
vtkTypeInt64 * CellDataOffset
virtual void ReadXMLData()
int vtkIdType
Definition: vtkType.h:345
virtual void DestroyXMLParser()
vtkTypeInt64 * PointDataOffset
supports function callbacks
vtkXMLDataElement ** PointDataElements
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void SetupOutputInformation(vtkInformation *vtkNotUsed(outInfo))
Definition: vtkXMLReader.h:207
vtkCallbackCommand * DataProgressObserver
virtual void ConvertGhostLevelsToGhostType(FieldType, vtkAbstractArray *, vtkIdType, vtkIdType)
Definition: vtkXMLReader.h:386
virtual int ReadPrimaryElement(vtkXMLDataElement *ePrimary)
Superclass for VTK XML file readers.
virtual void CopyOutputInformation(vtkInformation *vtkNotUsed(outInfo), int vtkNotUsed(port))
Definition: vtkXMLReader.h:136
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void CreateXMLParser()
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:43
virtual void SetupOutputData()