Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Functions
libmmg2d_tools.c File Reference

Tools functions for the mmg2d library. More...

#include "libmmg2d.h"
#include "libmmg2d_private.h"
#include "mmg2dexterns_private.h"
#include "mmgexterns_private.h"
Include dependency graph for libmmg2d_tools.c:

Go to the source code of this file.

Functions

void MMG2D_setfunc (MMG5_pMesh mesh, MMG5_pSol met)
 Set function pointers for length, caltri... depending if case is iso or aniso.
 
int MMG2D_usage (char *name)
 Print help for mmg2d options.
 
int MMG2D_parsar (int argc, char *argv[], MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol)
 Store command line arguments.
 
int MMG2D_defaultValues (MMG5_pMesh mesh)
 Print the default parameters values.
 
int MMG2D_parsop (MMG5_pMesh mesh, MMG5_pSol met)
 Read a file containing Local parameters (.mmg2d extension)
 
int MMG2D_freeLocalPar (MMG5_pMesh mesh)
 
int MMG2D_Get_numberOfNonBdyEdges (MMG5_pMesh mesh, MMG5_int *nb_edges)
 Get the number of non-boundary edges.
 
int MMG2D_Get_nonBdyEdge (MMG5_pMesh mesh, MMG5_int *e0, MMG5_int *e1, MMG5_int *ref, MMG5_int idx)
 Get vertices and reference of a non-boundary edge.
 
int MMG2D_Get_adjaTri (MMG5_pMesh mesh, MMG5_int kel, MMG5_int listri[3])
 Return adjacent elements of a triangle.
 
MMG5_int MMG2D_Get_adjaVertices (MMG5_pMesh mesh, MMG5_int ip, MMG5_int lispoi[MMG2D_LMAX])
 Return adjacent vertices of a triangle.
 
MMG5_int MMG2D_Get_adjaVerticesFast (MMG5_pMesh mesh, MMG5_int ip, MMG5_int start, MMG5_int lispoi[MMG2D_LMAX])
 Return adjacent vertices of a triangle.
 
int MMG2D_Get_triFromEdge (MMG5_pMesh mesh, MMG5_int ked, MMG5_int *ktri, int *ied)
 Find a triangle given an adjacent triangle and an edge number.
 
int MMG2D_Get_trisFromEdge (MMG5_pMesh mesh, MMG5_int ked, MMG5_int ktri[2], int ied[2])
 Find two triangles given the edge that they share.
 
int MMG2D_Set_constantSize (MMG5_pMesh mesh, MMG5_pSol met)
 Compute a constant size map according to the hsiz, hmin and hmax parameters.
 
int MMG2D_Compute_eigenv (double m[3], double lambda[2], double vp[2][2])
 Compute the real eigenvalues and eigenvectors of a symmetric matrix.
 
void MMG2D_Reset_verticestags (MMG5_pMesh mesh)
 Reset the vertex tags.
 
void MMG2D_Free_triangles (MMG5_pMesh mesh)
 Free the mesh elements (and the adjacency information).
 
void MMG2D_Free_edges (MMG5_pMesh mesh)
 Free the mesh edges (and the associated xpoints).
 
void MMG2D_Free_solutions (MMG5_pMesh mesh, MMG5_pSol sol)
 Free the solution.
 

Detailed Description

Tools functions for the mmg2d library.

Author
Algiane Froehly (Inria/UBordeaux)
Version
5
Date
01 2014

Definition in file libmmg2d_tools.c.

Function Documentation

◆ MMG2D_Compute_eigenv()

int MMG2D_Compute_eigenv ( double  m[3],
double  lambda[2],
double  vp[2][2] 
)

Compute the real eigenvalues and eigenvectors of a symmetric matrix.

Parameters
mupper part of a symMetric matrix diagonalizable in |R
lambdaarray of the metric eigenvalues
vparray of the metric eigenvectors
Returns
the order of the eigenvalues

