Fortran libmmg3d - Get Parent of a Boundary Element


#1

Hello,

First tanks a lot for your library!

I am currently trying to interface MMG with the Elmer FEM Solver. To convert a MMG grid to an Elmer one, I need to know the bulk parent element of each boundary element. More precisely, in my case I need to know to what tetrahedron belongs a triangle face.
Is there a Fortran API function to do that in the library? I’ve looked into the library header, but did not manage to find one by myself.

Thanks!
Kévin


#2

Hi Kevin,

Thank you for using Mmg and for interfacing it in the Elmer FEM Solver.
In 3D, you can use the MMG3D_Get_tetFromTria fonction:

SUBROUTINE MMG2D_GET_TETFROMTRIA(mesh,ktri,ktet,iface,retval) MMG5_DATA_PTR_T, INTENT(IN):: mesh INTEGER, INTENT(IN) :: ktri INTEGER, INTENT(OUT) :: ktet,iface,retval END SUBROUTINE

mesh is your pointer toward the MMG mesh and ktri the index of your triangle. The function fills ktet and iface that are respectively the index of the tetrahedron to which belongs the triangle and the face of the tetrahedron matching the boundary triangle.

Similarly, you can use the MMG2D_Get_triFromEdge function in 2D:

SUBROUTINE MMG2D_GET_TRIFROMEDGE(mesh,ked,ktri,ied,retval) MMG5_DATA_PTR_T, INTENT(IN) :: mesh INTEGER, INTENT(IN) :: ked INTEGER, INTENT(OUT) :: ktri,ied,retval END SUBROUTINE
Regards,

Algiane


#3

Hi Algiane,

Thanks a lot, it’s working nicely.

Kévin.


#4