[vtkusers] vtkGeometryFilter for quadratic tetra grids

Nguyen, Giang Hoang ghnguyen at wpi.edu
Mon Aug 20 09:56:54 EDT 2018


Hi,


Thanks for the quick reply Kenichiro. I could see that the GeometryFilter does support quadratic tetra grids now. Still I have the issue with my large mesh. I'm reading from a file and this is the snippet to read that file:

----
reader = vtkUnstructuredGridReader()
reader.SetFileName(file_name)
reader.Update()
print reader.GetOutput()
----

which prints out this to terminal:

vtkUnstructuredGrid (0000000006521F50)
  Debug: Off
  Modified Time: 184
  Reference Count: 2
  Registered Events: (none)
  Information: 00000000025B0F10
  Data Released: False
  Global Release Data: Off
  UpdateTime: 189
  Field Data:
    Debug: Off
    Modified Time: 161
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
  Number Of Points: 343399
  Number Of Cells: 250935


I suppose this means the reader was able to read the unstructured grid correctly and I have data integrity (which is also confirmed by Paraview, which was able to generate this UnstructuredGrid mesh). What I'm looking for is this snippet to work:

----

geoFilter = vtkGeometryFilter()
geoFilter.SetInputConnection(reader.GetOutputPort())
geoFilter.Update()
----

Unfortunately, the line geoFilter.Update() always makes vtkpython quit without any warning/error even with try catch surrounding. I'm not sure what the problem now is.

________________________________
From: kenichiro yoshimi <rccm.kyoshimi at gmail.com>
Sent: Friday, August 17, 2018 11:04:27 PM
To: Nguyen, Giang Hoang
Cc: vtkusers at public.kitware.com
Subject: Re: [vtkusers] vtkGeometryFilter for quadratic tetra grids

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<http://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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180820/fd9254b0/attachment.html>


More information about the vtkusers mailing list