How to read .vtu file in C++?

12 months ago by
Hi all,

I need to use a library called "Omega_h" in order to construct and adapt meshes while solving problems with FEniCS. Obviously, all the mesh formats supported by FEniCS are not supported by Omega_h, and viceversa.

Omega_h can read: .osh - .meshb - .gmsh
and can write: .osh - .meshb - .vtu

The idea is to create the initial mesh/geometry with Omega_h, write the .osh file it in a .vtu file, and make FEniCS read this .vtu, doing calculations with FEniCS, obtain a suitable metric field (in order to adapt), and then doing mesh calculation with Omega_h, and so on.
We don't know what else do. The problem here is that FEniCS does not want to read .vtu files, even if it can write them.

How can we solve this problem? Can you suggest alternative ways to make Omega_h and FEniCS interact?

Thanks for your time!
Community: FEniCS Project

2 Answers

12 months ago by

maybe you could use the ReadUnstructredGrid module provided by VTK directly? An example of this module's usage can be found here

12 months ago by
This is the Omega_h developer here. I've been looking at FEniCS to find better ways of having them interact, because I don't think the file-based approach will be effective. I already have an example of another adapt code that has interacted via Python (Pragmatic), and I've been looking at the C++ structures of DOLFIN to see if we can interact more directly. This effort seems a bit big for a single question, but maybe I'll start by posing questions on this site.

Edit: I've just finished getting the foundation of this in place (a direct C++ interface), see example usage here:
Please login to add an answer/comment or follow this question.

Similar posts:
Search »