[vtkusers] Naming of different pieces in VTU format

Peter Råback peter.raback at csc.fi
Thu Dec 3 03:09:29 EST 2015


Hi Berk



Thank you for your very helpful answer. Of the little I can find on the vtm 
file it would seem to be indeed the natural solution. Would there happen to 
be some documentation of the vtm format?



In parallel computation we are using the .pvtu format which wraps the 
individual .vtu files to a single entity. Would this .pvtu file be in some 
way compatible with the .vtm file? Or should we make the vtm format also 
include the parallel pieces?



BR, Peter



From: Berk Geveci [mailto:berk.geveci at kitware.com]
Sent: 2. joulukuuta 2015 15:57
To: Peter Råback
Cc: VTK Users
Subject: Re: [vtkusers] Naming of different pieces in VTU format



Hmmm. This is not supported by the piece support in the vtu format. That is 
designed so that multiple partitions can be written to the same file. At 
read time, the reader actually appends them to a single unstructured grid.



There are three ways of achieving what you'd like:

* Use the vtm format

* Use the Exodus format

* Use Xdmf format



The vtm format is the simplest. A simple XML format that points to a vtu 
file per block. It has the disadvantage that these blocks cannot share point 
coordinates - each file is stand-alone. If you need that, I highly recommend 
using the Exodus II format. It is well documented and has a nice API. As 
long as it supports all the cell types that you need of course. The 
documentation is here:



http://sourceforge.net/projects/exodusii/files/Documentation/Documentation/



Best,

-berk







On Mon, Nov 30, 2015 at 5:07 PM, Peter Råback <peter.raback at csc.fi 
<mailto:peter.raback at csc.fi> > wrote:

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">
_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: 
http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151203/46bb96d3/attachment.html>


More information about the vtkusers mailing list