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 void SetOutput(vtkHyperOctree *output); 00050 vtkHyperOctree *GetOutput(); 00051 vtkHyperOctree *GetOutput(int idx); 00053 00054 protected: 00055 vtkXMLHyperOctreeReader(); 00056 ~vtkXMLHyperOctreeReader(); 00057 00058 const char* GetDataSetName(); 00059 00060 // Setup the output with no data available. Used in error cases. 00061 void SetupEmptyOutput(); 00062 00063 // Declare that this reader produces HyperOctrees 00064 virtual int FillOutputPortInformation(int, vtkInformation*); 00065 00066 //These defer to the HyperOctree output. 00067 vtkIdType GetNumberOfPoints(); 00068 vtkIdType GetNumberOfCells(); 00069 00070 // Overriden here to do allocation. 00071 virtual int ReadArrayForPoints(vtkXMLDataElement* da, 00072 vtkAbstractArray* outArray); 00073 virtual int ReadArrayForCells(vtkXMLDataElement* da, 00074 vtkAbstractArray* outArray); 00075 00076 00077 00078 // The most important stuff is here. 00079 // Read the rest of the file and create the HyperOctree. 00080 void ReadXMLData(); 00081 00082 // Recover the structure of the HyperOctree, used by ReadXMLData. 00083 void ReadTopology(vtkXMLDataElement *elem); 00084 00085 // Used by ReadTopology to recusively build the tree, one cell at a time. 00086 int BuildNextCell(vtkIntArray *, vtkHyperOctreeCursor *, int); 00087 00088 //Helper for BuildNextCell 00089 int ArrayIndex; 00090 00091 private: 00092 vtkXMLHyperOctreeReader(const vtkXMLHyperOctreeReader&); // Not implemented. 00093 void operator=(const vtkXMLHyperOctreeReader&); // Not implemented. 00094 }; 00095 00096 #endif