- edited description
Cannot read VTK files with METADATA
When we try to load a vtk file (moab.load_file("plane.vtk", 0, "");
) created for example with ParaView 5.7.0 we get the following error:
MOAB ERROR: Parsing error at line 230: expected one of { VERTICES LINES POLYGONS TRIANGLE_STRIPS } got "METADATA"!
MOAB ERROR: match_token() line 378 in src/io/FileTokenizer.cpp
MOAB ERROR: --------------------- Error Message ------------------------------------
MOAB ERROR: Failed to load file after trying all possible readers!
MOAB ERROR: serial_load_file() line 623 in src/Core.cpp
MOAB ERROR: load_file() line 514 in src/Core.cpp
However, when we delete the metadata lines from vtk e.g.:
INFORMATION 2
NAME L2_NORM_RANGE LOCATION vtkDataArray
DATA 2 0.516745 1.17908
NAME L2_NORM_FINITE_RANGE LOCATION vtkDataArray
DATA 2 0.516745 1.17908
Everything works fine.
Comments (20)
-
reporter -
reporter - attached plane.vtk
-
reporter - edited description
-
reporter - edited description
-
Thanks for raising the issue. We will add some switches to accomodate these section changes. I will let you know when a PR is ready for review.
-
@Iulian Grindeanu can we update VTK reader to ignore the metadata sections for now ?
-
is there somewhere a description of the format ? it is a newer vtk format, and we say we support basic, legacy formats; I could not find a reference to metadata fields even in
https://vtk.org/wp-content/uploads/2015/04/file-formats.pdfso it must be something newer than that ; suggestions ? @Karol Lewandowski
-
Yes, it seems to have issues with MOAB and the file format support. Paraview and vtk writes only the version 5.1 now. And MOAB reads only v3.0 or below.
-
is there a manual / description of the version 5.1 format ?
-
Hi @Iulian Grindeanu . According to this post, there is no official documentation for the new legacy format, it’s still work in progress
-
Thanks Antoine; so I assume the only solution is to look at the source code, and try to reverse engineer the format; maybe the source code is documented. Does anybody know ? Is Paraview using directly vtk reader/writers for the new legacy code? Or do they process it ? Probably I have to see vtk source code, not Paraview
-
You are right : the vtk code is included within Paraview, and this is this code which is called by Paraview.
My conclusions were that Paraview/VTK has the backward compatibility to read the old file format (<= 3.0), but can’t save them anymore (just the 5.1).
As far as I know, the main difference are in the way the cells are written. Indeed, there is “three” subsections after the “CELL” sections (CONNECTIVITY, CELL_TYPES and OFFSETS) that are handled by this :
https://gitlab.kitware.com/vtk/vtk/-/blob/master/IO/Legacy/vtkUnstructuredGridWriter.cxx#L38
and this
https://gitlab.kitware.com/vtk/vtk/-/blob/master/IO/Legacy/vtkDataWriter.cxx#L2292
-
I gathered simple data set in the “old” and “new” format : one sphere meshed with tetrahedra (I also put some simple field data for the new version), and one cube meshed with arbitrary polyhedron.
I hope it can help.
-
The most explicit documentation I have found is here : https://vtk.org/Wiki/VTK/Polyhedron_Support
Thanks for your help with this issue!
-
@Iulian Grindeanu Any progress on this ?
-
no, sorry; it seems that the solution is to reverse engineer / understand what paraview does; we have a list of tokens that we process; and should adapt what we do to the new format; even vtk examples site is outdated:
https://kitware.github.io/vtk-examples/site/VTKFileFormats/we support polyhedra in our moab vtk reader / writer since 4.9.1; there is no doc though on how to interpret the metadata, and what can be skipped
safely;
-
@Antoine Mazuyer can you please update the link with your example? it expired and I missed it :)
-
so there are several issues; legacy format is vtk 3.0, which we support, including polyhedra and polygons; paraview 5.7 exports in format 4.2, which seems to be very similar to 3.0, except for metadata info; paraview 5.8 exports in vtk format 5.0, which is different, because it introduces, as Antoine pointed out, new subsections, OFFSETS, CONNECTIVITY and then old CELL_TYPES ; The only way to even obtain example files is to run paraview 5.7, 5.8 and export old files in new format; I just deleted 5. 7 from my laptop, I have to install again
-
@Iulian Grindeanu Any progress ?
-
no, sorry
- Log in to comment