[vtkusers] Naming of different pieces in VTU format

Peter Råback peter.raback at csc.fi
Mon Nov 30 17:07:28 EST 2015


Hi, 

I'm writing a VTU (unstructured XML format) writer for a finite element
software (Elmer) in Fortran. This works otherwise great but I would like
to write different parts of the mesh as different pieces, and hopefully
also name the pieces. The idea is that the piece could be selected in
visualization (with Paraview, ViSit etc.).

I attach at the end a working example of the current output. The data is
appended in binary format (if not saved in ascii). 

Now ideally the Piece field could take a name, e.g.

<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
  <UnstructuredGrid>
    <Piece NumberOfPoints="524" NumberOfCells="150" Name="PartA">
     ...
    </Piece>    
    <Piece NumberOfPoints="233" NumberOfCells="117" Name="PartB">
     ...
    </Piece>
  </UnstructuredGrid>
<AppendedData encoding="raw">

Am I hoping too much? The documentation didn't mention the Piece having
the possibility to name it.

Our current approach is to use CellData "GeometryIds" which gives a number
for each different body and boundary condition. Then one can use the
"Threshhold" filter in Paraview to pick data just related to certain
entity. However, this is rather cumbersome particularly if the interesting
entities do not have indexes following each other.  

Another motivation for saving data piece by piece is that it will be
easier to introduce discontinuities in the mesh. Then within each piece
the data can be saved as continuous while jumps only appear where the
material changes. If one assumes discontinuity over all elements the
amount of data quickly explodes as the nodes can be shared by tens of
elements. 

Could the pieces strategy work, or is there a better way? Any suggestions
are welcome! 

-Peter 



<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
  <UnstructuredGrid>
    <Piece NumberOfPoints="724" NumberOfCells="267">
      <PointData>
        <DataArray type="Float64" Name="potential" NumberOfComponents="1"
format="appended" offset="0"/>
        <DataArray type="Float64" Name="electric field"
NumberOfComponents="3" format="appended" offset="5796"/>
      </PointData>
      <CellData>
        <DataArray type="Int32" Name="GeometryIds" format="appended"
offset="23176"/>
      </CellData>
      <Points>
        <DataArray type="Float64" NumberOfComponents="3" format="appended"
offset="24248"/>
      </Points>
      <Cells>
        <DataArray type="Int32" Name="connectivity" format="appended"
offset="41628"/>
        <DataArray type="Int32" Name="offsets" format="appended"
offset="55792"/>
        <DataArray type="Int32" Name="types" format="appended"
offset="56864"/>
      </Cells>
    </Piece>
  </UnstructuredGrid>
<AppendedData encoding="raw">


More information about the vtkusers mailing list