Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Macros | Functions | Variables
hash_3d.c File Reference

Functions for hash tables management and tetrahedra packing. More...

#include "libmmg3d.h"
#include "libmmg3d_private.h"
Include dependency graph for hash_3d.c:

Go to the source code of this file.

Macros

#define MMG5_KC   13
 

Functions

int MMG5_paktet (MMG5_pMesh mesh)
 
MMG5_int MMG5_hashGetFace (MMG5_Hash *hash, MMG5_int ia, MMG5_int ib, MMG5_int ic)
 
int MMG3D_hashTetra (MMG5_pMesh mesh, int pack)
 Create array of adjacency.
 
int MMG3D_hashPrism (MMG5_pMesh mesh)
 
static int MMG5_setEdgeNmTag (MMG5_pMesh mesh, MMG5_Hash *hash)
 
static uint16_t MMG5_skip_ParBdy (uint16_t tag)
 
int MMG5_setVertexNmTag (MMG5_pMesh mesh, uint16_t func(uint16_t))
 
int MMG5_setNmTag (MMG5_pMesh mesh, MMG5_Hash *hash)
 
int MMG3D_hashTria (MMG5_pMesh mesh, MMG5_Hash *hash)
 
int MMG5_hashPop (MMG5_Hash *hash, MMG5_int a, MMG5_int b)
 
int MMG5_hTag (MMG5_HGeom *hash, MMG5_int a, MMG5_int b, MMG5_int ref, uint16_t tag)
 
int MMG5_hPop (MMG5_HGeom *hash, MMG5_int a, MMG5_int b, MMG5_int *ref, uint16_t *tag)
 
int MMG5_hGet (MMG5_HGeom *hash, MMG5_int a, MMG5_int b, MMG5_int *ref, uint16_t *tag)
 
int MMG5_hEdge (MMG5_pMesh mesh, MMG5_HGeom *hash, MMG5_int a, MMG5_int b, MMG5_int ref, uint16_t tag)
 
int MMG5_hNew (MMG5_pMesh mesh, MMG5_HGeom *hash, MMG5_int hsiz, MMG5_int hmax)
 
int MMG5_hGeom (MMG5_pMesh mesh)
 
static int MMG5_bdryTria (MMG5_pMesh mesh, MMG5_int ntmesh)
 
int MMG5_chkBdryTria (MMG5_pMesh mesh)
 
int MMG5_chkBdryTria_countBoundaries (MMG5_pMesh mesh, MMG5_int *ntmesh, MMG5_int *ntpres)
 
int MMG5_chkBdryTria_hashBoundaries (MMG5_pMesh mesh, MMG5_int ntmesh, MMG5_Hash *hashElt)
 
int MMG5_chkBdryTria_flagExtraTriangles (MMG5_pMesh mesh, MMG5_int *ntpres, MMG5_Hash *hashElt)
 
int MMG5_chkBdryTria_deleteExtraTriangles (MMG5_pMesh mesh, MMG5_int *permtria)
 
int MMG5_chkBdryTria_addMissingTriangles (MMG5_pMesh mesh, MMG5_int ntmesh, MMG5_int ntpres)
 
int MMG5_bdrySet (MMG5_pMesh mesh)
 
int MMG5_bdryUpdate (MMG5_pMesh mesh)
 
int MMG5_bdryPerm (MMG5_pMesh mesh)
 

Variables

int8_t ddb
 

Detailed Description

Functions for hash tables management and tetrahedra packing.

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

Definition in file hash_3d.c.

Macro Definition Documentation

◆ MMG5_KC

#define MMG5_KC   13

Definition at line 38 of file hash_3d.c.

Function Documentation

◆ MMG3D_hashPrism()

int MMG3D_hashPrism ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 otherwise.

Create partial table of adjacency for prisms (prism \( <-> \) prism).

Remarks
Adjacencies between prisms and tetra are not filled here.
Warning
check the efficiency of the hash table

Definition at line 240 of file hash_3d.c.

Here is the caller graph for this function:

◆ MMG3D_hashTetra()

int MMG3D_hashTetra ( MMG5_pMesh  mesh,
int  pack 
)

Create array of adjacency.

Parameters
meshpointer to the mesh structure.
packwe pack the mesh at function begining if \(pack=1\).
Returns
0 if failed, 1 otherwise.

Create table of adjacency. Set pack variable to 0 for a compact mesh and to 1 for a mesh that need to be packed.

Definition at line 122 of file hash_3d.c.

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

◆ MMG3D_hashTria()

int MMG3D_hashTria ( MMG5_pMesh  mesh,
MMG5_Hash hash 
)
Parameters
meshpointer to the mesh structure.
hashEdges hash table.
Returns
1 if success, 0 if failed.

Create surface adjacency table. Allocate the edge hash table hash but don't free it.

Definition at line 838 of file hash_3d.c.

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

◆ MMG5_bdryPerm()

int MMG5_bdryPerm ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 otherwise.

