fix: workaround for vtkRedistributeDataSetFilter #3816
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a workaround for a regression in
vtkRedistributeDataSetFilter
observed in VTK versions 9.4.2 and newer.Since VTK v9.4.2,
vtkRedistributeDataSetFilter
fails to correctly redistribute hybrid meshes containing tetrahedra or pyramids, resulting in silent cell loss. This issue does not seem to happen in VTK v9.3.1, but has been reproduced in both v9.4.2 and v9.5.1 (on large hybrid meshes >1M cells and at high rank counts >48), even in minimal standalones independent of GEOS.For context, our parallel workflow relies on
vtkRedistributeDataSetFilter
's kd-tree capability to perform an initial, balanced distribution of any VTK mesh that is first read only by rank 0. This step is a prerequisite for parallel partitioners like ParMetis, which assume all ranks already hold a portion of the mesh.In practice, this PR implements a "detect-and-fallback" mechanism:
vtkRedistributeDataSetFilter
, the code checks whether any cells were lost.scatterByBlock
method, which redistributes the mesh from rank 0 using contiguous cell blocks.As opposed to a kd-tree, this fallback approach does not rely on any geometric information, so using a partitioning tool such as
ParMetis
orPTScotch
in post-processing is highly recommended to optimize the resulting partitions.