Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkRectilinearGridToTetrahedra.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRectilinearGridToTetrahedra.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 =========================================================================*/
00058 #ifndef __vtkRectilinearGridToTetrahedra_h
00059 #define __vtkRectilinearGridToTetrahedra_h
00060 
00061 // ways to create the mesh from voxels
00062 #define VTK_VOXEL_TO_12_TET      12
00063 #define VTK_VOXEL_TO_5_TET        5
00064 #define VTK_VOXEL_TO_6_TET        6
00065 #define VTK_VOXEL_TO_5_AND_12_TET -1
00066 
00067 #include "vtkUnstructuredGridSource.h"
00068 class vtkRectilinearGrid;
00069 class vtkCharArray;
00070 class vtkIdList;
00071 class vtkCellArray;
00072 class vtkPoints;
00073 
00074 class VTK_GRAPHICS_EXPORT vtkRectilinearGridToTetrahedra : public vtkUnstructuredGridSource
00075 {
00076 public:
00077   vtkTypeRevisionMacro(vtkRectilinearGridToTetrahedra,vtkUnstructuredGridSource);
00078   void PrintSelf(ostream& os, vtkIndent indent);
00079 
00081   static vtkRectilinearGridToTetrahedra *New();
00082 
00084 
00086   void SetTetraPerCellTo5()      {SetTetraPerCell(VTK_VOXEL_TO_5_TET);};
00087   void SetTetraPerCellTo6()      {SetTetraPerCell(VTK_VOXEL_TO_6_TET);};
00088   void SetTetraPerCellTo12()     {SetTetraPerCell(VTK_VOXEL_TO_12_TET);};
00089   void SetTetraPerCellTo5And12() {SetTetraPerCell(VTK_VOXEL_TO_5_AND_12_TET);};
00090   vtkSetMacro(TetraPerCell,int);
00091   vtkGetMacro(TetraPerCell,int);
00093 
00095 
00097   vtkSetMacro(RememberVoxelId,int);
00098   vtkGetMacro(RememberVoxelId,int);
00099   vtkBooleanMacro(RememberVoxelId,int);
00101 
00103 
00108   void SetInput(const double Extent[3], const double Spacing[3],
00109                 const double tol=0.001);
00110   // Description:
00111   // This version of the function for the wrappers
00112   void SetInput(const double ExtentX, 
00113                 const double ExtentY,
00114                 const double ExtentZ, 
00115                 const double SpacingX,
00116                 const double SpacingY,
00117                 const double SpacingZ,
00118                 const double tol=0.001);
00120 
00122 
00125   void SetInput(vtkRectilinearGrid *input);
00126   vtkRectilinearGrid *GetInput();
00128 
00129 protected:
00130   vtkRectilinearGridToTetrahedra();
00131   ~vtkRectilinearGridToTetrahedra() {};
00132 
00133   void Execute();
00134 
00135   int RememberVoxelId;
00136   int TetraPerCell;
00137 
00138   virtual int FillInputPortInformation(int, vtkInformation*);
00139 
00140  private:
00141   vtkRectilinearGridToTetrahedra(const vtkRectilinearGridToTetrahedra&); // Not implemented.
00142 
00143   void operator=(const vtkRectilinearGridToTetrahedra&); // Not implemented.
00144 
00145 //BTX
00147 
00150   static void DetermineGridDivisionTypes(vtkRectilinearGrid *RectGrid, 
00151                                          vtkCharArray *VoxelSubdivisionType,
00152                                          const int &TetraPerCell);
00154 
00156 
00157   static void GridToTetMesh(vtkRectilinearGrid *RectGrid, 
00158                             vtkCharArray *VoxelSubdivisionType,
00159                             const int &TetraPerCell,
00160                             const int &RememberVoxelId,
00161                             vtkUnstructuredGrid *TetMesh);
00163 
00165 
00169   static int TetrahedralizeVoxel(vtkIdList *VoxelCorners,
00170                                  const int &DivisionType,
00171                                  vtkPoints *NodeList,
00172                                  vtkCellArray *TetList);
00174 
00176 
00178   static inline void TetrahedralizeAddCenterPoint(vtkIdList *VoxelCorners,
00179                                                   vtkPoints *NodeList);
00181 //ETX
00182 };
00183 
00184 #endif /* __vtkRectilinearGridToTetrahedra_h */
00185