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 
48 
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 
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.
84  vtkAbstractArray* outArray);
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.
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;
131 
132  //CellData
134  vtkTypeInt64 *CellDataOffset;
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
vtkXMLDataReader::POINT_DATA
@ POINT_DATA
Definition: vtkXMLDataReader.h:37
VTKIOXML_EXPORT
#define VTKIOXML_EXPORT
Definition: vtkIOXMLModule.h:15
vtkXMLDataReader::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkXMLDataReader::GetNumberOfPoints
virtual vtkIdType GetNumberOfPoints()=0
vtkXMLDataReader::PointDataOffset
vtkTypeInt64 * PointDataOffset
Definition: vtkXMLDataReader.h:129
vtkXMLDataReader::ReadXMLData
virtual void ReadXMLData()
vtkXMLReader.h
vtkXMLDataReader::DestroyXMLParser
virtual void DestroyXMLParser()
vtkXMLDataReader::PointDataNeedToReadTimeStep
int PointDataNeedToReadTimeStep(vtkXMLDataElement *eNested)
vtkXMLDataReader::DataProgressObserver
vtkCallbackCommand * DataProgressObserver
Definition: vtkXMLDataReader.h:124
vtkXMLDataReader::ReadArrayValues
int ReadArrayValues(vtkXMLDataElement *da, vtkIdType arrayIndex, vtkAbstractArray *array, vtkIdType startIndex, vtkIdType numValues, FieldType type=OTHER)
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkXMLDataReader::DataProgressCallback
virtual void DataProgressCallback()
vtkXMLDataReader::CELL_DATA
@ CELL_DATA
Definition: vtkXMLDataReader.h:38
vtkXMLDataReader::Piece
int Piece
Definition: vtkXMLDataReader.h:112
vtkXMLDataReader::CopyOutputInformation
virtual void CopyOutputInformation(vtkInformation *outInfo, int port)
vtkXMLDataReader::ReadPiece
int ReadPiece(vtkXMLDataElement *ePiece, int piece)
vtkXMLDataReader::ReadPieceData
int ReadPieceData(int piece)
vtkXMLDataReader::NumberOfPointArrays
int NumberOfPointArrays
Definition: vtkXMLDataReader.h:116
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkXMLDataReader::~vtkXMLDataReader
~vtkXMLDataReader()
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkXMLDataReader::FieldType
FieldType
Definition: vtkXMLDataReader.h:36
vtkXMLDataReader
Superclass for VTK XML file readers.
Definition: vtkXMLDataReader.h:33
vtkIOXMLModule.h
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkXMLDataReader::ReadArrayForCells
virtual int ReadArrayForCells(vtkXMLDataElement *da, vtkAbstractArray *outArray)
vtkXMLDataReader::ReadPieceData
virtual int ReadPieceData()
vtkXMLDataReader::SetupOutputData
void SetupOutputData()
vtkXMLDataReader::NumberOfPieces
int NumberOfPieces
Definition: vtkXMLDataReader.h:105
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkXMLDataReader::SetupOutputInformation
virtual void SetupOutputInformation(vtkInformation *outInfo)
vtkXMLDataReader::CellDataOffset
vtkTypeInt64 * CellDataOffset
Definition: vtkXMLDataReader.h:134
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:36
vtkXMLDataReader::ReadPrimaryElement
int ReadPrimaryElement(vtkXMLDataElement *ePrimary)
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:65
vtkXMLDataReader::ReadPiece
virtual int ReadPiece(vtkXMLDataElement *ePiece)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkXMLDataReader::CellDataElements
vtkXMLDataElement ** CellDataElements
Definition: vtkXMLDataReader.h:109
vtkXMLDataReader::CreateXMLParser
virtual void CreateXMLParser()
vtkXMLDataReader::vtkXMLDataReader
vtkXMLDataReader()
vtkXMLDataReader::PointDataTimeStep
int * PointDataTimeStep
Definition: vtkXMLDataReader.h:128
vtkXMLDataReader::DataProgressCallbackFunction
static void DataProgressCallbackFunction(vtkObject *, unsigned long, void *, void *)
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:50
vtkXMLDataReader::CellDataTimeStep
int * CellDataTimeStep
Definition: vtkXMLDataReader.h:133
vtkXMLDataReader::DestroyPieces
virtual void DestroyPieces()
vtkXMLDataReader::CellDataNeedToReadTimeStep
int CellDataNeedToReadTimeStep(vtkXMLDataElement *eNested)
vtkXMLDataReader::NumberOfCellArrays
int NumberOfCellArrays
Definition: vtkXMLDataReader.h:117
vtkXMLDataReader::PointDataElements
vtkXMLDataElement ** PointDataElements
Definition: vtkXMLDataReader.h:108
vtkXMLDataReader::SetupPieces
virtual void SetupPieces(int numPieces)
vtkgl::type
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkXMLDataReader::ReadArrayForPoints
virtual int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray)
vtkXMLReader
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:42
vtkXMLDataReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkXMLDataReader::InReadData
int InReadData
Definition: vtkXMLDataReader.h:121