00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00048 #ifndef __vtkRectilinearGridToTetrahedra_h
00049 #define __vtkRectilinearGridToTetrahedra_h
00050 
00051 
00052 #define VTK_VOXEL_TO_12_TET      12
00053 #define VTK_VOXEL_TO_5_TET        5
00054 #define VTK_VOXEL_TO_6_TET        6
00055 #define VTK_VOXEL_TO_5_AND_12_TET -1
00056 
00057 #include "vtkUnstructuredGridAlgorithm.h"
00058 class vtkRectilinearGrid;
00059 class vtkSignedCharArray;
00060 class vtkIdList;
00061 class vtkCellArray;
00062 class vtkPoints;
00063 
00064 class VTK_GRAPHICS_EXPORT vtkRectilinearGridToTetrahedra : public vtkUnstructuredGridAlgorithm
00065 {
00066 public:
00067   vtkTypeMacro(vtkRectilinearGridToTetrahedra,vtkUnstructuredGridAlgorithm);
00068   void PrintSelf(ostream& os, vtkIndent indent);
00069 
00071   static vtkRectilinearGridToTetrahedra *New();
00072 
00074 
00076   void SetTetraPerCellTo5()      {SetTetraPerCell(VTK_VOXEL_TO_5_TET);};
00077   void SetTetraPerCellTo6()      {SetTetraPerCell(VTK_VOXEL_TO_6_TET);};
00078   void SetTetraPerCellTo12()     {SetTetraPerCell(VTK_VOXEL_TO_12_TET);};
00079   void SetTetraPerCellTo5And12() {SetTetraPerCell(VTK_VOXEL_TO_5_AND_12_TET);};
00080   vtkSetMacro(TetraPerCell,int);
00081   vtkGetMacro(TetraPerCell,int);
00083 
00085 
00087   vtkSetMacro(RememberVoxelId,int);
00088   vtkGetMacro(RememberVoxelId,int);
00089   vtkBooleanMacro(RememberVoxelId,int);
00091 
00093 
00098   void SetInput(const double Extent[3], const double Spacing[3],
00099                 const double tol=0.001);
00100   
00101   
00102   void SetInput(const double ExtentX, 
00103                 const double ExtentY,
00104                 const double ExtentZ, 
00105                 const double SpacingX,
00106                 const double SpacingY,
00107                 const double SpacingZ,
00108                 const double tol=0.001);
00110 
00111 protected:
00112   vtkRectilinearGridToTetrahedra();
00113   ~vtkRectilinearGridToTetrahedra() {};
00114 
00115   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00116 
00117   int RememberVoxelId;
00118   int TetraPerCell;
00119 
00120   virtual int FillInputPortInformation(int, vtkInformation*);
00121 
00122  private:
00123   vtkRectilinearGridToTetrahedra(const vtkRectilinearGridToTetrahedra&); 
00124 
00125   void operator=(const vtkRectilinearGridToTetrahedra&); 
00126 
00127 
00129 
00132   static void DetermineGridDivisionTypes(vtkRectilinearGrid *RectGrid, 
00133                                          vtkSignedCharArray *VoxelSubdivisionType,
00134                                          const int &TetraPerCell);
00136 
00138 
00139   static void GridToTetMesh(vtkRectilinearGrid *RectGrid, 
00140                             vtkSignedCharArray *VoxelSubdivisionType,
00141                             const int &TetraPerCell,
00142                             const int &RememberVoxelId,
00143                             vtkUnstructuredGrid *TetMesh);
00145 
00147 
00151   static int TetrahedralizeVoxel(vtkIdList *VoxelCorners,
00152                                  const int &DivisionType,
00153                                  vtkPoints *NodeList,
00154                                  vtkCellArray *TetList);
00156 
00158 
00160   static inline void TetrahedralizeAddCenterPoint(vtkIdList *VoxelCorners,
00161                                                   vtkPoints *NodeList);
00162 
00163 };
00165 
00166 #endif 
00167