Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

IO/vtkXMLUnstructuredDataReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkXMLUnstructuredDataReader.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 =========================================================================*/
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   vtkTypeRevisionMacro(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 protected:
00054   vtkXMLUnstructuredDataReader();
00055   ~vtkXMLUnstructuredDataReader();
00056   
00057   vtkPointSet* GetOutputAsPointSet();
00058   vtkXMLDataElement* FindDataArrayWithName(vtkXMLDataElement* eParent,
00059                                            const char* name);
00060   vtkIdTypeArray* ConvertToIdTypeArray(vtkDataArray* a);
00061   vtkUnsignedCharArray* ConvertToUnsignedCharArray(vtkDataArray* a);
00062   
00063   // Pipeline execute data driver.  Called by vtkXMLReader.
00064   void ReadXMLData();
00065   
00066   virtual void SetupEmptyOutput();
00067   virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces,
00068                                      int& ghostLevel)=0;
00069   virtual void SetupOutputTotals();
00070   virtual void SetupNextPiece();
00071   void SetupPieces(int numPieces);
00072   void DestroyPieces();
00073   
00074   void SetupOutputInformation();
00075   void SetupOutputData();
00076   int ReadPiece(vtkXMLDataElement* ePiece);
00077   int ReadPieceData();
00078   int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells,
00079                     vtkXMLDataElement* eCells, vtkCellArray* outCells);
00080   
00081   // Read a data array whose tuples coorrespond to points.
00082   int ReadArrayForPoints(vtkXMLDataElement* da, vtkDataArray* outArray);
00083   
00084   // Get the number of points/cells in the given piece.  Valid after
00085   // UpdateInformation.
00086   virtual vtkIdType GetNumberOfPointsInPiece(int piece);
00087   virtual vtkIdType GetNumberOfCellsInPiece(int piece)=0;
00088   
00089   // The update request.
00090   int UpdatePiece;
00091   int UpdateNumberOfPieces;
00092   int UpdateGhostLevel;
00093   
00094   // The range of pieces from the file that will form the UpdatePiece.
00095   int StartPiece;
00096   int EndPiece;
00097   vtkIdType TotalNumberOfPoints;
00098   vtkIdType TotalNumberOfCells;
00099   vtkIdType StartPoint;
00100   
00101   // The Points element for each piece.
00102   vtkXMLDataElement** PointElements;
00103   vtkIdType* NumberOfPoints;
00104   
00105 private:
00106   vtkXMLUnstructuredDataReader(const vtkXMLUnstructuredDataReader&);  // Not implemented.
00107   void operator=(const vtkXMLUnstructuredDataReader&);  // Not implemented.
00108 };
00109 
00110 #endif