# vtkMultiBlockDataSet and parallel pipelines

**URL:** https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137
**Category:** Support
**Created:** [April 23, 2020, 8:44pm UTC](https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137 "2020-04-23T20:44:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [April 23, 2020, 8:44pm UTC](https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137/1 "2020-04-23T20:44:38Z")

</div>

Hello!!!

I’m working with a vtkMultiBlockDataSet with around 6,000 blocks where each block is a vtkUnstructuredGrid. The data represents a finite element mesh and each block is a separate “Part”. Some of the blocks contain 3D cells, some 2D and some 1D - but I’m using vtkUnstructuredGrids for all of them right now although I can easily use PolyData for the 1D/2D blocks if necessary.

I’m trying to figure out how to efficiently and quickly apply filters to this data set. It seems obvious that filters such as creating free faces, feature edges, mesh quality etc. should be possible using a parallel pipeline, however I can’t find any examples or tutorials to help me get started.

So I have a few questions for the forum,

1. Is my assumption that the above filters can be run in parallel across the blocks of a MultiBlockDataSet valid or not? To be clear, I’m thinking about SMP type parallelism at this point - using multiple cores on a single workstation
2. If the answer to 10 is Yes… What is the basic approach that I should be looking at?
3. Finally, a very basic question. It seems that I cannot pass the MultiBlockDataSet directly to any mapper - and that I first have to extract the faces into a vtkPolyData using something like vtkCompositeDataGeometryFilter before rendering. Is this the idiomatic way of rendering MultiBlockDataSets or am I missing something?

Thanks in advance for your help,

Doug

---

<div class="post-metadata">

### Author: ![utkarshayachit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/utkarshayachit/32/379_2.png) [@utkarshayachit](https://discourse.vtk.org/u/utkarshayachit)
#### Post date: [April 24, 2020, 2:44pm UTC](https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137/2 "2020-04-24T14:44:21Z")

</div>

> [@scotsman60](#):
>
> Is my assumption that the above filters can be run in parallel across the blocks of a MultiBlockDataSet valid or not?

Not by default. However, there’s an experiemental executive that supported this. If you set the `vtkThreadedCompositeDataPipeline` as the default executive using `vtkAlgorithm::SetDefaultExecutivePrototype` and then the executive will execute the algorithm on each block in parallel. I say it’s experimental since I am not aware how well tested/used this executive is.

> [@scotsman60](#):
>
> It seems that I cannot pass the MultiBlockDataSet directly to any mapper

Better option is to use `vtkCompositePolyDataMapper2` instead. It avoids merging all blocks into one.

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [April 24, 2020, 3:30pm UTC](https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137/3 "2020-04-24T15:30:08Z")

</div>

Thank-you - I’ll try vtkThreadedCompositeDataPipeline. I did read more on the vtk pipeline and I now understand that it’s designed to run each filter serially, but that some filters support parallel operations.

I’m already using vtkCompositePolyDataMapper2 - and as long as all of the blocks are PolyData this works, but if any are UnstructuredGrids it just skips them.

So I’m still not clear on the best way to operate on the data.

---

<div class="post-metadata">

### Author: ![utkarshayachit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/utkarshayachit/32/379_2.png) [@utkarshayachit](https://discourse.vtk.org/u/utkarshayachit)
#### Post date: [April 24, 2020, 3:44pm UTC](https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137/4 "2020-04-24T15:44:11Z")

</div>

> [@scotsman60](#):
>
> I’m already using vtkCompositePolyDataMapper2 - and as long as all of the blocks are PolyData this works, but if any are UnstructuredGrids it just skips them.

For that, use the standard GeometryFilter or DataSetSurfaceFilter to convert UGs to PD. Those filters do each block separately and don’t bother appending them together – which saves time.

---

<div class="post-metadata">

### Author: ![sridhar-mani](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sridhar-mani/32/9522_2.png) [@sridhar-mani](https://discourse.vtk.org/u/sridhar-mani)
#### Post date: [December 30, 2024, 11:32am UTC](https://discourse.vtk.org/t/vtkmultiblockdataset-and-parallel-pipelines/3137/5 "2024-12-30T11:32:18Z")

</div>

is this viz possible in js
