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