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