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  enum FieldType
37  {
40  OTHER
41  };
42 
43 
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
50  virtual vtkIdType GetNumberOfPoints()=0;
51 
55  virtual vtkIdType GetNumberOfCells()=0;
56 
57  // For the specified port, copy the information this reader sets up in
58  // SetupOutputInformation to outInfo
59  virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
60 
61 protected:
64 
65  // Add functionality to methods from superclass.
66  virtual void CreateXMLParser();
67  virtual void DestroyXMLParser();
68  virtual void SetupOutputInformation(vtkInformation *outInfo);
69 
71  void SetupOutputData();
72 
73  // Setup the reader for a given number of pieces.
74  virtual void SetupPieces(int numPieces);
75  virtual void DestroyPieces();
76 
77  // Read information from the file for the given piece.
78  int ReadPiece(vtkXMLDataElement* ePiece, int piece);
79  virtual int ReadPiece(vtkXMLDataElement* ePiece);
80 
81  // Read data from the file for the given piece.
82  int ReadPieceData(int piece);
83  virtual int ReadPieceData();
84 
85  virtual void ReadXMLData();
86 
87  // Read a data array whose tuples coorrespond to points or cells.
88  virtual int ReadArrayForPoints(vtkXMLDataElement* da,
89  vtkAbstractArray* outArray);
90  virtual int ReadArrayForCells(vtkXMLDataElement* da,
91  vtkAbstractArray* outArray);
92 
93  // Read an Array values starting at the given index and up to numValues.
94  // This method assumes that the array is of correct size to
95  // accommodate all numValues values. arrayIndex is the value index at which the read
96  // values will be put in the array.
97  int ReadArrayValues(
98  vtkXMLDataElement* da, vtkIdType arrayIndex, vtkAbstractArray* array,
99  vtkIdType startIndex, vtkIdType numValues, FieldType type = OTHER);
100 
101 
102 
103  // Callback registered with the DataProgressObserver.
104  static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
105  void*);
106  // Progress callback from XMLParser.
107  virtual void DataProgressCallback();
108 
109  // The number of Pieces of data found in the file.
111 
112  // The PointData and CellData element representations for each piece.
115 
116  // The piece currently being read.
117  int Piece;
118 
119  // The number of point/cell data arrays in the output. Valid after
120  // SetupOutputData has been called.
123 
124  // Flag for whether DataProgressCallback should actually update
125  // progress.
127 
128  // The observer to report progress from reading data from XMLParser.
130 
131  // Specify the last time step read, useful to know if we need to rearead data
132  // //PointData
134  vtkTypeInt64 *PointDataOffset;
135  int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
136 
137  //CellData
139  vtkTypeInt64 *CellDataOffset;
140  int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
141 
142 private:
143  vtkXMLDataReader(const vtkXMLDataReader&) VTK_DELETE_FUNCTION;
144  void operator=(const vtkXMLDataReader&) VTK_DELETE_FUNCTION;
145 
146  void ConvertGhostLevelsToGhostType(
148  vtkIdType numValues);
149 
150 };
151 
152 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
Represents an XML element and those nested inside.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
vtkXMLDataElement ** CellDataElements
vtkTypeInt64 * CellDataOffset
virtual void ReadXMLData()
int vtkIdType
Definition: vtkType.h:287
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:194
vtkCallbackCommand * DataProgressObserver
virtual int ReadPrimaryElement(vtkXMLDataElement *ePrimary)
Superclass for VTK XML file readers.
virtual void CopyOutputInformation(vtkInformation *vtkNotUsed(outInfo), int vtkNotUsed(port))
Definition: vtkXMLReader.h:123
virtual void CreateXMLParser()
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:43
virtual void SetupOutputData()