Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

akaszynski
Copy link
Member

Resolve #6208 by copying the unstructured grid before cleaning it.

Turns out that vtkStaticCleanUnstructuredGrid modifies the connectivity of the input grid. From their documentation:

The filter does not modify the topology of the input dataset, nor change the types of cells. It may however, renumber the cell connectivity id.

Therefore, to avoid side-effects, let's always copy the input grid when cleaning.

Performance Considerations

Ideally we'd just shallow copy the input UnstructuredGrid and then deep copy the cells. However, there's an edge case where the input grid has polyhedral cells and we'd have to also code up that edge case. I'm leaning on the side of caution and just copying the entire input grid, especially as the copy operation is unlikely to be the long running operation.

@pyvista-bot pyvista-bot added the bug Uh-oh! Something isn't working as expected. label Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.19%. Comparing base (b5d7a81) to head (0232ae0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6337   +/-   ##
=======================================
  Coverage   97.19%   97.19%           
=======================================
  Files         142      142           
  Lines       26313    26313           
=======================================
  Hits        25574    25574           
  Misses        739      739           

tkoyama010
tkoyama010 previously approved these changes Jul 3, 2024
Copy link
Member

@tkoyama010 tkoyama010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@tkoyama010 tkoyama010 enabled auto-merge (squash) July 3, 2024 13:10
@tkoyama010 tkoyama010 merged commit f0e909d into main Jul 3, 2024
@tkoyama010 tkoyama010 deleted the fix/clean-modifies-inplace branch July 3, 2024 14:26
@banesullivan banesullivan mentioned this pull request Jul 7, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnstructuredGrid.clean modifies cell faces in-place
3 participants