00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkXMLPDataReader.h,v $ 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 =========================================================================*/ 00036 #ifndef __vtkXMLPDataReader_h 00037 #define __vtkXMLPDataReader_h 00038 00039 #include "vtkXMLReader.h" 00040 00041 class vtkDataArray; 00042 class vtkDataSet; 00043 class vtkXMLDataReader; 00044 00045 class VTK_IO_EXPORT vtkXMLPDataReader : public vtkXMLReader 00046 { 00047 public: 00048 vtkTypeRevisionMacro(vtkXMLPDataReader,vtkXMLReader); 00049 void PrintSelf(ostream& os, vtkIndent indent); 00050 00052 00053 vtkGetMacro(NumberOfPieces, int); 00055 00056 protected: 00057 vtkXMLPDataReader(); 00058 ~vtkXMLPDataReader(); 00059 00060 // Pipeline execute information driver. Called by vtkXMLReader. 00061 void ReadXMLInformation(); 00062 int ReadPrimaryElement(vtkXMLDataElement* ePrimary); 00063 00064 vtkDataSet* GetPieceInputAsDataSet(int piece); 00065 void SetupOutputInformation(); 00066 void SetupOutputData(); 00067 00068 virtual vtkXMLDataReader* CreatePieceReader()=0; 00069 virtual vtkIdType GetNumberOfPoints()=0; 00070 virtual vtkIdType GetNumberOfCells()=0; 00071 virtual void CopyArrayForPoints(vtkDataArray* inArray, 00072 vtkDataArray* outArray)=0; 00073 virtual void CopyArrayForCells(vtkDataArray* inArray, 00074 vtkDataArray* outArray)=0; 00075 00076 virtual void SetupPieces(int numPieces); 00077 virtual void DestroyPieces(); 00078 int ReadPiece(vtkXMLDataElement* ePiece, int index); 00079 virtual int ReadPiece(vtkXMLDataElement* ePiece); 00080 int ReadPieceData(int index); 00081 virtual int ReadPieceData(); 00082 int CanReadPiece(int index); 00083 00084 char* CreatePieceFileName(const char* fileName); 00085 void SplitFileName(); 00086 00087 // Callback registered with the PieceProgressObserver. 00088 static void PieceProgressCallbackFunction(vtkObject*, unsigned long, void*, 00089 void*); 00090 virtual void PieceProgressCallback(); 00091 00092 // Pieces from the input summary file. 00093 int NumberOfPieces; 00094 00095 // The ghost level available on each input piece. 00096 int GhostLevel; 00097 00098 // The piece currently being read. 00099 int Piece; 00100 00101 // The path to the input file without the file name. 00102 char* PathName; 00103 00104 // Information per-piece. 00105 vtkXMLDataElement** PieceElements; 00106 vtkXMLDataReader** PieceReaders; 00107 int* CanReadPieceFlag; 00108 00109 // The PPointData and PCellData element representations. 00110 vtkXMLDataElement* PPointDataElement; 00111 vtkXMLDataElement* PCellDataElement; 00112 00113 // The observer to report progress from reading serial data in each 00114 // piece. 00115 vtkCallbackCommand* PieceProgressObserver; 00116 00117 private: 00118 vtkXMLPDataReader(const vtkXMLPDataReader&); // Not implemented. 00119 void operator=(const vtkXMLPDataReader&); // Not implemented. 00120 }; 00121 00122 #endif