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