VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  int SetUpdateExtentInfo(vtkXMLDataElement *eDSA,
53  vtkInformationVector *infoVector,
54  int piece, int numPieces);
55 
56  // Add functionality to methods from superclass.
57  virtual void CreateXMLParser();
58  virtual void DestroyXMLParser();
59  virtual void SetupOutputInformation(vtkInformation *outInfo);
60  virtual void SetupUpdateExtentInformation(vtkInformation *outInfo);
61 
63  void SetupOutputData();
64 
65  // Setup the reader for a given number of pieces.
66  virtual void SetupPieces(int numPieces);
67  virtual void DestroyPieces();
68 
69  // Read information from the file for the given piece.
70  int ReadPiece(vtkXMLDataElement* ePiece, int piece);
71  virtual int ReadPiece(vtkXMLDataElement* ePiece);
72 
73  // Read data from the file for the given piece.
74  int ReadPieceData(int piece);
75  virtual int ReadPieceData();
76 
77  virtual void ReadXMLData();
78 
79  // Read a data array whose tuples coorrespond to points or cells.
80  virtual int ReadArrayForPoints(vtkXMLDataElement* da,
81  vtkAbstractArray* outArray);
82  virtual int ReadArrayForCells(vtkXMLDataElement* da,
83  vtkAbstractArray* outArray);
84 
85  // Read an Array values starting at the given index and up to numValues.
86  // This method assumes that the array is of correct size to
87  // accommodate all numValues values. arrayIndex is the value index at which the read
88  // values will be put in the array.
89  int ReadArrayValues(vtkXMLDataElement* da, vtkIdType arrayIndex, vtkAbstractArray* array,
90  vtkIdType startIndex, vtkIdType numValues);
91 
92 
93 
94  // Callback registered with the DataProgressObserver.
95  static void DataProgressCallbackFunction(vtkObject*, unsigned long, void*,
96  void*);
97  // Progress callback from XMLParser.
98  virtual void DataProgressCallback();
99 
100  // The number of Pieces of data found in the file.
102 
103  // The PointData and CellData element representations for each piece.
106 
107  // The piece currently being read.
108  int Piece;
109 
110  // The number of point/cell data arrays in the output. Valid after
111  // SetupOutputData has been called.
114 
115  // Flag for whether DataProgressCallback should actually update
116  // progress.
118 
119  // The observer to report progress from reading data from XMLParser.
121 
122  // Specify the last time step read, useful to know if we need to rearead data
123  // //PointData
125  vtkTypeInt64 *PointDataOffset;
126  int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
127 
128  //CellData
130  vtkTypeInt64 *CellDataOffset;
131  int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested);
132 
133 private:
134  vtkXMLDataReader(const vtkXMLDataReader&); // Not implemented.
135  void operator=(const vtkXMLDataReader&); // Not implemented.
136 };
137 
138 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void SetupUpdateExtentInformation(vtkInformation *vtkNotUsed(outInfo))
Definition: vtkXMLReader.h:144
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:268
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
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:140
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:91
virtual void CreateXMLParser()
Store zero or more vtkInformation instances.
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:39
virtual void SetupOutputData()