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) VTK_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) VTK_OVERRIDE;
53 
54 protected:
56  ~vtkXMLDataReader() VTK_OVERRIDE;
57 
58  // Add functionality to methods from superclass.
59  void CreateXMLParser() VTK_OVERRIDE;
60  void DestroyXMLParser() VTK_OVERRIDE;
61  void SetupOutputInformation(vtkInformation *outInfo) VTK_OVERRIDE;
62 
63  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) VTK_OVERRIDE;
64  void SetupOutputData() VTK_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() VTK_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.
94  int NumberOfPieces;
95 
96  // The PointData and CellData element representations for each piece.
97  vtkXMLDataElement** PointDataElements;
98  vtkXMLDataElement** CellDataElements;
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.
105  int NumberOfPointArrays;
106  int NumberOfCellArrays;
107 
108  // The observer to report progress from reading data from XMLParser.
109  vtkCallbackCommand* DataProgressObserver;
110 
111  // Specify the last time step read, useful to know if we need to rearead data
112  // //PointData
113  int *PointDataTimeStep;
114  vtkTypeInt64 *PointDataOffset;
115  int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
116 
117  //CellData
118  int *CellDataTimeStep;
119  vtkTypeInt64 *CellDataOffset;
120  int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
121 
122 private:
123  vtkXMLDataReader(const vtkXMLDataReader&) VTK_DELETE_FUNCTION;
124  void operator=(const vtkXMLDataReader&) VTK_DELETE_FUNCTION;
125 
126  void ConvertGhostLevelsToGhostType(
128  vtkIdType numValues) VTK_OVERRIDE;
129 
130 };
131 
132 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:53
Represents an XML element and those nested inside.
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
int vtkIdType
Definition: vtkType.h:345
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:33
Superclass for VTK XML file readers.
virtual void CopyOutputInformation(vtkInformation *vtkNotUsed(outInfo), int vtkNotUsed(port))
Definition: vtkXMLReader.h:131
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:43