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

Various tools for the mmg libraries. More...

#include "mmgcommon_private.h"
Include dependency graph for tools.c:

Go to the source code of this file.

Functions

void MMG5_nsort (int8_t n, double *val, int8_t *perm)
 
void MMG5_nperm (int8_t n, int8_t shift, int8_t stride, double *val, double *oldval, int8_t *perm)
 
int MMG5_devangle (double *n1, double *n2, double crit)
 
int MMG5_nonUnitNorPts (MMG5_pMesh mesh, MMG5_int ip1, MMG5_int ip2, MMG5_int ip3, double *n)
 
double MMG5_nonorsurf (MMG5_pMesh mesh, MMG5_pTria pt)
 
int MMG5_norpts (MMG5_pMesh mesh, MMG5_int ip1, MMG5_int ip2, MMG5_int ip3, double *n)
 
int MMG5_nortri (MMG5_pMesh mesh, MMG5_pTria pt, double *n)
 
void MMG5_transpose3d (double m[3][3])
 
int MMG5_test_transpose3d ()
 
void MMG5_dotprod (int8_t dim, double *a, double *b, double *result)
 
int MMG5_test_dotprod ()
 
void MMG5_crossprod3d (double *a, double *b, double *result)
 
int MMG5_test_crossprod3d ()
 
void MMG5_mn (double m[6], double n[6], double mn[9])
 
int MMG5_test_mn ()
 
int MMG5_rmtr (double r[3][3], double m[6], double mr[6])
 
int MMG5_test_rmtr ()
 
int MMG5_rotmatrix (double n[3], double r[3][3])
 
int MMG5_test_rotmatrix ()
 
int MMG5_invmat (double *m, double *mi)
 
int MMG5_invmatg (double m[9], double mi[9])
 
int MMG5_invmat33 (double m[3][3], double mi[3][3])
 
int MMG5_invmat22 (double m[2][2], double mi[2][2])
 
int MMG5_sys33sym (double a[6], double b[3], double r[3])
 
void MMG5_printTria (MMG5_pMesh mesh, char *fileName)
 
size_t MMG5_memSize (void)
 
void MMG5_memOption_memSet (MMG5_pMesh mesh)
 
double MMG5_det3pt1vec (double c0[3], double c1[3], double c2[3], double v[3])
 
double MMG5_det4pt (double c0[3], double c1[3], double c2[3], double c3[3])
 
double MMG5_orvol (MMG5_pPoint point, MMG5_int *v)
 
double MMG2D_quickarea (double a[2], double b[2], double c[2])
 
void MMG5_mark_verticesAsUnused (MMG5_pMesh mesh)
 
void MMG5_mark_usedVertices (MMG5_pMesh mesh, void(*delPt)(MMG5_pMesh, MMG5_int))
 
void MMG5_keep_subdomainElts (MMG5_pMesh mesh, int nsd, int(*delElt)(MMG5_pMesh, MMG5_int))
 
double MMG5_test_mat_error (int8_t nelem, double m1[], double m2[])
 
int MMG5_test_invmat22 ()
 
int MMG5_test_invmat33 ()
 

Detailed Description

Various tools for the mmg libraries.

Author
Charles Dapogny (UPMC)
Cécile Dobrzynski (Bx INP/Inria/UBordeaux)
Pascal Frey (UPMC)
Algiane Froehly (Inria/UBordeaux)
Version
5
Todo:
doxygen documentation.

Definition in file tools.c.

Function Documentation

◆ MMG2D_quickarea()

double MMG2D_quickarea ( double  a[2],
double  b[2],
double  c[2] 
)
Parameters
apoint coordinates
bpoint coor
cpoint coor

Compute tria area.

Definition at line 971 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_crossprod3d()

void MMG5_crossprod3d ( double *  a,
double *  b,
double *  result 
)
Parameters
afirst array
bsecond array
resultcross product of the two arrays

Compute cross product of two double precision arrays in 3D.

Definition at line 300 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_det3pt1vec()

double MMG5_det3pt1vec ( double  c0[3],
double  c1[3],
double  c2[3],
double  v[3] 
)
inline

Compute 3 * 3 determinant : det(c1-c0,c2-c0,v)

Definition at line 920 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_det4pt()

double MMG5_det4pt ( double  c0[3],
double  c1[3],
double  c2[3],
double  c3[3] 
)
inline

Compute 3 * 3 determinant : det(c1-c0,c2-c0,c3-c0)

Definition at line 932 of file tools.c.

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

◆ MMG5_devangle()

int MMG5_devangle ( double *  n1,
double *  n2,
double  crit 
)
Parameters
n1first normal
n2second normal
critridge threshold
Returns
1 if success, 0 if fail

Check if the angle between n1 and n2 is larger than the ridge criterion. If yes, return 1, 0 otherwise (ridge creation).

