Interfacing FE library with Parmmg

I am currently working on integrating Parmmg with our multiphysics FE library. I have a question regarding the possibility of passing mesh parameters directly to the Parmmg routines without using mesh files. Specifically, I would like to know if there is an example or any guidance available on how to achieve this. It seems more efficient to directly provide the mesh parameters to Parmmg when we are adaptively remeshing a domain, rather than going through the process of writing and reading mesh files. I would greatly appreciate any assistance or information you can provide on this matter. Thank you in advance.

I’m not sure if it helps you but here are examples for the regular MMG library: mmg/libexamples at master · MmgTools/mmg · GitHub

Hey Johannes

Thank you, but in all these examples the meshes are read via mesh files. I am looking for an example with a simple mesh which is passed directly to the routines of parmmg. I hope it makes sense.

Yes. I think I understand what you mean. Unfortunately, I don’t know any examples. Maybe somebody else knows more.


Is this not what you are looking for? This is the template we used when using ParMmg in ElmerFEM.


Here an implementation example for Kratos Multiphysics:

Hello @Waleed_Mirza ,
To add to the good answers that have already been posted, you can pass either a centralized or a parallely distributed mesh without passing through files:

If you wonder how the parallel connectivity of the distributed mesh needs to be set, here there is a wiki page (with pictures beside code) that can help: Manually distributed library example · MmgTools/ParMmg Wiki · GitHub