[Paraview] convert a multi-block structured grid into a single unstructured block

Kent Eschenberg eschenbe at psc.edu
Thu Apr 17 11:58:34 EDT 2008


> Paul Edwards wrote:
> Is there a way to convert a multi-block structured grid into a
> single unstructured block?

There will always be tasks like this that ParaView can't do easily. Kitware will never catch up because we will keep inventing new things to do!

A good solution is to build a version of VTK with Python and use it for little tasks like this. In your case the basic sequence would be

   - create vtkAppendFilter
   - read the multi-block grid
   - loop over blocks and add each to the append filter
   - write the append filter's output

I used a similar Python program to combine multi-block PVD files sets into a smaller number of files.

When the blocks share vertices we run the append filter's output through vtkCleanUnstructuredGrid before writing it. This requires a little work because this filter is in ParaView but not VTK. I pulled that filter from the ParaView source tree and added it to VTK following the instructions on the VTK Wiki page "Extending VTK".

Hey Kitware - why are some really great classes like vtkCleanUnstructuredGrid in ParaView instead of VTK?

Kent
Pittsburgh Supercomputing Center


More information about the ParaView mailing list