Definition at line 103 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_dotprod()

void MMG5_dotprod ( int8_t  dim,
double *  a,
double *  b,
double *  result 
)
Parameters
dimsize of the array
afirst array
bsecond array
resultscalar product of the two arrays

Compute scalar product of two double precision arrays.

Definition at line 265 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_invmat()

int MMG5_invmat ( double *  m,
double *  mi 
)
Parameters
mpointer toward a 3x3 symetric matrix
mipointer toward the computed 3x3 matrix.

Invert m (3x3 symetric matrix) and store the result on mi

Definition at line 562 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_invmat22()

int MMG5_invmat22 ( double  m[2][2],
double  mi[2][2] 
)
Parameters
minitial matrix.
miinverted matrix.

Invert 2x2 non-symmetric matrix stored in 2 dimensions

Definition at line 745 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_invmat33()

int MMG5_invmat33 ( double  m[3][3],
double  mi[3][3] 
)
Parameters
minitial matrix.
miinverted matrix.

Invert 3x3 non-symmetric matrix stored in 2 dimensions

Definition at line 653 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_invmatg()

int MMG5_invmatg ( double  m[9],
double  mi[9] 
)
Parameters
minitial matrix.
miinverted matrix.

Invert 3x3 non-symmetric matrix.

Definition at line 613 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_keep_subdomainElts()

void MMG5_keep_subdomainElts ( MMG5_pMesh  mesh,
int  nsd,
int(*)(MMG5_pMesh, MMG5_int)  delElt 
)
Parameters
meshpointer toward the mesh structure.
nsdsubdomain index.
delEltfunction to call to delete elt.

Remove triangles that do not belong to subdomain of index nsd

Definition at line 1072 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_mark_usedVertices()

void MMG5_mark_usedVertices ( MMG5_pMesh  mesh,
void(*)(MMG5_pMesh, MMG5_int)  delPt 
)
Parameters
meshpointer toward the mesh structure.
delPtfunction to call to delete point.

Mark the mesh vertices that belong to triangles or quadrangles as used (for Mmgs or Mmg2d).

Definition at line 1018 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_mark_verticesAsUnused()

void MMG5_mark_verticesAsUnused ( MMG5_pMesh  mesh)
Parameters
meshpointer toward the mesh structure.

Mark all mesh vertices as unused.

Definition at line 994 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_memOption_memSet()

void MMG5_memOption_memSet ( MMG5_pMesh  mesh)
Parameters
meshpointer toward the mesh structure

Set the memMax value to its "true" value if memory asked by user. Here the MMG5_MEMPERCENT coef is already applied on memMax.

Definition at line 891 of file tools.c.

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

◆ MMG5_memSize()

size_t MMG5_memSize ( void  )
Returns
the available memory size of the computer.

Compute the available memory size of the computer.

Definition at line 852 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_mn()

void MMG5_mn ( double  m[6],
double  n[6],
double  mn[9] 
)
Parameters
msymmetric matrix
nsymmetric matrix
mnresult

Compute product m*n (mn stored by rows for consistency with MMG5_eigenv3d).

Definition at line 337 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_nonorsurf()

double MMG5_nonorsurf ( MMG5_pMesh  mesh,
MMG5_pTria  pt 
)
inline
Parameters
meshpointer toward the mesh stucture.
pttriangle for which we compute the surface.
Returns
the computed surface

Compute non-oriented surface area of a triangle.

Definition at line 160 of file tools.c.

Here is the call graph for this function:

◆ MMG5_nonUnitNorPts()

int MMG5_nonUnitNorPts ( MMG5_pMesh  mesh,
MMG5_int  ip1,
MMG5_int  ip2,
MMG5_int  ip3,
double *  n 
)
inline
Parameters
meshpointer toward the mesh stucture.
ip1first point of face.
ip2second point of face.
ip3third point of face.
npointer to store the computed normal.
Returns
1

Compute non-normalized face normal given three points on the surface.

Definition at line 127 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_norpts()

int MMG5_norpts ( MMG5_pMesh  mesh,
MMG5_int  ip1,
MMG5_int  ip2,
MMG5_int  ip3,
double *  n 
)
inline
Parameters
meshpointer toward the mesh stucture.
ip1first point of face.
ip2second point of face.
ip3third point of face.
npointer to store the computed normal.
Returns
1 if success, 0 otherwise.

Compute normalized face normal given three points on the surface.

Definition at line 183 of file tools.c.

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

◆ MMG5_nortri()

int MMG5_nortri ( MMG5_pMesh  mesh,
MMG5_pTria  pt,
double *  n 
)
inline
Parameters
meshpointer toward the mesh stucture.
ptpointer toward the triangle structure.
npointer to store the computed normal.
Returns
1

