def Execute(self): if self.Mesh == None: self.PrintError('Error: No input mesh.') if self.GenerateCaps == 1: if not ((self.Mesh.IsHomogeneous() == 1) & (self.Mesh.GetCellType(0) == 5)): self.PrintError( 'Error: In order to generate caps, all input mesh elements must be triangles.' ) meshToSurfaceFilter = vtk.vtkGeometryFilter() meshToSurfaceFilter.SetInput(self.Mesh) meshToSurfaceFilter.Update() cap = vtkvmtk.vtkvmtkSimpleCapPolyData() cap.SetInput(meshToSurfaceFilter.GetOutput()) cap.SetCellMarkerArrayName(self.FacetMarkerArrayName) cap.Update() surfacetomesh = vtkvmtk.vtkvmtkPolyDataToUnstructuredGridFilter() surfacetomesh.SetInput(cap.GetOutput()) surfacetomesh.Update() self.Mesh = surfacetomesh.GetOutput() tetgen = vtkvmtk.vtkvmtkTetGenWrapper() tetgen.SetInput(self.Mesh) tetgen.SetPLC(self.PLC) tetgen.SetRefine(self.Refine) tetgen.SetCoarsen(self.Coarsen) tetgen.SetNoBoundarySplit(self.NoBoundarySplit) tetgen.SetQuality(self.Quality) tetgen.SetMinRatio(self.MinRatio) tetgen.SetMinDihedral(self.MinDihedral) tetgen.SetMaxDihedral(self.MaxDihedral) tetgen.SetVarVolume(self.VarVolume) tetgen.SetFixedVolume(self.FixedVolume) tetgen.SetMaxVolume(self.MaxVolume) tetgen.SetRemoveSliver(self.RemoveSliver) tetgen.SetRegionAttrib(self.RegionAttrib) tetgen.SetEpsilon(self.Epsilon) tetgen.SetNoMerge(self.NoMerge) tetgen.SetDetectInter(self.DetectInter) tetgen.SetCheckClosure(self.CheckClosure) tetgen.SetOrder(self.Order) tetgen.SetDoCheck(self.DoCheck) tetgen.SetVerbose(self.Verbose) tetgen.SetUseSizingFunction(self.UseSizingFunction) tetgen.SetCellEntityIdsArrayName(self.CellEntityIdsArrayName) tetgen.SetTetrahedronVolumeArrayName(self.TetrahedronVolumeArrayName) tetgen.SetSizingFunctionArrayName(self.SizingFunctionArrayName) tetgen.SetOutputSurfaceElements(self.OutputSurfaceElements) tetgen.SetOutputVolumeElements(self.OutputVolumeElements) tetgen.Update() self.Mesh = tetgen.GetOutput() if self.Mesh.GetSource(): self.Mesh.GetSource().UnRegisterAllOutputs()
def Execute(self): if self.Mesh == None: self.PrintError('Error: No input mesh.') if self.GenerateCaps == 1: if not ((self.Mesh.IsHomogeneous() == 1) & (self.Mesh.GetCellType(0) == 5)): self.PrintError('Error: In order to generate caps, all input mesh elements must be triangles.') meshToSurfaceFilter = vtk.vtkGeometryFilter() meshToSurfaceFilter.SetInputData(self.Mesh) meshToSurfaceFilter.Update() cap = vtkvmtk.vtkvmtkSimpleCapPolyData() cap.SetInputConnection(meshToSurfaceFilter.GetOutputPort()) cap.SetCellMarkerArrayName(self.FacetMarkerArrayName) cap.Update() surfacetomesh = vtkvmtk.vtkvmtkPolyDataToUnstructuredGridFilter() surfacetomesh.SetInputConnection(cap.GetOutputPort()) surfacetomesh.Update() self.Mesh = surfacetomesh.GetOutput() tetgen = vtkvmtk.vtkvmtkTetGenWrapper() tetgen.SetInputData(self.Mesh) tetgen.SetPLC(self.PLC) tetgen.SetRefine(self.Refine) tetgen.SetCoarsen(self.Coarsen) tetgen.SetNoBoundarySplit(self.NoBoundarySplit) tetgen.SetQuality(self.Quality) tetgen.SetMinRatio(self.MinRatio) tetgen.SetMinDihedral(self.MinDihedral) tetgen.SetMaxDihedral(self.MaxDihedral) tetgen.SetVarVolume(self.VarVolume) tetgen.SetFixedVolume(self.FixedVolume) tetgen.SetMaxVolume(self.MaxVolume) tetgen.SetRemoveSliver(self.RemoveSliver) tetgen.SetRegionAttrib(self.RegionAttrib) tetgen.SetEpsilon(self.Epsilon) tetgen.SetNoMerge(self.NoMerge) tetgen.SetDetectInter(self.DetectInter) tetgen.SetCheckClosure(self.CheckClosure) tetgen.SetOrder(self.Order) tetgen.SetDoCheck(self.DoCheck) tetgen.SetVerbose(self.Verbose) tetgen.SetUseSizingFunction(self.UseSizingFunction) tetgen.SetCellEntityIdsArrayName(self.CellEntityIdsArrayName) tetgen.SetTetrahedronVolumeArrayName(self.TetrahedronVolumeArrayName) tetgen.SetSizingFunctionArrayName(self.SizingFunctionArrayName) tetgen.SetOutputSurfaceElements(self.OutputSurfaceElements) tetgen.SetOutputVolumeElements(self.OutputVolumeElements) tetgen.Update() self.Mesh = tetgen.GetOutput()
def Execute(self): if self.Surface == None: self.PrintError('Error: No input surface.') if self.CleanInput == 1: cleaner = vtk.vtkCleanPolyData() cleaner.SetInputData(self.Surface) cleaner.Update() self.Surface = cleaner.GetOutput() surfaceToMeshFilter = vtkvmtk.vtkvmtkPolyDataToUnstructuredGridFilter() surfaceToMeshFilter.SetInputData(self.Surface) surfaceToMeshFilter.Update() self.Mesh = surfaceToMeshFilter.GetOutput()