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:
35  enum FieldType
36  {
39  OTHER
40  };
41 
42 
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
47  virtual vtkIdType GetNumberOfPoints()=0;
48 
50  virtual vtkIdType GetNumberOfCells()=0;
51 
52  // For the specified port, copy the information this reader sets up in
53  // SetupOutputInformation to outInfo
54  virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
55 
56 protected:
59 
60  // Add functionality to methods from superclass.
61  virtual void CreateXMLParser();
62  virtual void DestroyXMLParser();
63  virtual void SetupOutputInformation(vtkInformation *outInfo);
64 
66  void SetupOutputData();
67 
68  // Setup the reader for a given number of pieces.
69  virtual void SetupPieces(int numPieces);
70  virtual void DestroyPieces();
71 
72  // Read information from the file for the given piece.
73  int ReadPiece(vtkXMLDataElement* ePiece, int piece);
74  virtual int ReadPiece(vtkXMLDataElement* ePiece);
75 
76  // Read data from the file for the given piece.
77  int ReadPieceData(int piece);
78  virtual int ReadPieceData();
79 
80  virtual void ReadXMLData();
81 
82  // Read a data array whose tuples coorrespond to points or cells.
83  virtual int ReadArrayForPoints(vtkXMLDataElement* da,
84  vtkAbstractArray* outArray);
85  virtual int ReadArrayForCells(vtkXMLDataElement* da,
86  vtkAbstractArray* outArray);
87 
88  // Read an Array values starting at the given index and up to numValues.
89  // This method assumes that the array is of correct size to
90  // accommodate all numValues values. arrayIndex is the value index at which the read
91  // values will be put in the array.
92  int ReadArrayValues(
93  vtkXMLDataElement* da, vtkIdType arrayIndex, vtkAbstractArray* array,
94  vtkIdType startIndex, vtkIdType numValues, FieldType type = OTHER);
95 
96 
97 
98  // Callback registered with the DataProgressObserver.
99  static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
100  void*);
101  // Progress callback from XMLParser.
102  virtual void DataProgressCallback();
103 
104  // The number of Pieces of data found in the file.
106 
107  // The PointData and CellData element representations for each piece.
110 
111  // The piece currently being read.
112  int Piece;
113 
114  // The number of point/cell data arrays in the output. Valid after
115  // SetupOutputData has been called.
118 
119  // Flag for whether DataProgressCallback should actually update
120  // progress.
122 
123  // The observer to report progress from reading data from XMLParser.
125 
126  // Specify the last time step read, useful to know if we need to rearead data
127  // //PointData
129  vtkTypeInt64 *PointDataOffset;
130  int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
131 
132  //CellData
134  vtkTypeInt64 *CellDataOffset;
135  int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
136 
137 private:
138  vtkXMLDataReader(const vtkXMLDataReader&); // Not implemented.
139  void operator=(const vtkXMLDataReader&); // Not implemented.
140 
141  void ConvertGhostLevelsToGhostType(
143  vtkIdType numValues);
144 
145 };
146 
147 #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:275
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:154
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:105
virtual void CreateXMLParser()
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:41
virtual void SetupOutputData()