VTK
dox/Filters/HyperTree/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 "vtkFiltersHyperTreeModule.h" // For export macro
00043 #include "vtkPolyDataAlgorithm.h"
00044 
00045 #include "vtkContourValues.h" // Needed for inline methods
00046 #include "vtkCutter.h" // for VTK_SORT_BY_VALUE
00047 
00048 class vtkHyperOctree;
00049 class vtkTetra;
00050 class vtkHyperOctreeCursor;
00051 class vtkHyperOctreeLightWeightCursor;
00052 
00053 class vtkDataSetAttributes;
00054 class vtkUnstructuredGrid;
00055 class vtkUnsignedCharArray;
00056 class vtkIdTypeArray;
00057 class vtkBitArray;
00058 class vtkIncrementalPointLocator;
00059 
00060 class VTKFILTERSHYPERTREE_EXPORT vtkHyperOctreeDualGridContourFilter : public vtkPolyDataAlgorithm
00061 {
00062 public:
00063   vtkTypeMacro(vtkHyperOctreeDualGridContourFilter,vtkPolyDataAlgorithm);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00068   static vtkHyperOctreeDualGridContourFilter *New();
00069 
00075   void SetValue(int i, double value)
00076     {
00077       this->ContourValues->SetValue(i,value);
00078     }
00080 
00082 
00083   double GetValue(int i)
00084     {
00085       return this->ContourValues->GetValue(i);
00086     }
00088 
00090 
00092   double *GetValues()
00093     {
00094       return this->ContourValues->GetValues();
00095     }
00097 
00099 
00102   void GetValues(double *contourValues)
00103     {
00104       this->ContourValues->GetValues(contourValues);
00105     }
00107 
00109 
00112   void SetNumberOfContours(int number)
00113     {
00114       this->ContourValues->SetNumberOfContours(number);
00115     }
00117 
00119 
00120   int GetNumberOfContours()
00121     {
00122       return this->ContourValues->GetNumberOfContours();
00123     }
00125 
00127 
00129   void GenerateValues(int numContours, double range[2])
00130     {
00131       this->ContourValues->GenerateValues(numContours, range);
00132     }
00134 
00136 
00138   void GenerateValues(int numContours, double
00139                       rangeStart, double rangeEnd)
00140     {
00141       this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
00142     }
00144 
00146   unsigned long GetMTime();
00147 
00149 
00151   void SetLocator(vtkIncrementalPointLocator *locator);
00152   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00154 
00157   void CreateDefaultLocator();
00158 
00159 protected:
00160   vtkHyperOctreeDualGridContourFilter();
00161   ~vtkHyperOctreeDualGridContourFilter();
00162 
00163   virtual int RequestData(vtkInformation* request,
00164                           vtkInformationVector** inputVector,
00165                           vtkInformationVector* outputVector);
00166   virtual int RequestUpdateExtent(vtkInformation*,
00167                                   vtkInformationVector**,
00168                                   vtkInformationVector*);
00169   virtual int FillInputPortInformation(int port, vtkInformation *info);
00170 
00172   void ContourNode();
00173 
00174   void TraverseNeighborhoodRecursively(
00175                      vtkHyperOctreeLightWeightCursor* neighborhood,
00176                      unsigned short* xyzIds);
00177   void EvaluatePoint(vtkHyperOctreeLightWeightCursor* neighborhood,
00178                      unsigned short* xyzIds);
00179 
00180   void ContourNode1D();
00181 
00182   vtkContourValues *ContourValues;
00183   vtkIncrementalPointLocator *Locator;
00184 
00185   vtkHyperOctree *Input;
00186   vtkPolyData *Output;
00187 
00188   vtkCellArray *NewPolys;
00189 
00190   vtkDataSetAttributes *InPD;
00191   vtkDataSetAttributes *OutPD;
00192   vtkDataArray *InScalars;
00193   // To compute points on the fly.
00194   // These are set to the input origin and size.
00195   double Origin[3];
00196   double Size[3];
00197 
00198   // This is a table for traversing a neighborhood down an octree.
00199   // 8 children x 8 cursors
00200   // First three bits encode the child,  rest encode the cursor id.
00201   // 8xCursorId + childId.
00202   unsigned char NeighborhoodTraversalTable[64];
00203   void GenerateTraversalTable();
00204 
00205 private:
00206   vtkHyperOctreeDualGridContourFilter(const vtkHyperOctreeDualGridContourFilter&);  // Not implemented.
00207   void operator=(const vtkHyperOctreeDualGridContourFilter&);  // Not implemented.
00208 };
00209 #endif