mmg2d
mmg2.c File Reference
#include "mmgcommon.h"
Include dependency graph for mmg2.c:

Functions

static int MMG5_InvMat_key (MMG5_pInvMat pim, int ref)
 
static void MMG5_InvMat_set (MMG5_pMesh mesh, MMG5_pInvMat pim, int k)
 
static int MMG5_InvMat_getIndex (MMG5_pInvMat pim, int ref)
 
static int MMG5_InvMat_getAttrib (MMG5_pInvMat pim, int ref)
 
static int MMG5_InvMat_getParent (MMG5_pMesh mesh, MMG5_pInvMat pim, int ref, int *pref)
 
int MMG5_getStartRef (MMG5_pMesh mesh, int ref, int *pref)
 
static void MMG5_InvMat_print (MMG5_pMesh mesh, MMG5_pInvMat pim)
 
int MMG5_MultiMat_init (MMG5_pMesh mesh)
 
int MMG5_isSplit (MMG5_pMesh mesh, int ref, int *refint, int *refext)
 
int MMG5_isNotSplit (MMG5_pMesh mesh, int ref)
 
int MMG5_isLevelSet (MMG5_pMesh mesh, int ref0, int ref1)
 

Function Documentation

◆ MMG5_getStartRef()

int MMG5_getStartRef ( MMG5_pMesh  mesh,
int  ref,
int *  pref 
)
Parameters
meshpointer toward the mesh
reffinal reference for which we are searching the initial one
prefpointer to the reference of the parent material.
Returns
1 if found, 0 otherwise.

Retrieve the starting domain reference (parent material) associated to the split reference ref. Allow the call in non-multimaterial mode.

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

◆ MMG5_InvMat_getAttrib()

static int MMG5_InvMat_getAttrib ( MMG5_pInvMat  pim,
int  ref 
)
static
Parameters
meshpointer toward the mesh structure.
pimmultimaterials inverse data table.
refmaterial reference.
Returns
the nosplit/split/plus/minus attribute of the material.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG5_InvMat_getIndex()

static int MMG5_InvMat_getIndex ( MMG5_pInvMat  pim,
int  ref 
)
static
Parameters
pimmultimaterials inverse data table.
refmaterial reference.
Returns
Index of the material.

Get index of the material from lookup table.

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

◆ MMG5_InvMat_getParent()

static int MMG5_InvMat_getParent ( MMG5_pMesh  mesh,
MMG5_pInvMat  pim,
int  ref,
int *  pref 
)
static
Parameters
meshpointer toward the mesh structure.
pimmultimaterials inverse data table.
refmaterial reference.
prefpointer to the parent material reference.
Returns
1 if found, 0 if not found.

Get reference of the parent material in multimaterial mode.

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

◆ MMG5_InvMat_key()

static int MMG5_InvMat_key ( MMG5_pInvMat  pim,
int  ref 
)
static
Parameters
pimmultimaterials inverse data table.
refmaterial reference.
Returns
the key of the material in the lookup/hash table.

Compute key for the material in the hash table.

Here is the caller graph for this function:

◆ MMG5_InvMat_print()

static void MMG5_InvMat_print ( MMG5_pMesh  mesh,
MMG5_pInvMat  pim 
)
static
Parameters
meshpointer toward the mesh structure.
pimmultimaterials inverse data table.

Print materials lookup table.

Here is the call graph for this function:

◆ MMG5_InvMat_set()

static void MMG5_InvMat_set ( MMG5_pMesh  mesh,
MMG5_pInvMat  pim,
int  k 
)
static
Parameters
meshpointer toward the mesh structure.
pimmultimaterials inverse data table.
kindex of the material in the input table.

Set materials lookup table entry.

Store the dosplit attribute of the parent material

Store the child material sign with the parent material index (in the lookup table). 1) 0 is a legit material index, so store the parent as 4*(k+1). 2) If a child material has the same reference as the parent, this effectively overwrites the result of the previous instruction. 3) No different child materials are allowed to have the same reference, and this must have already been checked.

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

◆ MMG5_isLevelSet()

int MMG5_isLevelSet ( MMG5_pMesh  mesh,
int  ref0,
int  ref1 
)
Parameters
meshpointer toward the mesh structure.
ref0reference of the first tetrahedron sharing the face.
ref1reference of the second tetrahedron sharing the face..
Returns
1 if face is on the discrete level set, 0 if not.

Identify whether a face is on the discrete level set or not.

Here is the call graph for this function:

◆ MMG5_isNotSplit()

int MMG5_isNotSplit ( MMG5_pMesh  mesh,
int  ref 
)
Parameters
meshpointer toward the mesh structure.
refinitial reference.
Returns
1 if entity cannot be split, 0 if can be split.

Identify whether an entity with reference ref should not be split.

Here is the call graph for this function:

◆ MMG5_isSplit()

int MMG5_isSplit ( MMG5_pMesh  mesh,
int  ref,
int *  refint,
int *  refext 
)
Parameters
meshpointer toward the mesh structure.
refinitial reference.
refintinternal reference after ls discretization.
refintinternal reference after ls discretization.
Returns
1 if entity can be splitted, 0 if cannot be splitted.

Identify whether an entity with reference ref should be split, and the labels of the resulting entities.

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

◆ MMG5_MultiMat_init()

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

Initialize handling of multimaterial mode.

An indexed table of materials has been provided by the MMG5_Mat datatype in the form:

index | dospl | ref | rin | rex

0 | dospl_0 | ref_0 | rin_0 | rex_0 ... | ... | ... | ... | k | dospl_k | ref_k | rin_k | rex_k ... | ... | ... | ... | n-1 | dospl_{n-1} | ref_{n-1} | rin_{n-1} | rex_{n-1}

where dospl is the split/preserve attribute of the material, and rin,rex are its child materials (if dospl). Viceversa, ref is the parent material for rin,rex.

Here a lookup table for material references is built through trivial hashing for all references (both parent and child materials) with the key:

key = ref - ref_min, ref_min = min_{k = 0,n-1} (ref_k, rin_k, rex_k)

For all references, it is important to store

  • the index k of the row in the original table,
  • the characteristic attribute (parent-split, parent-preserve, child-interior, child-exterior) of the material.

Since dospl = 0 or 1, MG_PLUS = 2, and MG_MINUS = 3

we can store the attribute as dospl (for the parent material) or MG_MINUS/ MG_PLUS (for the child materials), with its value ranging between 0 and 3.

A convenient entry to store both the index and the attribute in the lookup table is thus:

entry = 4*(index+1) + attribute

leading to a lookup table in the form (the key ordering is only an example):

key | entry

... | ... ref_k | 4*(k+1)+dospl_k ... | ... rin_k | 4*(k+1)+MG_MINUS ... | ... rex_k | 4*(k+1)+MG_PLUS ... | ...

where the index and the attribute of the material can be retrieved as

index = entry / 4 -1 attribute = entry % 4

What if two materials have the same reference?

  • child references should be distinct (the entry in the lookup table would be overwritten),
  • a parent material can have itself as child (a positive attribute would say it should be split, the attribute value would say if it is interior or exterior). Thus, each of the maps parent->child_in and parent->child_ext is injective, but a fixed point is allowed.

Why child materials should be different?

  • because on failure it is necessary to recover the parent references and apply them on the tetrahedra to restore the starting materials distribution.
Here is the call graph for this function:
Here is the caller graph for this function: