# Libraries to deal with unstructured grids

I am dealing with a *.cgns file. This mesh format, when saved as an unstructured grid, holds nodes coordinates, nodes connectivity per element and boundary conditions. It is a neat mesh format with good documentation. However, I am still responsible for building the rest of the data structures for the calculations. For example, the face table for cell-centered FV schemes. This is a very delicate work which has to be done for every solver somehow (for cell-vertex solvers it would be the points neighboring I think).

So, since many folks out there had to develop this type of routines, I think it is reasonable to think someone smarter than me wrote a library which organize these data structures.

I was reading PETSc documentation for DMPlex but I am still trying to figure out how to give a *.cgns file to it. From what I saw, even compiling with cgns support, the file I/O for this format is not well established for this library. I am not criticizing anyone, PETSc is an awesome library.

My question is if there is any library out there which manages the creation of this type of data structures, not just for FV methods, but also for any type of scheme/solver? A quick bonus question... Is there anyone researching algorithms to create data structures for PDE solvers efficiently?

## 1 Answer

Most finite element libraries have the ability to read a good number of mesh formats. The library I work on, deal.II (see http://www.dealii.org) happens to have quite a number of mesh readers for VTK, UCD, GMSH, ... formats, see here: https://dealii.org/developer/doxygen/deal.II/classGridIn.html and its implementation here https://github.com/dealii/dealii/blob/master/source/grid/grid_in.cc . These readers are generally not terribly complicated (with the exception of the UNV format, which for historical reasons is really just a memory dump of one particular program) and relatively easy to extend to a new format such as the one you're interested in.

Once you have that out of the way, the whole rest then happens automatically: building meshes, building connections between cells, querying cells for their neighbors, bounding edges or vertices, or building numerical methods on them. In other words, the problem is nicely separated: All you would have to do is to write a reader for a particular mesh format, and every functionality of these libraries then becomes available to you immediately.

• Isn't dealii restricted to quads/hexes? Nov 12 '18 at 18:30
• Correct. If you need something else, take a look at libmesh. That also has triangles and tetrahedra. Nov 13 '18 at 3:52