MantisBT - VTK
View Issue Details
0012687VTK(No Category)public2011-10-31 05:252015-09-29 14:56
Andreas Buykx 
Andy Bauer 
highminorhave not tried
closedreopened 
5.8.0 
6.2.0 
TBD
incorrect functionality
0012687: vtkGeometryFilter corrupts cell data when converting unstructured grid
During conversion of unstructured grid (UG) to polydata (PD) using vtkGeometryFilter cell data gets lost if the UG contains combinations of vertices/lines/polys.

The cell type switch in vtkGeometryFilter::UnstructuredGridExecute creates cells in vtkCellArrays for vertices, lines, and polys. Each of these generates its own ids, causing e.g. a subsequent UG vertex and UG line cell to map to the same PD id. Consequently, the cell data of the UG vertex is overwritten by that of the UG line.

In the attached archive is a small program that demonstrates the issue, and XML files of the input UG and the output PD, and the program output reporting the corrupted cell data array.

Note: SALOME GUI VTKViewer_GeometryFilter.cxx has probably addressed this issue by using vtkPolyData::InsertNextCell instead of building verts, lines etc. separately (http://docs.salome-platform.org/salome_6_3_1/gui/tui/GUI/index.html [^])
hackaton
tgz vtkGeometryFilter_issue.tgz (2,893) 2011-10-31 05:25
https://www.vtk.org/Bug/file/9050/vtkGeometryFilter_issue.tgz
cxx vtkGeometryFilter.cxx (40,022) 2015-02-07 02:03
https://www.vtk.org/Bug/file/9/vtkGeometryFilter.cxx
patch vtkGeometryFilter.cxx.patch (22,478) 2015-02-07 02:05
https://www.vtk.org/Bug/file/10/vtkGeometryFilter.cxx.patch
cxx TestGeometryFilterCellData.cxx (9,196) 2015-02-19 07:28
https://www.vtk.org/Bug/file/14/TestGeometryFilterCellData.cxx
Issue History
2011-10-31 05:25Andreas BuykxNew Issue
2011-10-31 05:25Andreas BuykxFile Added: vtkGeometryFilter_issue.tgz
2011-10-31 05:43Andreas BuykxNote Added: 0027625
2012-01-23 10:02Utkarsh AyachitAssigned To => Leo Liu
2012-01-23 10:02Utkarsh AyachitStatusbacklog => tabled
2013-07-22 20:03Dave DeMarleStatustabled => backlog
2013-07-22 20:03Dave DeMarleNote Added: 0031258
2013-07-22 20:37Dave DeMarleStatusbacklog => expired
2013-07-22 20:37Dave DeMarleNote Added: 0031307
2014-01-27 06:53Andreas BuykxNote Edited: 0027625bug_revision_view_page.php?bugnote_id=27625#r727
2014-01-27 06:56Andreas BuykxNote Added: 0032219
2014-01-27 06:57Andreas BuykxNote Deleted: 0032219
2014-01-27 07:03Andreas BuykxNote Added: 0032221
2014-01-27 07:03Andreas BuykxStatusexpired => backlog
2014-01-27 07:03Andreas BuykxResolutionopen => reopened
2014-10-01 20:09Berk GeveciTag Attached: hackaton
2014-10-02 10:57Andy BauerAssigned ToLeo Liu => Andy Bauer
2014-10-02 13:18Andy BauerStatusbacklog => active development
2014-10-02 13:37Andy BauerStatusactive development => gerrit review
2014-10-02 14:12Andy BauerNote Added: 0033506
2014-10-02 14:12Andy BauerStatusgerrit review => closed
2014-10-02 14:12Andy BauerResolutionreopened => fixed
2014-10-02 14:12Andy BauerFixed in Version => 6.2.0
2015-02-07 02:03Andreas BuykxNote Added: 0034182
2015-02-07 02:03Andreas BuykxStatusclosed => backlog
2015-02-07 02:03Andreas BuykxResolutionfixed => reopened
2015-02-07 02:03Andreas BuykxFile Added: vtkGeometryFilter.cxx
2015-02-07 02:05Andreas BuykxFile Added: vtkGeometryFilter.cxx.patch
2015-02-07 02:05Andreas BuykxNote Edited: 0034182bug_revision_view_page.php?bugnote_id=34182#r1027
2015-02-09 09:41Andy BauerNote Added: 0034194
2015-02-09 13:13Andreas BuykxNote Added: 0034196
2015-02-10 01:03Andreas BuykxNote Edited: 0034196bug_revision_view_page.php?bugnote_id=34196#r1029
2015-02-16 13:37Andy BauerNote Added: 0034221
2015-02-16 13:37Andy BauerStatusbacklog => active development
2015-02-18 11:50Andreas BuykxNote Added: 0034226
2015-02-18 11:54Andy BauerNote Added: 0034227
2015-02-19 07:27Andreas BuykxNote Added: 0034259
2015-02-19 07:28Andreas BuykxFile Added: TestGeometryFilterCellData.cxx
2015-02-19 07:29Andreas BuykxNote Edited: 0034259bug_revision_view_page.php?bugnote_id=34259#r1035
2015-09-29 14:48Andreas BuykxNote Added: 0035247
2015-09-29 14:56Andy BauerStatusactive development => closed

Notes
(0027625)
Andreas Buykx   
2011-10-31 05:43   
(edited on: 2014-01-27 06:53)
Seems to be related to the following issue reported on the mailing list: http://www.vtk.org/pipermail/vtk-developers/2006-January/003964.html [^]

(0031258)
Dave DeMarle   
2013-07-22 20:03   
moving all "tabled" bugs into "backlog" category since "tabled" is no longer used.
(0031307)
Dave DeMarle   
2013-07-22 20:37   
Leo no longer works on the project. If these issues still exist in 6.0, please reopen them and assign to Dave DeMarle.
(0032221)
Andreas Buykx   
2014-01-27 07:03   
Code review of 6.1.0 version: the loop over cells starting at line 707 creates cells in one of several vtkCellArrays, each of which returns a cell id that is subsequently used to copy cell data. The issue therefor still is not dealt with.
(0033506)
Andy Bauer   
2014-10-02 14:12   
Commit for the fix with a test is:

commit 1e441c10cf0cfa91c19300d7f4c2661100213ec7
Author: Andrew Bauer <andy.bauer@kitware.com>
Date: Thu Oct 2 12:22:27 2014 -0400

    Fixed incorrect cell data output.

    Cell data arrays were being output wrong from the vtkGeometryFilter
    due to getting the wrong output cell id and using that with
    CopyData().

    Change-Id: I9269d94961dbadded1d1d9d46104eb06a9269e0e
(0034182)
Andreas Buykx   
2015-02-07 02:03   
(edited on: 2015-02-07 02:05)
Hi, I saw the fix that was applied, and indeed now the number of cell data records is correct, however it still mixes up the cell data of the original cells. polydata is traversed in order verts/lines/triangles/polys and so the cell numbering in the polydata is not the same as in the unstructured grid. Suppose the ug has alternating line (cell ids 0,2,4,...) and triangle cells (1,3,5,...) then traversing the cells of the poly will first see cell data of original cells 0,2,4,... and then 1,3,5,...

I have a fix that addresses this, which I uploaded as a diff and as complete file.

(0034194)
Andy Bauer   
2015-02-09 09:41   
Can you try out the following version of VTK:
commit 3cf2f8893474c9fa5b4a205d50c38000b8a933b8
Author: Paul Edwards <p.edwards@iconcfd.com>
Date: Wed Jan 28 16:26:46 2015 -0500

    Fixing how polydata cells are deleted.
    
    Change-Id: I153cd51c9948648338f5219288ed76acc2818572

If this doesn't fix your issue, please let me know.
(0034196)
Andreas Buykx   
2015-02-09 13:13   
(edited on: 2015-02-10 01:03)
Hi Andy,
Suppose my ug has four cells with a single cell-data array with an array that contains their cell id:
cell-id 0 : VTK_LINE cell-data 0
cell-id 1 : VTK_VERTEX cell-data 1
cell-id 2 : VTK_LINE cell-data 2
cell-id 3 : VTK_VERTEX cell-data 3

The current version will generate poly-data with (traversing first verts then lines):
0 : VTK_VERTEX 0
1 : VTK_VERTEX 1
2 : VTK_LINE 2
3 : VTK_LINE 3

instead of
0 : VTK_VERTEX 1
1 : VTK_VERTEX 3
2 : VTK_LINE 0
3 : VTK_LINE 2

I don't think that the commit you referred to addresses the issue, as vtkGeometryFilter is filling a vtkPolyData, not removing stuff from it.

(0034221)
Andy Bauer   
2015-02-16 13:37   
See http://review.source.kitware.com/#/t/5477/ [^] for the gerrit topic for this fix.
(0034226)
Andreas Buykx   
2015-02-18 11:50   
any chance this makes it into 6.2.0?
(0034227)
Andy Bauer   
2015-02-18 11:54   
I'm pushing to get it into 6.2.0. Do you mind checking on the bug fix? You can just check out master as of today for it.
(0034259)
Andreas Buykx   
2015-02-19 07:27   
(edited on: 2015-02-19 07:29)
Hi Andy, I built the current master on our system, and adapted the TestGeometryFilterCellData to be able to test it (we don't usually build the python part). This all worked nicely.

I'll attach the source of TestGeometryFilterCellData, because I'm not sure how to do this in git (your branch was abandoned???).

I wouldn't mind doing it, for practice sake, by creating a new branch, committing it, and have you review it.

(0035247)
Andreas Buykx   
2015-09-29 14:48   
This issue can be closed, I think: code is in VTK6.2.0