This function computes the real eigenvalues and eigenvectors of a symmetric matrix m whose upper part is provided (m11, m12, m22, in this order).

lambda[0] is the eigenvalue associated to the eigenvector ( v[0][0], v[0,1] ) in C and to the eigenvector v(1,:) in fortran

lambda[1] is the eigenvalue associated to the eigenvector ( v[1][0], v[1,1] ) in C and to the eigenvector v(2,:) in fortran

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_COMPUTE_EIGENV(m,lambda,vp,retval)
REAL(KIND=8), INTENT(IN) :: m(*)
REAL(KIND=8), INTENT(OUT) :: lambda(*),vp(*)
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 1022 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_defaultValues()

int MMG2D_defaultValues ( MMG5_pMesh  mesh)

Print the default parameters values.

Parameters
meshpointer to the mesh structure.
Returns
0 if fail, 1 if success.

Print the default parameters values.

Definition at line 530 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_Free_edges()

void MMG2D_Free_edges ( MMG5_pMesh  mesh)

Free the mesh edges (and the associated xpoints).

Parameters
meshpointer to the mesh structure
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_FREE_EDGES(mesh)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
END SUBROUTINE

Definition at line 1053 of file libmmg2d_tools.c.

Here is the caller graph for this function:

◆ MMG2D_Free_solutions()

void MMG2D_Free_solutions ( MMG5_pMesh  mesh,
MMG5_pSol  sol 
)

Free the solution.

Parameters
meshpointer to the mesh structure
solpointer to the solution structure
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_FREE_SOLUTIONS(mesh,sol)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
END SUBROUTINE

Definition at line 1070 of file libmmg2d_tools.c.

Here is the caller graph for this function:

◆ MMG2D_Free_triangles()

void MMG2D_Free_triangles ( MMG5_pMesh  mesh)

Free the mesh elements (and the adjacency information).

Parameters
meshpointer to the mesh structure
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_FREE_TRIANGLES(mesh)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
END SUBROUTINE

Definition at line 1038 of file libmmg2d_tools.c.

Here is the caller graph for this function:

◆ MMG2D_freeLocalPar()

int MMG2D_freeLocalPar ( MMG5_pMesh  mesh)

Definition at line 691 of file libmmg2d_tools.c.

◆ MMG2D_Get_adjaTri()

int MMG2D_Get_adjaTri ( MMG5_pMesh  mesh,
MMG5_int  kel,
MMG5_int  listri[3] 
)

Return adjacent elements of a triangle.

Parameters
meshpointer to the mesh structure.
keltriangle index.
listripointer to the array of indices of the three adjacent triangles of the elt kel (the index is 0 if there is no adjacent).
Returns
1.

