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 =========================================================================*/
26 #ifndef vtkXMLDataReader_h
27 #define vtkXMLDataReader_h
28 
29 #include "vtkIOXMLModule.h" // For export macro
30 #include "vtkXMLReader.h"
31 
33 {
34 public:
36  void PrintSelf(ostream& os, vtkIndent indent);
37 
39  virtual vtkIdType GetNumberOfPoints()=0;
40 
42  virtual vtkIdType GetNumberOfCells()=0;
43 
44  // For the specified port, copy the information this reader sets up in
45  // SetupOutputInformation to outInfo
46  virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
47 
48 protected:
51 
52  // Add functionality to methods from superclass.
53  virtual void CreateXMLParser();
54  virtual void DestroyXMLParser();
55  virtual void SetupOutputInformation(vtkInformation *outInfo);
56 
58  void SetupOutputData();
59 
60  // Setup the reader for a given number of pieces.
61  virtual void SetupPieces(int numPieces);
62  virtual void DestroyPieces();
63 
64  // Read information from the file for the given piece.
65  int ReadPiece(vtkXMLDataElement* ePiece, int piece);
66  virtual int ReadPiece(vtkXMLDataElement* ePiece);
67 
68  // Read data from the file for the given piece.
69  int ReadPieceData(int piece);
70  virtual int ReadPieceData();
71 
72  virtual void ReadXMLData();
73 
74  // Read a data array whose tuples coorrespond to points or cells.
75  virtual int ReadArrayForPoints(vtkXMLDataElement* da,
76  vtkAbstractArray* outArray);
77  virtual int ReadArrayForCells(vtkXMLDataElement* da,
78  vtkAbstractArray* outArray);
79 
80  // Read an Array values starting at the given index and up to numValues.
81  // This method assumes that the array is of correct size to
82  // accommodate all numValues values. arrayIndex is the value index at which the read
83  // values will be put in the array.
84  int ReadArrayValues(vtkXMLDataElement* da, vtkIdType arrayIndex, vtkAbstractArray* array,
85  vtkIdType startIndex, vtkIdType numValues);
86 
87 
88 
89  // Callback registered with the DataProgressObserver.
90  static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
91  void*);
92  // Progress callback from XMLParser.
93  virtual void DataProgressCallback();
94 
95  // The number of Pieces of data found in the file.
97 
98  // The PointData and CellData element representations for each piece.
101 
102  // The piece currently being read.
103  int Piece;
104 
105  // The number of point/cell data arrays in the output. Valid after
106  // SetupOutputData has been called.
109 
110  // Flag for whether DataProgressCallback should actually update
111  // progress.
113 
114  // The observer to report progress from reading data from XMLParser.
116 
117  // Specify the last time step read, useful to know if we need to rearead data
118  // //PointData
120  vtkTypeInt64 *PointDataOffset;
121  int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
122 
123  //CellData
125  vtkTypeInt64 *CellDataOffset;
126  int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
127 
128 private:
129  vtkXMLDataReader(const vtkXMLDataReader&); // Not implemented.
130  void operator=(const vtkXMLDataReader&); // Not implemented.
131 };
132 
133 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
Represents an XML element and those nested inside.
void PrintSelf(ostream &os, vtkIndent indent)
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
vtkXMLDataElement ** CellDataElements
vtkTypeInt64 * CellDataOffset
virtual void ReadXMLData()
int vtkIdType
Definition: vtkType.h:281
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
virtual void DestroyXMLParser()
vtkTypeInt64 * PointDataOffset
supports function callbacks
vtkXMLDataElement ** PointDataElements
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKIOXML_EXPORT
virtual void SetupOutputInformation(vtkInformation *vtkNotUsed(outInfo))
Definition: vtkXMLReader.h:150
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:101
virtual void CreateXMLParser()
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:41
virtual void SetupOutputData()