VTK
dox/Graphics/vtkHyperOctreeDualGridContourFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkHyperOctreeDualGridContourFilter.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 =========================================================================*/
00039 #ifndef __vtkHyperOctreeDualGridContourFilter_h
00040 #define __vtkHyperOctreeDualGridContourFilter_h
00041 
00042 #include "vtkPolyDataAlgorithm.h"
00043 
00044 #include "vtkContourValues.h" // Needed for inline methods
00045 #include "vtkCutter.h" // for VTK_SORT_BY_VALUE
00046 
00047 class vtkHyperOctree;
00048 class vtkTetra;
00049 class vtkHyperOctreeCursor;
00050 class vtkHyperOctreeLightWeightCursor;
00051 
00052 class vtkDataSetAttributes;
00053 class vtkUnstructuredGrid;
00054 class vtkUnsignedCharArray;
00055 class vtkIdTypeArray;
00056 class vtkBitArray;
00057 class vtkIncrementalPointLocator;
00058 
00059 class VTK_GRAPHICS_EXPORT vtkHyperOctreeDualGridContourFilter : public vtkPolyDataAlgorithm
00060 {
00061 public:
00062   vtkTypeMacro(vtkHyperOctreeDualGridContourFilter,vtkPolyDataAlgorithm);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064 
00067   static vtkHyperOctreeDualGridContourFilter *New();
00068 
00074   void SetValue(int i, double value)
00075     {
00076       this->ContourValues->SetValue(i,value);
00077     }
00079 
00081 
00082   double GetValue(int i)
00083     {
00084       return this->ContourValues->GetValue(i);
00085     }
00087 
00089 
00091   double *GetValues()
00092     {
00093       return this->ContourValues->GetValues();
00094     }
00096 
00098 
00101   void GetValues(double *contourValues)
00102     {
00103       this->ContourValues->GetValues(contourValues);
00104     }
00106 
00108 
00111   void SetNumberOfContours(int number)
00112     {
00113       this->ContourValues->SetNumberOfContours(number);
00114     }
00116 
00118 
00119   int GetNumberOfContours()
00120     {
00121       return this->ContourValues->GetNumberOfContours();
00122     }
00124   
00126 
00128   void GenerateValues(int numContours, double range[2])
00129     {
00130       this->ContourValues->GenerateValues(numContours, range);
00131     }
00133   
00135 
00137   void GenerateValues(int numContours, double
00138                       rangeStart, double rangeEnd)
00139     {
00140       this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
00141     }
00143 
00145   unsigned long GetMTime();
00146 
00148 
00150   void SetLocator(vtkIncrementalPointLocator *locator);
00151   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00153 
00156   void CreateDefaultLocator();
00157 
00158 protected:
00159   vtkHyperOctreeDualGridContourFilter();
00160   ~vtkHyperOctreeDualGridContourFilter();
00161   
00162   virtual int RequestData(vtkInformation* request,
00163                           vtkInformationVector** inputVector,
00164                           vtkInformationVector* outputVector);
00165   virtual int RequestUpdateExtent(vtkInformation*,
00166                                   vtkInformationVector**,
00167                                   vtkInformationVector*);
00168   virtual int FillInputPortInformation(int port, vtkInformation *info);
00169 
00171   void ContourNode();
00172   
00173   void TraverseNeighborhoodRecursively(
00174                      vtkHyperOctreeLightWeightCursor* neighborhood,
00175                      unsigned short* xyzIds);
00176   void EvaluatePoint(vtkHyperOctreeLightWeightCursor* neighborhood,
00177                      unsigned short* xyzIds);
00178 
00179   void ContourNode1D();
00180   
00181   vtkContourValues *ContourValues;
00182   vtkIncrementalPointLocator *Locator;
00183   
00184   vtkHyperOctree *Input;
00185   vtkPolyData *Output;
00186 
00187   vtkCellArray *NewPolys;
00188   
00189   vtkDataSetAttributes *InPD;
00190   vtkDataSetAttributes *OutPD;
00191   vtkDataArray *InScalars;
00192   // To compute points on the fly.
00193   // These are set to the input origin and size.
00194   double Origin[3];
00195   double Size[3];
00196   
00197   // This is a table for traversing a neighborhood down an octree.
00198   // 8 children x 8 cursors
00199   // First three bits encode the child,  rest encode the cursor id.
00200   // 8xCursorId + childId.
00201   unsigned char NeighborhoodTraversalTable[64];
00202   void GenerateTraversalTable();
00203 
00204 private:
00205   vtkHyperOctreeDualGridContourFilter(const vtkHyperOctreeDualGridContourFilter&);  // Not implemented.
00206   void operator=(const vtkHyperOctreeDualGridContourFilter&);  // Not implemented.
00207 };
00208 #endif