Forum Message



We have moved the forum to . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.


The forum is in read only mode.

VtkOutput problem: .vtu files instead of .vtk files

2 years 4 months ago - 2 years 4 months ago #3997 by dong
I run the code with vtk output . The output is only .vtu files instead of .vtk files.
I couldn't visualize those .vtu files with Paraview software. On the output message, when I tried to open those files was as follows.
ERROR: In C:\bbd\8fbebceb\build\superbuild\paraview\src\VTK\IO\XML\vtkXMLUnstructuredDataReader.cxx, line 681 vtkXMLUnstructuredGridReader (000001A1AC6925D0): Cannot read cell connectivity from Cells in piece 0 because the "offsets" array is not monotonically increasing or starts with a value other than 0.

Could you please tell me how I can solve this issue? How can I get .vtk files from .vtu files.
Thank you so much.
Last edit: 2 years 4 months ago by dong.
2 years 4 months ago #3998 by dong
My problem was solved.
When I used the latest version, it produced the .vtu files. Couldn't view in Paraview.
When I used the 2020 version, it produced the .vtk files. Can visualize in Paraview.
I don't know why.
2 years 4 months ago #4000 by schruste
We indeed changed the default VTK output from the legacy format (.vtk) to the xml format (.vtu) (which also allows for binary output) in the meantime. However, Paraview (if not very very old) should be able to cope with both. You can also enforce the legacy format with a latest versions of ngsolve adding "legacy=True" in the VTKOutput constructor.

2 years 4 months ago - 2 years 4 months ago #4001 by dong
I changed bool legacy = False to bool legacy =True in VtkOuput.hpp file, I still get vtu files. I also used the latest version of Paraview, but I still couldn’t visualize vtu file. Perhaps I made a mistake somewhere.

Best wishes,
Last edit: 2 years 4 months ago by dong.
2 years 4 months ago #4002 by schruste
Well, you changed the default argument on the C++-side, but when called from python, the VTKOutput will still use the python-default which is false. So, simply use legacy=True when instantiating the VTKOutput object.

Alternatively you can use tools like meshio to convert vtk to vtu, e.g. install `pip install meshio` and then call `meshio convert test.vtu test.vtk`.

Time to create page: 0.098 seconds