t8code icon indicating copy to clipboard operation
t8code copied to clipboard

Remove duplicated points from vtkfile when using vtkAPI

Open Davknapp opened this issue 2 years ago • 1 comments

Currently we write points n-times if it is used by n cells. However, we could provide the option to avoid duplication using the vtkCleanUnstructuredGrid-Filter.

Implementing the usage of this filter in t8_forest_vtk.cxx (t8_forest_to_vtkUnstructuredGrid) would close this issue.

Can be used as a good first issue, if new to t8code, but familiar with vtk.

Davknapp avatar Jul 04 '23 12:07 Davknapp

To test this filter on a toy example, you can load the attached .vtu file which has element-wise node labeling. Then choose the Clean to Grid filter in ParaView to remove the duplicate nodes. testmesh.zip

The example was produced using the meshio Python package:

import meshio
points = [[0, 0], [0.25, 0], [0.25, 0.5], [0, 0.5],
          [0.25, 0], [0.5, 0], [0.5, 0.5], [0.25, 0.5],
          [1, 1], [0.5, 1], [0.5, 0], [1, 0],
          [0.25, 1], [0, 1], [0, 0.5], [0.25, 0.5],
          [0.25, 0.5], [0.5, 0.5], [0.5, 1], [0.25, 1]]
cells = [('quad', [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19]])]
solution_at_nodes = {'u': [0, 1, 2, 0, 1, 1, 0, 2, 2, 2, 2, 2, 1, 0, 0, 2, 2, 0, 0, 1]}
mesh = meshio.Mesh(points, cells, point_data=solution_at_nodes)
mesh.write('testmesh.vtu')

comparison

I mimicked a DG-like approximation on this mesh of 2 coarse elements. The element on the left was refined once, the right one was not refined because the field is constant on that element. The remaining issues after the application of the filter are:

  • how to get rid of the hanging node
  • how to influence which nodes are suppressed by the filter
  • (optionally) how to obtain a conforming mesh

CsatiZoltan avatar Sep 22 '23 16:09 CsatiZoltan