# pvtu writing for parts that don't have data on rank 0

**URL:** https://discourse.vtk.org/t/pvtu-writing-for-parts-that-dont-have-data-on-rank-0/10750
**Category:** Support
**Created:** [February 22, 2023, 4:43am UTC](https://discourse.vtk.org/t/pvtu-writing-for-parts-that-dont-have-data-on-rank-0/10750 "2023-02-22T04:43:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jake](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/f475e1/32.png) [@jake](https://discourse.vtk.org/u/jake)
#### Post date: [February 22, 2023, 4:43am UTC](https://discourse.vtk.org/t/pvtu-writing-for-parts-that-dont-have-data-on-rank-0/10750/1 "2023-02-22T04:43:51Z")

</div>

Update: I have continued to look at this and am starting to think this is a bug in VTK.

Hello,

I am trying to use the vtkXMLPUnstructuredGridWriter to output results for a mesh that has multiple bodies. I want one set of output files per body. The problem is that some bodies do not have any data on the rank 0 process and when I write the \*pvtu files for those bodies do not have any `PPointData` or `PPoints` info. The snippet of code that I use for writing is below, followed by the two \*pvtu outputs for a two body and two processor job where all the data for `body_1` is on rank 0 and all the data for `body_2` is on rank 1, thus `data` on rank 0 for `body_2` does not have any points or arrays. What can be done so that `body_2.pvtu` has the same `PPointData` and `PPoints` info as `body_1.pvtu`?

Snippet for writing:

```auto
vtkSmartPointer< vtkXMLPUnstructuredGridWriter > writer = vtkSmartPointer< vtkXMLPUnstructuredGridWriter >::New();
writer->SetController( contr );
writer->SetInputData( data );
writer->SetFileName( filename );
writer->SetNumberOfPieces( mpisize );
writer->SetStartPiece( rank );
writer->SetEndPiece( rank );
writer->Update();

```

`body_1.pvtu` output

```auto
<?xml version="1.0"?>
<VTKFile type="PUnstructuredGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <PUnstructuredGrid GhostLevel="0">
    <PPointData>
      <PDataArray type="Float32" Name="displacement" NumberOfComponents="3"/>
    </PPointData>
    <PPoints>
      <PDataArray type="Float32" Name="Points" NumberOfComponents="3"/>
    </PPoints>
    <Piece Source="body_1.vtu"/>
  </PUnstructuredGrid>
</VTKFile>

```

`body_2.pvtu` output

```auto
<?xml version="1.0"?>
<VTKFile type="PUnstructuredGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <PUnstructuredGrid GhostLevel="0">
    <PPoints>
    </PPoints>
    <Piece Source="body_2.vtu"/>
  </PUnstructuredGrid>
</VTKFile>

```