Make orientation of triangles compatible with tetra faces for external tria and with domain of max ref for interface tria.

Definition at line 2385 of file hash_3d.c.

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

◆ MMG5_bdrySet()

int MMG5_bdrySet ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 if success.

Set the triangles references to the tetrahedra faces and edges.

Definition at line 1958 of file hash_3d.c.

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

◆ MMG5_bdryTria()

static int MMG5_bdryTria ( MMG5_pMesh  mesh,
MMG5_int  ntmesh 
)
inlinestatic
Parameters
meshpointer to the mesh structure.
ntmeshnumber of boundary tria found in the mesh.
Returns
0 if failed, 1 otherwise.

Fill tria array with missing triangles:

  • if called from the first time, xtetra is not allocated so missing triangles may be founded at domains interface or external boundary.
  • Otherwise, the tria array is reconstructed from the xtetra infos.
Remarks
mesh->xtetra is not allocated when MMG5_bdryTria is called by MMG3D_analys in mesh adp mode but it is allocated when called by packMesh or by analys in ls discretization mode.

Definition at line 1266 of file hash_3d.c.

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

◆ MMG5_bdryUpdate()

int MMG5_bdryUpdate ( MMG5_pMesh  mesh)
Parameters
mesh
Returns
1 if successful, 0 if not.

Update tag and refs of tetra edges. If tetra is required, set the faces/edges to required.

Remarks
While remeshing:
  • A tetra with a boundary face has a xtetra:
    • a boundary edge has consistent tags as soon as it has a non 0 tag; #warning check this case
    • some boundary edges may have a 0 tag
  • a tetra with a boundary edge but no bdy faces may or may not have a xtetra and boundary edges may have or may not have tags so we can't guess nothing with such xtetra.

Definition at line 2294 of file hash_3d.c.

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

◆ MMG5_chkBdryTria()

int MMG5_chkBdryTria ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
1 if success, 0 otherwise.
  • Remove double triangles from tria array.
  • Remove triangles that do not belong to a boundary (non opnbdy mode) from tria array.
  • Check the matching between actual and given number of faces in the mesh: Count the number of faces in mesh and compare this number to the number of given triangles.
  • If the founded number exceed the given one, add the missing boundary triangles (call to MMG5_bdryTria). Do nothing otherwise.
  • Fill the adjacency relationship between prisms and tetra (fill adjapr with a negative value to mark this special faces).
  • Set to required the triangles at interface betwen prisms and tet.

Step 1: scan the mesh and count the boundaries

Step 2: detect the extra boundaries (that will be ignored) provided by the user

Step 3: add the missing boundary triangles or, if the mesh contains prisms, set to required the triangles at interface betwen prisms and tet

Definition at line 1559 of file hash_3d.c.

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

◆ MMG5_chkBdryTria_addMissingTriangles()

int MMG5_chkBdryTria_addMissingTriangles ( MMG5_pMesh  mesh,
MMG5_int  ntmesh,
MMG5_int  ntpres 
)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 if success.

Step 3 of MMG5_chkBdryTria : add the missing boundary triangles or, if the mesh contains prisms, set to required the triangles at interface betwen prisms and tet

Definition at line 1910 of file hash_3d.c.

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

◆ MMG5_chkBdryTria_countBoundaries()

int MMG5_chkBdryTria_countBoundaries ( MMG5_pMesh  mesh,
MMG5_int *  ntmesh,
MMG5_int *  ntpres 
)
Parameters
meshpointer to the mesh structure.
ntmeshnumber of boundary triangles in the mesh.
ntpresnumber of preserved boundaries in the mesh.
Returns
0 if failed, 1 if success.

Step 1 of MMG5_chkBdryTria : scan the mesh and count the boundaries

Definition at line 1595 of file hash_3d.c.

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

◆ MMG5_chkBdryTria_deleteExtraTriangles()

int MMG5_chkBdryTria_deleteExtraTriangles ( MMG5_pMesh  mesh,
MMG5_int *  permtria 
)

Definition at line 1870 of file hash_3d.c.

Here is the caller graph for this function:

◆ MMG5_chkBdryTria_flagExtraTriangles()

int MMG5_chkBdryTria_flagExtraTriangles ( MMG5_pMesh  mesh,
MMG5_int *  ntpres,
MMG5_Hash hashElt 
)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 if success.

Step 2.5 of MMG5_chkBdryTria : Travel through the tria, delete those that are not in the hash tab or that are stored more that once.

Definition at line 1813 of file hash_3d.c.

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

◆ MMG5_chkBdryTria_hashBoundaries()

int MMG5_chkBdryTria_hashBoundaries ( MMG5_pMesh  mesh,
MMG5_int  ntmesh,
MMG5_Hash hashElt 
)
Parameters
meshpointer to the mesh structure.
ntmeshnumber of boundary triangles in the mesh.
hashEltpointer towards face hash table.
Returns
0 if failed, 1 if success.

Step 2 of MMG5_chkBdryTria : create hash tables of boundaries in the mesh

