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