Compute triangle normal.

Definition at line 209 of file tools.c.

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

◆ MMG5_nperm()

void MMG5_nperm ( int8_t  n,
int8_t  shift,
int8_t  stride,
double *  val,
double *  oldval,
int8_t *  perm 
)
inline
Parameters
narray size
shiftshift to apply when taking array value
stridestride to apply when taking array value
valarray of double precision floating points
oldvalarray to store input values
permpermutation array

Naively permute a small array. Use shift and stride to eventually permute matrix columns.

Remarks
to use only on very small arrays such as metric tensors (size lower than int8_max).

Definition at line 80 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_nsort()

void MMG5_nsort ( int8_t  n,
double *  val,
int8_t *  perm 
)
inline
Parameters
narray size
valarray of double precision floating points
permpermutation array

naive (increasing) sorting algorithm, for very small tabs ; permutation is stored in perm

Remarks
to use only on very small arrays such as metric tensors (size lower than int8_max).

Definition at line 49 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_orvol()

double MMG5_orvol ( MMG5_pPoint  point,
MMG5_int *  v 
)
inline
Parameters
pointPointer toward the points array
vpointer toward the point indices
Returns
the oriented volume of tetra

Compute oriented volume of a tetrahedron (x6)

Definition at line 951 of file tools.c.

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

◆ MMG5_printTria()

void MMG5_printTria ( MMG5_pMesh  mesh,
char *  fileName 
)
Parameters
meshpointer toward the mesh structure.
fileNamepointer toward the file name.

Debug function (not use in clean code): write mesh->tria structure in file.

Definition at line 825 of file tools.c.

◆ MMG5_rmtr()

int MMG5_rmtr ( double  r[3][3],
double  m[6],
double  mr[6] 
)
inline
Parameters
r3x3 matrix
msymetric matrix
mrresult
Returns
1

Compute product R*M*tR when M is symmetric

Definition at line 405 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_rotmatrix()

int MMG5_rotmatrix ( double  n[3],
double  r[3][3] 
)
inline
Parameters
npointer toward the vector that we want to send on the third vector of canonical basis.
rcomputed rotation matrix.

Compute rotation matrix that sends vector n to the third vector of canonical basis.

Definition at line 467 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_sys33sym()

int MMG5_sys33sym ( double  a[6],
double  b[3],
double  r[3] 
)
inline
Parameters
amatrix to invert.
blast member.
rvector of unknowns.
Returns
0 if fail, 1 otherwise.

Solve $ 3\times 3$ symmetric system $ A . r = b $.

Definition at line 769 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_test_crossprod3d()

int MMG5_test_crossprod3d ( )
Returns
1 if success, 0 if fail.

Test vector cross product.

Definition at line 311 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_dotprod()

int MMG5_test_dotprod ( )
Returns
1 if success, 0 if fail.

Test vector scalar product.

Definition at line 276 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_invmat22()

int MMG5_test_invmat22 ( )

Test inversion of 2x2 non-symmetric matrix stored in 2 dimensions.

Definition at line 1140 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_invmat33()

int MMG5_test_invmat33 ( )

Test inversion of 3x3 non-symmetric matrix stored in 2 dimensions.

Definition at line 1165 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_mat_error()

double MMG5_test_mat_error ( int8_t  nelem,
double  m1[],
double  m2[] 
)
inline
Parameters
nelemnumber of matrix elements.
m1first matrix (single array).
m2second matrix (single array).

Compute maximum error between two matrices.

Definition at line 1123 of file tools.c.

Here is the caller graph for this function:

◆ MMG5_test_mn()

int MMG5_test_mn ( )

Test product of 3x3 symmetric matrices.

Compute product m*n

Compute product n*m

Definition at line 357 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_rmtr()

int MMG5_test_rmtr ( )
inline

Test computation of product R*M*tR when M is symmetric

Compute transformation

Definition at line 435 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_rotmatrix()

int MMG5_test_rotmatrix ( )

Test computation of the rotation matrix that sends vector n to the third vector of canonical basis.

Rodrigues' rotation formula (transposed to give a map from n to [0,0,1]). Input vector must be a unit vector.

Approximate z-unit vector

Check orthonormality

Definition at line 512 of file tools.c.

Here is the call graph for this function:

◆ MMG5_test_transpose3d()

int MMG5_test_transpose3d ( )
Returns
1 if success, 0 if fail.

Test the transposition of a 3x3 matrix.

Definition at line 236 of file tools.c.

Here is the call graph for this function:

◆ MMG5_transpose3d()

void MMG5_transpose3d ( double  m[3][3])
Parameters
mmatrix (stored as double array)

Transpose a square matrix in 3D, stored as double array.

Definition at line 220 of file tools.c.

Here is the caller graph for this function: