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

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 =========================================================================*/
00035 #ifndef __vtkXMLUnstructuredDataReader_h
00036 #define __vtkXMLUnstructuredDataReader_h
00037 
00038 #include "vtkXMLDataReader.h"
00039 
00040 class vtkCellArray;
00041 class vtkIdTypeArray;
00042 class vtkPointSet;
00043 class vtkUnsignedCharArray;
00044 
00045 class VTK_IO_EXPORT vtkXMLUnstructuredDataReader : public vtkXMLDataReader
00046 {
00047 public:
00048   vtkTypeRevisionMacro(vtkXMLUnstructuredDataReader,vtkXMLDataReader);
00049   void PrintSelf(ostream& os, vtkIndent indent);  
00050   
00052   virtual vtkIdType GetNumberOfPoints();
00053   
00055   virtual vtkIdType GetNumberOfCells();
00056   
00061   void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel);
00062   
00063 protected:
00064   vtkXMLUnstructuredDataReader();
00065   ~vtkXMLUnstructuredDataReader();
00066   
00067   vtkPointSet* GetOutputAsPointSet();
00068   vtkXMLDataElement* FindDataArrayWithName(vtkXMLDataElement* eParent,
00069                                            const char* name);
00070   vtkIdTypeArray* ConvertToIdTypeArray(vtkDataArray* a);
00071   vtkUnsignedCharArray* ConvertToUnsignedCharArray(vtkDataArray* a);
00072   
00073   // Pipeline execute data driver.  Called by vtkXMLReader.
00074   void ReadXMLData();
00075   
00076   virtual void SetupEmptyOutput();
00077   virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces,
00078                                      int& ghostLevel)=0;
00079   virtual void SetupOutputTotals();
00080   virtual void SetupNextPiece();
00081   void SetupPieces(int numPieces);
00082   void DestroyPieces();
00083   
00084   void SetupOutputInformation();
00085   void SetupOutputData();
00086   int ReadPiece(vtkXMLDataElement* ePiece);
00087   int ReadPieceData();
00088   int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells,
00089                     vtkXMLDataElement* eCells, vtkCellArray* outCells);
00090   
00091   // Read a data array whose tuples coorrespond to points.
00092   int ReadArrayForPoints(vtkXMLDataElement* da, vtkDataArray* outArray);
00093   
00094   // Get the number of points/cells in the given piece.  Valid after
00095   // UpdateInformation.
00096   virtual vtkIdType GetNumberOfPointsInPiece(int piece);
00097   virtual vtkIdType GetNumberOfCellsInPiece(int piece)=0;
00098   
00099   // The update request.
00100   int UpdatePiece;
00101   int UpdateNumberOfPieces;
00102   int UpdateGhostLevel;
00103   
00104   // The range of pieces from the file that will form the UpdatePiece.
00105   int StartPiece;
00106   int EndPiece;
00107   vtkIdType TotalNumberOfPoints;
00108   vtkIdType TotalNumberOfCells;
00109   vtkIdType StartPoint;
00110   
00111   // The Points element for each piece.
00112   vtkXMLDataElement** PointElements;
00113   vtkIdType* NumberOfPoints;
00114   
00115 private:
00116   vtkXMLUnstructuredDataReader(const vtkXMLUnstructuredDataReader&);  // Not implemented.
00117   void operator=(const vtkXMLUnstructuredDataReader&);  // Not implemented.
00118 };
00119 
00120 #endif