VTK
dox/IO/vtkXMLStructuredDataReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXMLStructuredDataReader.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 =========================================================================*/
00026 #ifndef __vtkXMLStructuredDataReader_h
00027 #define __vtkXMLStructuredDataReader_h
00028 
00029 #include "vtkXMLDataReader.h"
00030 
00031 
00032 class VTK_IO_EXPORT vtkXMLStructuredDataReader : public vtkXMLDataReader
00033 {
00034 public:
00035   vtkTypeMacro(vtkXMLStructuredDataReader,vtkXMLDataReader);
00036   void PrintSelf(ostream& os, vtkIndent indent);  
00037   
00039   virtual vtkIdType GetNumberOfPoints();
00040   
00042   virtual vtkIdType GetNumberOfCells();
00043   
00045 
00049   vtkSetMacro(WholeSlices, int);
00050   vtkGetMacro(WholeSlices, int);
00051   vtkBooleanMacro(WholeSlices, int);
00053   
00055 
00057   virtual void CopyOutputInformation(vtkInformation *outInfo, int port);
00058 protected:
00059   vtkXMLStructuredDataReader();
00060   ~vtkXMLStructuredDataReader();
00062   
00063   virtual void SetOutputExtent(int* extent)=0;
00064   int ReadPrimaryElement(vtkXMLDataElement* ePrimary);
00065   
00066   // Pipeline execute data driver.  Called by vtkXMLReader.
00067   void ReadXMLData();
00068   
00069   // Internal representation of pieces in the file that may have come
00070   // from a streamed write.
00071   int* PieceExtents;
00072   int* PiecePointDimensions;
00073   vtkIdType* PiecePointIncrements;
00074   int* PieceCellDimensions;
00075   vtkIdType* PieceCellIncrements;
00076   
00077   // Whether to read in whole slices mode.
00078   int WholeSlices;
00079   
00080   // The update extent and corresponding increments and dimensions.
00081   int UpdateExtent[6];
00082   int PointDimensions[3];
00083   int CellDimensions[3];
00084   vtkIdType PointIncrements[3];
00085   vtkIdType CellIncrements[3];
00086 
00087   int WholeExtent[6];
00088   
00089   // The extent currently being read.
00090   int SubExtent[6];
00091   int SubPointDimensions[3];
00092   int SubCellDimensions[3];
00093   
00094   // Override methods from superclass.
00095   void SetupEmptyOutput();
00096   void SetupPieces(int numPieces);
00097   void DestroyPieces();
00098   virtual int ReadArrayForPoints(vtkXMLDataElement* da, 
00099     vtkAbstractArray* outArray);
00100   virtual int ReadArrayForCells(vtkXMLDataElement* da, 
00101     vtkAbstractArray* outArray);
00102   
00103   // Internal utility methods.
00104   int ReadPiece(vtkXMLDataElement* ePiece);
00105   virtual int ReadSubExtent(
00106       int* inExtent, int* inDimensions, vtkIdType* inIncrements,
00107       int* outExtent,int* outDimensions,vtkIdType* outIncrements,
00108       int* subExtent, int* subDimensions, vtkXMLDataElement* da,
00109       vtkAbstractArray* array);
00110   
00111 private:
00112   vtkXMLStructuredDataReader(const vtkXMLStructuredDataReader&);  // Not implemented.
00113   void operator=(const vtkXMLStructuredDataReader&);  // Not implemented.
00114 };
00115 
00116 #endif