# Warp exodusII by vector

**URL:** https://discourse.vtk.org/t/warp-exodusii-by-vector/4617
**Category:** Support
**Created:** [November 9, 2020, 10:41pm UTC](https://discourse.vtk.org/t/warp-exodusii-by-vector/4617 "2020-11-09T22:41:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![trinitytest](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/ccd318/32.png) [@trinitytest](https://discourse.vtk.org/u/trinitytest)
#### Post date: [November 9, 2020, 10:41pm UTC](https://discourse.vtk.org/t/warp-exodusii-by-vector/4617/1 "2020-11-09T22:41:25Z")

</div>

I am trying to show a deformed mesh that is read in from an exodusII file.  
The display of the mesh should update the nodal positions by a vector called “DM”.

I have been successful showing the undeformed mesh and displaying it with a color based on a scalar field in the mesh. To do this I followed the example at the [Lorensen github page](https://lorensen.github.io/VTKExamples/site/Cxx/IO/ReadExodusData/). However I am really struggling with the use of vtkMultiblockDataSet, the output of vtkExodusIIReader, and vtkWarpVector, which is the suggested route to displaying deformed mesh.

My pipeline is below.

```
vtkNew<vtkExodusIIReader> exoSource;
exoSource->SetFileName("file.exoII");
exoSource->UpdateInformation();
exoSource->SetTimeStep(0);
exoSource->SetAllArrayStatus(vtkExodusIIReader::NODAL, 1);
exoSource->SetGlobalResultArrayStatus("DM", 1);

vtkNew<vtkWarpVector> meshWarp;
meshWarp->SetInputData(exoSource->GetOutput());
meshWarp->Update();

vtkNew<vtkPolyDataMapper> exoMapper;
exoMapper->SetInputConnection(meshWarp->GetOutputPort());

vtkNew<vtkActor> exoActor;
exoActor->SetMapper(exoMapper);

vtkNew<vtkRenderer> exoRenderer;
exoRenderer->AddActor(exoActor);

```

The code compiles fine, there are no complaints in the application output, however the renderer displays nothing but the background.

I have also been studying the vtkWarpVector [example](https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/WarpVector/) but I think what I’m missing is how to reconcile the vtkMultiBlockDataSet output by the vtkExodusIIReader with the vtkPolyData input to the vtkWarpVector.

Does anyone have any ideas? Thanks!

---

<div class="post-metadata">

### Author: ![trinitytest](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/ccd318/32.png) [@trinitytest](https://discourse.vtk.org/u/trinitytest)
#### Post date: [November 18, 2020, 3:43pm UTC](https://discourse.vtk.org/t/warp-exodusii-by-vector/4617/2 "2020-11-18T15:43:50Z")

</div>

I found a solution!

To solve the problem, I had to think about the type of the output from a given stage of the pipeline and match it with the expected input type of the next pipeline stage.

An issue with the above pipeline is vtkExodusIIReader outputs a vtkMultiBlockDataSet while vtkWarpVector expects a vtkPolyData as input. Once I had realized this fundamental nature of vtk, I found vtkCompositePolyDataFilter outputs vtkPolyData and used that as the input to vtkWarpVector, as in the pipeline below.

> vtkNew\<vtkExodusIIReader\> exoSource;  
> exoSource-\>SetFileName(“file.exoII”);  
> exoSource-\>UpdateInformation();  
> exoSource-\>SetTimeStep(0);  
> exoSource-\>SetAllArrayStatus(vtkExodusIIReader::NODAL, 1);
> 
> vtkNew\<vtkCompositeDataGeometryFilter\> exoGeometry;  
> exoGeometry-\>SetInputConnection(exoSource-\>GetOutputPort());  
> exoGeometry-\>Update();  
> exoGeometry-\>GetPointData()-\>SetActiveVectors(“DM”);
> 
> vtkNew\<vtkWarpVector\> meshWarp;  
> meshWarp-\>SetInputData(exoGeometry-\>GetOutput());  
> meshWarp-\>Update();
> 
> vtkNew\<vtkPolyDataMapper\> exoMapper;  
> exoMapper-\>SetInputConnection(meshWarp-\>GetOutputPort());
> 
> vtkNew\<vtkActor\> exoActor;  
> exoActor-\>SetMapper(exoMapper);
> 
> vtkNew\<vtkRenderer\> exoRenderer;  
> exoRenderer-\>AddActor(exoActor);

With this pipeline, the type of the output of each pipeline stage matches the expected input of the following stage.  
Note that in order to successfully ‘_Set_’ the active vector of the vtkPolyData output by the vtkCompositeDataGeometryFilter, _Update_() **MUST** first be called on exoGeometry.
