[vtkusers] vtkGeometryFilter for quadratic tetra grids

kenichiro yoshimi rccm.kyoshimi at gmail.com
Fri Aug 17 23:04:27 EDT 2018


Hi,

Could you provide some more information on what happens in applying
vtkGeometryFilter to quadratic tetra grids. At least, the following
simple code works without any problem using vtk 7.1.1.

---
import vtk

def main():

  points = vtk.vtkPoints()
  points.InsertNextPoint(0, 0, 0)
  points.InsertNextPoint(1, 0, 0)
  points.InsertNextPoint(1, 1, 0)
  points.InsertNextPoint(0.5, 0.5, 0.5)
  points.InsertNextPoint(0.5, 0, 0)
  points.InsertNextPoint(1, 0.5, 0)
  points.InsertNextPoint(0.5, 0.5, 0)
  points.InsertNextPoint(0.25, 0.25, 0.25)
  points.InsertNextPoint(0.75, 0.25, 0.25)
  points.InsertNextPoint(0.75, 0.75, 0.25)

  unstructuredGrid = vtk.vtkUnstructuredGrid()
  unstructuredGrid.SetPoints(points)

  quadraticTetra = vtk.vtkQuadraticTetra()

  for i in range(10):
    quadraticTetra.GetPointIds().SetId(i, i)

  cellArray = vtk.vtkCellArray()
  cellArray.InsertNextCell(quadraticTetra)

  unstructuredGrid.SetCells(vtk.VTK_QUADRATIC_TETRA, cellArray)

  print('quadraticTetra: ')
  print(' cell number: {}'.format(unstructuredGrid.GetNumberOfCells()))
  print(' point number: {}\n'.format(unstructuredGrid.GetNumberOfPoints()))

  geometryFilter = vtk.vtkGeometryFilter()
  geometryFilter.SetInputData(unstructuredGrid)
  geometryFilter.Update()

  print('extracted surface: ')
  print(' cell number:
{}'.format(geometryFilter.GetOutput().GetNumberOfCells()))
  print(' point number:
{}'.format(geometryFilter.GetOutput().GetNumberOfPoints()))

  mapper = vtk.vtkPolyDataMapper()
  mapper.SetInputConnection(geometryFilter.GetOutputPort())

  actor = vtk.vtkActor()
  actor.SetMapper(mapper)
  actor.GetProperty().EdgeVisibilityOn()

  renderer = vtk.vtkRenderer()
  renderer.AddActor(actor)

  renderer.ResetCamera()
  renderer.GetActiveCamera().Azimuth(210)
  renderer.GetActiveCamera().Elevation(30)

  renderWindow = vtk.vtkRenderWindow()
  renderWindow.SetSize(640, 480)
  renderWindow.AddRenderer(renderer)

  renderWindowInteractor = vtk.vtkRenderWindowInteractor()
  renderWindowInteractor.SetRenderWindow(renderWindow)

  renderWindowInteractor.Start()


if __name__ == '__main__':
    main()
---

Regards,
2018年8月18日(土) 4:17 Nguyen, Giang Hoang <ghnguyen at wpi.edu>:
>
> Hi,
>
>
> I would like to confirm here if vtkGeometryFilter doesn't work for unstructured grids that are quadratic tetra (10 nodes per cell). I was using it to convert an unstructured grid to polydata, using vtkpython in conda environment. The exact code works fine for unstructured grids with triangle cells. I looked at the cxx source for vtkGeometryFilter at https://github.com/Kitware/VTK/blob/master/Filters/Geometry/vtkGeometryFilter.cxx and it seems like the quadratic cells are not supported? In that case, what other approaches should I look into? Thanks in advance.
>
>
> Best,
>
> Giang
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list