I am working on a 2D unstructured code in C++. I am using gmsh to generate a 2D unstructured mesh and reading it into my program with a library called GMSH_IO. Now that I have the data, I would like to write it to a VTK file for visualization in Paraview.

I could do this manually, but I am curious if anyone knows of a library for writing unstructured meshes to VTK files for visualization?


I think you are looking for Kitware VTK, basically, the main library for interaction with VTK files. Examples page will contain a lot of samples, including the one you are looking for: output of an unstructured grid.

As an addition, GMSH itself (I am using 3.0.5) is also able to export the mesh into VTK without the need to go through IO procedure. That can be accessed:

File -> Export -> Save As -> Mesh VTK (*.vtk)

enter image description here

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.