VTK
dox/IO/vtkXMLHyperOctreeReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXMLHyperOctreeReader.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 =========================================================================*/
00034 #ifndef __vtkXMLHyperOctreeReader_h
00035 #define __vtkXMLHyperOctreeReader_h
00036 
00037 #include "vtkXMLDataReader.h"
00038 
00039 class vtkHyperOctree;
00040 class vtkHyperOctreeCursor;
00041 class vtkIntArray;
00042 
00043 class VTK_IO_EXPORT vtkXMLHyperOctreeReader : public vtkXMLDataReader
00044 {
00045 public:
00046   vtkTypeMacro(vtkXMLHyperOctreeReader,vtkXMLDataReader);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048   static vtkXMLHyperOctreeReader *New();
00049   
00051 
00052   vtkHyperOctree *GetOutput();
00053   vtkHyperOctree *GetOutput(int idx);
00055   
00056 protected:
00057   vtkXMLHyperOctreeReader();
00058   ~vtkXMLHyperOctreeReader();  
00059 
00060   const char* GetDataSetName();
00061 
00062   // Setup the output with no data available.  Used in error cases.
00063   void SetupEmptyOutput();
00064 
00065   // Declare that this reader produces HyperOctrees
00066   virtual int FillOutputPortInformation(int, vtkInformation*);
00067 
00068   //These defer to the HyperOctree output.
00069   vtkIdType GetNumberOfPoints();
00070   vtkIdType GetNumberOfCells();
00071 
00072   // Overriden here to do allocation.
00073   virtual int ReadArrayForPoints(vtkXMLDataElement* da,
00074                                  vtkAbstractArray* outArray);
00075   virtual int ReadArrayForCells(vtkXMLDataElement* da,
00076                                 vtkAbstractArray* outArray);
00077 
00078   
00079 
00080   // The most important stuff is here.
00081   // Read the rest of the file and create the HyperOctree.
00082   void ReadXMLData();
00083 
00084   // Recover the structure of the HyperOctree, used by ReadXMLData.
00085   void ReadTopology(vtkXMLDataElement *elem);
00086 
00087   // Used by ReadTopology to recusively build the tree, one cell at a time.
00088   int BuildNextCell(vtkIntArray *, vtkHyperOctreeCursor *, int);
00089 
00090   //Helper for BuildNextCell
00091   int ArrayIndex;
00092 
00093 private:
00094   vtkXMLHyperOctreeReader(const vtkXMLHyperOctreeReader&);  // Not implemented.
00095   void operator=(const vtkXMLHyperOctreeReader&);  // Not implemented.
00096 };
00097 
00098 #endif