Find the indices of the 3 adjacent elements of triangle kel. \(v_i = 0\) if the \(i^{th}\) face has no adjacent element (so we are on a boundary face).

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_GET_ADJATRI(mesh,kel,listri,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
INTEGER, INTENT(IN) :: kel
INTEGER, DIMENSION(3), INTENT(OUT) :: listri
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 836 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_Get_adjaVertices()

MMG5_int MMG2D_Get_adjaVertices ( MMG5_pMesh  mesh,
MMG5_int  ip,
MMG5_int  lispoi[MMG2D_LMAX] 
)

Return adjacent vertices of a triangle.

Parameters
meshpointer to the mesh structure.
ipvertex index.
lispoipointer to an array of size MMG2D_LMAX that will contain the indices of adjacent vertices to the vertex ip.
Returns
nbpoi the number of adjacent vertices if success, 0 on failure.

Find the indices of the adjacent vertices of the vertex ip.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_GET_ADJAVERTICES(mesh,ip,lispoi,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
INTEGER(MMG5F_INT), INTENT(IN) :: ip
INTEGER(MMG5F_INT), DIMENSION(MMG2D_LMAX), INTENT(OUT) :: lispoi
INTEGER(MMG5F_INT), INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 850 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_Get_adjaVerticesFast()

MMG5_int MMG2D_Get_adjaVerticesFast ( MMG5_pMesh  mesh,
MMG5_int  ip,
MMG5_int  start,
MMG5_int  lispoi[MMG2D_LMAX] 
)

Return adjacent vertices of a triangle.

Parameters
meshpointer to the mesh structure.
ipvertex index.
startindex of a triangle holding ip.
lispoipointer to an array of size MMG2D_LMAX that will contain the indices of adjacent vertices to the vertex ip.
Returns
nbpoi the number of adjacent vertices if success, 0 on failure.

Find the indices of the adjacent vertices of the vertex ip of the triangle start.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_GET_ADJAVERTICESFAST(mesh,ip,start,lispoi,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
INTEGER(MMG5F_INT), INTENT(IN) :: ip,start
INTEGER(MMG5F_INT), DIMENSION(MMG2D_LMAX), INTENT(OUT) :: lispoi
INTEGER(MMG5F_INT), INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 862 of file libmmg2d_tools.c.

Here is the caller graph for this function:

◆ MMG2D_Get_nonBdyEdge()

int MMG2D_Get_nonBdyEdge ( MMG5_pMesh  mesh,
MMG5_int *  e0,
MMG5_int *  e1,
MMG5_int *  ref,
MMG5_int  idx 
)

Get vertices and reference of a non-boundary edge.

Parameters
meshpointer to the mesh structure.
e0pointer to the first extremity of the edge.
e1pointer to the second extremity of the edge.
refpointer to the edge reference.
idxindex of the non boundary edge to get (between 1 and nb_edges)
Returns
0 on failure, 1 otherwise.

This function returns the extremities e0, e1 and reference ref of the idx^th non boundary edge (for DG methods for example). An edge is boundary if it is located at the interface of 2 domains with different references, if it belongs to one triangle only or if it is a singular edge (ridge or required).

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_GET_NONBDYEDGE(mesh,e0,e1,ref,idx,retval)
MMG5_DATA_PTR_T,INTENT(INOUT) :: mesh
INTEGER(MMG5F_INT), INTENT(OUT):: e0,e1
INTEGER(MMG5F_INT) :: ref
INTEGER(MMG5F_INT), INTENT(IN) :: idx
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 792 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_Get_numberOfNonBdyEdges()

int MMG2D_Get_numberOfNonBdyEdges ( MMG5_pMesh  mesh,
MMG5_int *  nb_edges 
)

Get the number of non-boundary edges.

Parameters
meshpointer to the mesh structure.
nb_edgespointer to the number of non boundary edges.
Returns
0 on failure, 1 otherwise.

This function extracts the number of non boundary edges (for DG methods for example). An edge is boundary if it is located at the interface of two domains with different references, if it belongs to one triangle only or if it is a singular edge (ridge or required).

Append these edges to the list of edges.

Warning
reallocate the edge array and append the internal edges. This may modify the behaviour of other functions.
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_GET_NUMBEROFNONBDYEDGES(mesh,nb_edges,retval)
MMG5_DATA_PTR_T,INTENT(INOUT) :: mesh
INTEGER(MMG5F_INT), INTENT(OUT):: nb_edges
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 699 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_Get_triFromEdge()

int MMG2D_Get_triFromEdge ( MMG5_pMesh  mesh,
MMG5_int  ked,
MMG5_int *  ktri,
int *  ied 
)

Find a triangle given an adjacent triangle and an edge number.

Parameters
meshpointer to the mesh structure.
kedindex of the boundary edge.
ktripointer to the index of the tri (filled by the function).
iedpointer to the index of the edge of the triangle ktri that correspond to the boundary edge ked.
Returns
0 on failure, 1 otherwise

Fill ktri by the index of the triangle to which belong a boundary edge and ied by the index of the edge of the triangle that correspond to the edge.

Remarks
Fortran interface:

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

Definition at line 937 of file libmmg2d_tools.c.

Here is the caller graph for this function:

◆ MMG2D_Get_trisFromEdge()

int MMG2D_Get_trisFromEdge ( MMG5_pMesh  mesh,
MMG5_int  ked,
MMG5_int  ktri[2],
int  ied[2] 
)

Find two triangles given the edge that they share.

Parameters
meshpointer to the mesh structure.
kedindex of the boundary edge.
ktripointer to an array of size 2 to fill by the indices of the triangles that share the edge ked (filled by the function).
iedpointer to an array of size two to fill by the indices of the edge in each triangle.
Returns
0 on failure, 1 otherwise

Fill ktri by the indices of the triangles to which belong a boundary edge and ied by the indices of the matching edge in each triangle. If ked belongs to one triangle only, ktri[1] = ied[1] = 0.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_GET_TRISFROMEDGE(mesh,ked,ktri,ied,retval)
MMG5_DATA_PTR_T, INTENT(IN) :: mesh
INTEGER(MMG5F_INT), INTENT(IN) :: ked
INTEGER(MMG5F_INT), DIMENSION(2),INTENT(OUT) :: ktri
INTEGER, INTENT(OUT) :: retval,ied
END SUBROUTINE

Definition at line 956 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_parsar()

int MMG2D_parsar ( int  argc,
char *  argv[],
MMG5_pMesh  mesh,
MMG5_pSol  met,
MMG5_pSol  sol 
)

Store command line arguments.

Parameters
argcnumber of command line arguments.
argvcommand line arguments.
meshpointer to the mesh structure.
metpointer to a metric
solpointer to a level-set or displacement function
Returns
1 if we want to run Mmg after, 0 if not or in case of failure
Remarks
no matching fortran function.

check file names

Definition at line 102 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_parsop()

int MMG2D_parsop ( MMG5_pMesh  mesh,
MMG5_pSol  met 
)

Read a file containing Local parameters (.mmg2d extension)

Parameters
meshpointer to the mesh
metpointer to the metric
Returns
1 if success, 0 if fail

Read parameter file DEFAULT.mmg2d

Definition at line 548 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_Reset_verticestags()

void MMG2D_Reset_verticestags ( MMG5_pMesh  mesh)

Reset the vertex tags.

Parameters
meshpointer to the mesh structure

This function resets the tags of all vertices. Be careful: all the tags are deleted.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_RESET_VERTICESTAGS(mesh)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
END SUBROUTINE

Definition at line 1029 of file libmmg2d_tools.c.

Here is the caller graph for this function:

◆ MMG2D_Set_constantSize()

int MMG2D_Set_constantSize ( MMG5_pMesh  mesh,
MMG5_pSol  met 
)

Compute a constant size map according to the hsiz, hmin and hmax parameters.

Parameters
meshpointer to the mesh structure
metpointer to the sol structure
Returns
1 on success

This function computes a constant size map according to mesh->info.hsiz, mesh->info.hmin and mesh->info.hmax. It updates these 3 values if not compatible.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_SET_CONSTANTSIZE(mesh,met,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,met
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 997 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_setfunc()

void MMG2D_setfunc ( MMG5_pMesh  mesh,
MMG5_pSol  met 
)

Set function pointers for length, caltri... depending if case is iso or aniso.

Parameters
meshpointer to the mesh structure.
metpointer to a sol structure.
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_SETFUNC(mesh,met)
MMG5_DATA_PTR_T, INTENT(IN) :: mesh,met
END SUBROUTINE

Definition at line 38 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG2D_usage()

int MMG2D_usage ( char *  prog)

Print help for mmg2d options.

Parameters
progpointer to the program name.
return1 on success, 0 on failure.
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_USAGE(prog,strlen0,retval)
CHARACTER(LEN=*), INTENT(IN) :: prog
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 68 of file libmmg2d_tools.c.

Here is the call graph for this function:
Here is the caller graph for this function: