VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXMLUnstructuredDataReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00025 #ifndef __vtkXMLUnstructuredDataReader_h 00026 #define __vtkXMLUnstructuredDataReader_h 00027 00028 #include "vtkXMLDataReader.h" 00029 00030 class vtkCellArray; 00031 class vtkIdTypeArray; 00032 class vtkPointSet; 00033 class vtkUnsignedCharArray; 00034 00035 class VTK_IO_EXPORT vtkXMLUnstructuredDataReader : public vtkXMLDataReader 00036 { 00037 public: 00038 vtkTypeMacro(vtkXMLUnstructuredDataReader,vtkXMLDataReader); 00039 void PrintSelf(ostream& os, vtkIndent indent); 00040 00042 virtual vtkIdType GetNumberOfPoints(); 00043 00045 virtual vtkIdType GetNumberOfCells(); 00046 00051 void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel); 00052 00053 // For the specified port, copy the information this reader sets up in 00054 // SetupOutputInformation to outInfo 00055 virtual void CopyOutputInformation(vtkInformation *outInfo, int port); 00056 00057 00058 protected: 00059 vtkXMLUnstructuredDataReader(); 00060 ~vtkXMLUnstructuredDataReader(); 00061 00062 vtkPointSet* GetOutputAsPointSet(); 00063 vtkXMLDataElement* FindDataArrayWithName(vtkXMLDataElement* eParent, 00064 const char* name); 00065 vtkIdTypeArray* ConvertToIdTypeArray(vtkDataArray* a); 00066 vtkUnsignedCharArray* ConvertToUnsignedCharArray(vtkDataArray* a); 00067 00068 // Pipeline execute data driver. Called by vtkXMLReader. 00069 void ReadXMLData(); 00070 00071 virtual void SetupEmptyOutput(); 00072 virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces, 00073 int& ghostLevel)=0; 00074 virtual void SetupOutputTotals(); 00075 virtual void SetupNextPiece(); 00076 void SetupPieces(int numPieces); 00077 void DestroyPieces(); 00078 00079 // Setup the output's information. 00080 void SetupOutputInformation(vtkInformation *outInfo); 00081 00082 void SetupOutputData(); 00083 int ReadPiece(vtkXMLDataElement* ePiece); 00084 int ReadPieceData(); 00085 int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells, 00086 vtkXMLDataElement* eCells, vtkCellArray* outCells); 00087 00088 // Read a data array whose tuples coorrespond to points. 00089 virtual int ReadArrayForPoints(vtkXMLDataElement* da, vtkAbstractArray* outArray); 00090 00091 // Get the number of points/cells in the given piece. Valid after 00092 // UpdateInformation. 00093 virtual vtkIdType GetNumberOfPointsInPiece(int piece); 00094 virtual vtkIdType GetNumberOfCellsInPiece(int piece)=0; 00095 00096 // The update request. 00097 int UpdatePiece; 00098 int UpdateNumberOfPieces; 00099 int UpdateGhostLevel; 00100 00101 // The range of pieces from the file that will form the UpdatePiece. 00102 int StartPiece; 00103 int EndPiece; 00104 vtkIdType TotalNumberOfPoints; 00105 vtkIdType TotalNumberOfCells; 00106 vtkIdType StartPoint; 00107 00108 // The Points element for each piece. 00109 vtkXMLDataElement** PointElements; 00110 vtkIdType* NumberOfPoints; 00111 00112 int PointsTimeStep; 00113 unsigned long PointsOffset; 00114 int PointsNeedToReadTimeStep(vtkXMLDataElement *eNested); 00115 int CellsNeedToReadTimeStep(vtkXMLDataElement *eNested, int &cellstimestep, 00116 unsigned long &cellsoffset); 00117 00118 00119 private: 00120 vtkXMLUnstructuredDataReader(const vtkXMLUnstructuredDataReader&); // Not implemented. 00121 void operator=(const vtkXMLUnstructuredDataReader&); // Not implemented. 00122 }; 00123 00124 #endif