Definition at line 1729 of file hash_3d.c.

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

◆ MMG5_hashGetFace()

MMG5_int MMG5_hashGetFace ( MMG5_Hash hash,
MMG5_int  ia,
MMG5_int  ib,
MMG5_int  ic 
)

return index of triangle ia ib ic

Definition at line 84 of file hash_3d.c.

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

◆ MMG5_hashPop()

int MMG5_hashPop ( MMG5_Hash hash,
MMG5_int  a,
MMG5_int  b 
)

remove edge from hash table

Definition at line 850 of file hash_3d.c.

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

◆ MMG5_hEdge()

int MMG5_hEdge ( MMG5_pMesh  mesh,
MMG5_HGeom hash,
MMG5_int  a,
MMG5_int  b,
MMG5_int  ref,
uint16_t  tag 
)

store edge on geometry

Definition at line 1040 of file hash_3d.c.

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

◆ MMG5_hGeom()

int MMG5_hGeom ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 otherwise

Build hash table for initial mesh edges.

Definition at line 1111 of file hash_3d.c.

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

◆ MMG5_hGet()

int MMG5_hGet ( MMG5_HGeom hash,
MMG5_int  a,
MMG5_int  b,
MMG5_int *  ref,
uint16_t *  tag 
)

get ref and tag to edge on geometry

Definition at line 1007 of file hash_3d.c.

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

◆ MMG5_hNew()

int MMG5_hNew ( MMG5_pMesh  mesh,
MMG5_HGeom hash,
MMG5_int  hsiz,
MMG5_int  hmax 
)

to store edge on geometry

Definition at line 1083 of file hash_3d.c.

Here is the caller graph for this function:

◆ MMG5_hPop()

int MMG5_hPop ( MMG5_HGeom hash,
MMG5_int  a,
MMG5_int  b,
MMG5_int *  ref,
uint16_t *  tag 
)

remove edge from hash table

Definition at line 947 of file hash_3d.c.

Here is the call graph for this function:

◆ MMG5_hTag()

int MMG5_hTag ( MMG5_HGeom hash,
MMG5_int  a,
MMG5_int  b,
MMG5_int  ref,
uint16_t  tag 
)
Parameters
hashpointer to the hash table in which edges are stored
afirst edge extremity
bsecond edge extremity
refreference to assign to the edge
tagtag to assign
Returns
0 if the edge is not in the hash table, 1 otherwise

set tag to edge on geometry

Definition at line 914 of file hash_3d.c.

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

◆ MMG5_paktet()

int MMG5_paktet ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
1 if success, 0 if fail

tetra packing.

Definition at line 50 of file hash_3d.c.

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

◆ MMG5_setEdgeNmTag()

static int MMG5_setEdgeNmTag ( MMG5_pMesh  mesh,
MMG5_Hash hash 
)
inlinestatic
Parameters
meshpointer towar the mesh structure.
hashedges hash table.
Returns
1 if success, 0 if failed.

Set non-manifold tag at extremities of a non-manifold edge. Check if a non-manifold edge is at the interface of several distinct domains (thus we can't travel from a domain through another one by adjacency) and in this case, mark the edge and its extremities as required. Free the edge hash table hash if success.

Warning
if fail, the edge hash table hash is not freed.

Definition at line 460 of file hash_3d.c.

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

◆ MMG5_setNmTag()

int MMG5_setNmTag ( MMG5_pMesh  mesh,
MMG5_Hash hash 
)
Parameters
meshpointer towar the mesh structure.
hashedges hash table.
Returns
1 if success, 0 if failed.

Set tags to non-manifold edges and vertices. Not done before because we need the MMG5_xTetra table.

Warning
if fail, the edge hash table hash is not freed.

Definition at line 816 of file hash_3d.c.

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

◆ MMG5_setVertexNmTag()

int MMG5_setVertexNmTag ( MMG5_pMesh  mesh,
uint16_t   funcuint16_t 
)
Parameters
meshpointer to the mesh structure.
Returns
1 if success, 0 if fail. Seek the non-required non-manifold points and try to analyse whether they are corner or required.
Remarks
We don't know how to travel through the shell of a non-manifold point by triangle adjacency. Thus the work done here can't be performed in the MMG5_singul function.
a temporary array tmp is used instead of the tmp field of the points to not break the ParMmg distributed analysis in which this field is used to store the global numbering of nodes.

Seek the non-required non-manifold points and try to analyse whether they are corner or required.

Step 1: count the number or feature edges passing through each points

Step 2: add suitable point tags depending on the counted feature edges

Definition at line 637 of file hash_3d.c.

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

◆ MMG5_skip_ParBdy()

static uint16_t MMG5_skip_ParBdy ( uint16_t  tag)
inlinestatic

Definition at line 618 of file hash_3d.c.

Here is the caller graph for this function:

Variable Documentation

◆ ddb

int8_t ddb
extern

Definition at line 42 of file mmg3d1_delone.c.