Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Functions
PRoctree_3d.c File Reference
#include "libmmgtypes.h"
#include "mmgcommon_private.h"
#include "PRoctree_3d_private.h"
#include <stdio.h>
Include dependency graph for PRoctree_3d.c:

Go to the source code of this file.

Functions

void MMG3D_initPROctree_s (MMG3D_PROctree_s *q)
 
int MMG3D_initPROctree (MMG5_pMesh mesh, MMG3D_pPROctree *q, int nv)
 
void MMG3D_freePROctree_s (MMG5_pMesh mesh, MMG3D_PROctree_s *q, int nv)
 
void MMG3D_freePROctree (MMG5_pMesh mesh, MMG3D_pPROctree *q)
 
int64_t MMG3D_getPROctreeCoordinate (MMG3D_pPROctree q, double *ver, int dim)
 
int MMG3D_movePROctree (MMG5_pMesh mesh, MMG3D_pPROctree q, MMG5_int no, double *newVer, double *oldVer)
 
int MMG3D_isCellIncluded (double *cellCenter, double l, double *zoneCenter, double l0)
 
void MMG3D_placeInListDouble (double *distList, double dist, int index, int size)
 
void MMG3D_placeInListPROctree (MMG3D_PROctree_s **qlist, MMG3D_PROctree_s *q, int index, int size)
 
int MMG3D_seekIndex (double *distList, double dist, int indexMin, int indexMax)
 
int MMG3D_intersectRect (double *rectin, double *rectinout)
 
int MMG3D_getListSquareRec (MMG3D_PROctree_s *q, double *center, double *rect, MMG3D_PROctree_s ***qlist, double *dist, double *ani, double l0, int nc, int dim, int *index)
 
int MMG3D_getListSquare (MMG5_pMesh mesh, double *ani, MMG3D_pPROctree q, double *rect, MMG3D_PROctree_s ***qlist)
 
int MMG3D_addPROctreeRec (MMG5_pMesh mesh, MMG3D_PROctree_s *q, double *ver, const MMG5_int no, int nv)
 
int MMG3D_addPROctree (MMG5_pMesh mesh, MMG3D_pPROctree q, const MMG5_int no)
 
int MMG3D_delPROctreeVertex (MMG5_pMesh mesh, MMG3D_PROctree_s *q, MMG5_int indNo)
 
void MMG3D_mergeBranchesRec (MMG3D_PROctree_s *q0, MMG3D_PROctree_s *q, int dim, int nv, int *index)
 
void MMG3D_mergeBranches (MMG5_pMesh mesh, MMG3D_PROctree_s *q, int dim, int nv)
 
int MMG3D_delPROctreeRec (MMG5_pMesh mesh, MMG3D_PROctree_s *q, double *ver, const MMG5_int no, const int nv)
 
int MMG3D_delPROctree (MMG5_pMesh mesh, MMG3D_pPROctree q, const int no)
 
void MMG3D_printArbreDepth (MMG3D_PROctree_s *q, int depth, int nv, int dim)
 
void MMG3D_printArbre (MMG3D_pPROctree q)
 
void MMG3D_printSubArbre (MMG3D_PROctree_s *q, int nv, int dim)
 
void MMG3D_sizeArbreRec (MMG3D_PROctree_s *q, int nv, int dim, int *s1, int *s2)
 
int * MMG3D_sizeArbre (MMG3D_pPROctree q, int dim)
 
int MMG3D_PROctreein_iso (MMG5_pMesh mesh, MMG5_pSol sol, MMG3D_pPROctree PROctree, MMG5_int ip, double lmax)
 
int MMG3D_PROctreein_ani (MMG5_pMesh mesh, MMG5_pSol sol, MMG3D_pPROctree PROctree, MMG5_int ip, double lmax)
 

Function Documentation

◆ MMG3D_addPROctree()

int MMG3D_addPROctree ( MMG5_pMesh  mesh,
MMG3D_pPROctree  q,
const MMG5_int  no 
)
Parameters
pointertoward the mesh structure
qpointer toward the global PROctree structure
noindex of the point to add to the PROctree

Add the vertex of index no to the PROctree.

Definition at line 775 of file PRoctree_3d.c.

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

◆ MMG3D_addPROctreeRec()

int MMG3D_addPROctreeRec ( MMG5_pMesh  mesh,
MMG3D_PROctree_s q,
double *  ver,
const MMG5_int  no,
int  nv 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward an PROctree cell.
ververtex coordinates scaled such that the quadrant is [0;1]x[0;1]x[0;1]
novertex index in the mesh.
nvmaximum number of points in an PROctree cell.
Returns
1 if ok 0 if memory saturated

Add vertex in the suitable quadrant of the PROctree. This function is recursively called until we reach the last one. At each step, the vertex coordinates are scaled such as the quadrant is the [0;1]x[0;1]x[0;1] box.

Definition at line 650 of file PRoctree_3d.c.

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

◆ MMG3D_delPROctree()

int MMG3D_delPROctree ( MMG5_pMesh  mesh,
MMG3D_pPROctree  q,
const int  no 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward the global PROctree.
noreference of the vertex to be deleted.
Returns
1 if ok 0 if memory saturated

Delete the vertex no from the PROctree structure.

Definition at line 977 of file PRoctree_3d.c.

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

◆ MMG3D_delPROctreeRec()

int MMG3D_delPROctreeRec ( MMG5_pMesh  mesh,
MMG3D_PROctree_s q,
double *  ver,
const MMG5_int  no,
const int  nv 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward an PROctree cell.
ververtex coordinates scaled such that the quadrant is [0;1]x[0;1]x[0;1]
novertex index in the mesh.
nvmaximum number of points in an PROctree cell.
Returns
1 if ok 0 if memory saturated

Delete vertex no from the PROctree. This function is recursively called until we reach the terminal PROctree cell containing the vertex no. At each step, the vertex coordinates are scaled such as the quadrant is the [0;1]x[0;1]x[0;1] box.

Definition at line 896 of file PRoctree_3d.c.

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

◆ MMG3D_delPROctreeVertex()

int MMG3D_delPROctreeVertex ( MMG5_pMesh  mesh,
MMG3D_PROctree_s q,
MMG5_int  indNo 
)
Parameters
qpointer toward a terminal PROctree cell (containing vertex)
noindex of the point to delete from the PROctree
Returns
1 if ok 0 if memory saturated

Delete the vertex of index no from the terminal PROctree cell, merge the cells if necessary.

Definition at line 800 of file PRoctree_3d.c.

Here is the caller graph for this function:

◆ MMG3D_freePROctree()

void MMG3D_freePROctree ( MMG5_pMesh  mesh,
MMG3D_pPROctree q 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward a pointer toward the global PROctree.

Free the global PROctree structure.

Definition at line 164 of file PRoctree_3d.c.

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

◆ MMG3D_freePROctree_s()

void MMG3D_freePROctree_s ( MMG5_pMesh  mesh,
MMG3D_PROctree_s q,
int  nv 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward the PROctree cell
nvnumber of vertices in the cell subtree

Free the PROctree cell.

Definition at line 113 of file PRoctree_3d.c.

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

◆ MMG3D_getListSquare()

int MMG3D_getListSquare ( MMG5_pMesh  mesh,
double *  ani,
MMG3D_pPROctree  q,
double *  rect,
MMG3D_PROctree_s ***  qlist 
)
Parameters
meshpointer toward the mesh structure
animetric to use for the cell ordering from closest to farthest
qpointer toward the global PROctree structure.
rectrectangle that we want to intersect with the subtree. We define it given: the coordinates of one corner of the rectangle and the length of the rectangle in each dimension.
qlistpointer toward the list of pointer over the sub PROctrees that intersect rect.
Returns
index, the number of subtrees in the list
-1 if fail due to lack of memory.

List the number of PROctree cells that intersect the rectangle rect.

Definition at line 574 of file PRoctree_3d.c.

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

◆ MMG3D_getListSquareRec()

int MMG3D_getListSquareRec ( MMG3D_PROctree_s q,
double *  center,
double *  rect,
MMG3D_PROctree_s ***  qlist,
double *  dist,
double *  ani,
double  l0,
int  nc,
int  dim,
int *  index 
)
Parameters
qpointer toward the PROctree cell.
centercoordinates of the centre of the current subtree.
rectrectangle that we want to intersect with the subtree. We define it given: the coordinates of one corner of the rectange and the length of the rectangle in each dimension.
qlistpointer toward the list of pointer over the sub PROctrees that intersect rect.
distpointer toward the list of distances between center of the PROctree cells in qlist and the last 3 elements are the coordinates of the center of the whole recangle.
animetric of the point.
l0radius of the search zone.
ncnumber max of cell in the list +3 (the three last.
dimdimension =3.
indexnumber of PROctree cells that intersect rect
Returns
0 if the rectangle doesn't intersect the PROctree (possible due to the surface reconstruction), 1 otherwise.

List the number of PROctree cells that intersect the rectangle rect. To avoid counting of the cells, a maximum is set.

Definition at line 443 of file PRoctree_3d.c.

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

◆ MMG3D_getPROctreeCoordinate()

int64_t MMG3D_getPROctreeCoordinate ( MMG3D_pPROctree  q,
double *  ver,
int  dim 
)
Parameters
qpointer toward the global PROctree.
vercoordinates of the point.
dimspace dimension (should be 3).
Returns
the integer containing the coordinates

Get the integer containing the coordinates

Definition at line 183 of file PRoctree_3d.c.

Here is the caller graph for this function:

◆ MMG3D_initPROctree()

int MMG3D_initPROctree ( MMG5_pMesh  mesh,
MMG3D_pPROctree q,
int  nv 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward the global PROctree
nvmaximum number of vertices in each cell before subdivision
Returns
1 if ok 0 if memory saturated

Initialisation of the PROctree cell.

Definition at line 65 of file PRoctree_3d.c.

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

◆ MMG3D_initPROctree_s()

void MMG3D_initPROctree_s ( MMG3D_PROctree_s q)
Parameters
qpointer toward the PROctree cell

Initialisation of the PROctree cell.

Definition at line 48 of file PRoctree_3d.c.

Here is the caller graph for this function:

◆ MMG3D_intersectRect()

int MMG3D_intersectRect ( double *  rectin,
double *  rectinout 
)
Parameters
rectinrectangle to intersect, is not modified.
rectinoutrectangle to intersect, is set to the intersection.
Returns
1 if rectinout intersect rectin, 0 otherwise (possible because the surface reconstruction may leads to point outside the [0;1]x[0;1]x[0;1] bounding box)

Set rectinout to the intersection of the two rectangles. Rectangles are defined by: the coordinates of the lower left corner of the rectange and the length of the rectangle in each dimension.

Definition at line 385 of file PRoctree_3d.c.

Here is the caller graph for this function:

◆ MMG3D_isCellIncluded()

int MMG3D_isCellIncluded ( double *  cellCenter,
double  l,
double *  zoneCenter,
double  l0 
)
Parameters
cellCenter3 coordinates of the center of the PROctree cell to test.
lsize of the cell
zoneCenter3 coordinates of the center of the search zone
radiusof the search zone
Returns
wether the cell is included in the search zone.

Definition at line 265 of file PRoctree_3d.c.

◆ MMG3D_mergeBranches()

void MMG3D_mergeBranches ( MMG5_pMesh  mesh,
MMG3D_PROctree_s q,
int  dim,
int  nv 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward an PROctree cell.
dimdimension of the space (=3)
nvmaximum number of points in an PROctree cell.

Merge branches that have a parent counting less than nv vertices.

Definition at line 864 of file PRoctree_3d.c.

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

◆ MMG3D_mergeBranchesRec()

void MMG3D_mergeBranchesRec ( MMG3D_PROctree_s q0,
MMG3D_PROctree_s q,
int  dim,
int  nv,
int *  index 
)
Parameters
q0pointer toward an PROctree cell.
qpointer toward an PROctree cell.
dimdimension of the space (=3).
nvmaximum number of points in an PROctree cell.
indexnext index in the array to be filled.

Merge sub-branches q of q0, in their parent q0. q0 should contain no more than nv vertices.

Definition at line 835 of file PRoctree_3d.c.

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

◆ MMG3D_movePROctree()

int MMG3D_movePROctree ( MMG5_pMesh  mesh,
MMG3D_pPROctree  q,
MMG5_int  no,
double *  newVer,
double *  oldVer 
)
Parameters
meshpointer toward the mesh structure.
qpointer toward the global PROctree.
noindex of the moved point.
newVernew coordinates for the moved point.
oldVerold coordinates for the moved point.
Returns
1 if ok 0 if memory saturated

Move one point in the PROctree structure. /!\ the vertex of index no can have either the new or the old coordinates in the mesh but all other vertice should have the same coordinates as when they were inserted into the PROctree. (ie: one move at a time in the mesh and the PROctree)

Definition at line 225 of file PRoctree_3d.c.

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

◆ MMG3D_placeInListDouble()

void MMG3D_placeInListDouble ( double *  distList,
double  dist,
int  index,
int  size 
)
Parameters
distListlist of values.
distvalue to insert in the list.
indexposition of the element before the place where dist should be inserted.
sizesize of the list before insertion.

Insert the value dist in the list distList at position index+1. Moves other data so nothing is lost. No memory check performed, this function should be called with coherent parameters.

Definition at line 298 of file PRoctree_3d.c.

Here is the caller graph for this function:

◆ MMG3D_placeInListPROctree()

void MMG3D_placeInListPROctree ( MMG3D_PROctree_s **  qlist,
MMG3D_PROctree_s q,
int  index,
int  size 
)
Parameters
qListlist of pointer on PROctree.
qpointer on PROctree to be inserted in the list.
indexposition of the element before the place where q should be inserted.
sizesize of the list before insertion.

Insert the pointer q in the list qList at position index+1. Moves other data so nothing is lost. No memory check performed, this function should be called with coherent parameters.

Definition at line 316 of file PRoctree_3d.c.

Here is the caller graph for this function:

◆ MMG3D_printArbre()

void MMG3D_printArbre ( MMG3D_pPROctree  q)
Parameters
qpointer toward the global PROctree structure

Print the PROctree.

Warning
debug function, not safe

Definition at line 1029 of file PRoctree_3d.c.

Here is the call graph for this function:

◆ MMG3D_printArbreDepth()

void MMG3D_printArbreDepth ( MMG3D_PROctree_s q,
int  depth,
int  nv,
int  dim 
)
Parameters
qpointer toward an PROctree cell
depthdepth of the subtree
nvnumber of vertices in the subtree
dimdimension in which we work

Print the depth depth of the subtree of q.

Warning
debug function, not safe

Definition at line 1005 of file PRoctree_3d.c.

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

◆ MMG3D_printSubArbre()

void MMG3D_printSubArbre ( MMG3D_PROctree_s q,
int  nv,
int  dim 
)
Parameters
qpointer toward an PROctree cell
nvmaximum number of vertices in an PROctree leaf
dimspacial dimension

Print the PROctree.

Warning
debug function, not safe

Definition at line 1054 of file PRoctree_3d.c.

Here is the call graph for this function:

◆ MMG3D_PROctreein_ani()

int MMG3D_PROctreein_ani ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
MMG3D_pPROctree  PROctree,
MMG5_int  ip,
double  lmax 
)
Parameters
meshpointer toward the mesh structure.
solpointer toward the solution structure.
PROctreepointer toward the PROctree structure.
ipindex of point to check.
lmaxthreshold to check minimal distance between points.
Returns
1 if we can insert ip, 0 otherwise
-1 if fail due to lack of memory.

Check if the vertex ip is not too close from another one (for an anisotropic metric).

Definition at line 1225 of file PRoctree_3d.c.

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

◆ MMG3D_PROctreein_iso()

int MMG3D_PROctreein_iso ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
MMG3D_pPROctree  PROctree,
MMG5_int  ip,
double  lmax 
)
Parameters
meshpointer toward the mesh structure.
solpointer toward the solution structure.
PROctreepointer toward the PROctree structure.
ipindex of point to check.
lmaxthreshold to check minimal distance between points.
Returns
1 if we can insert ip, 0 if we cannot insert the point
-1 if fail because of memory.

Check if the vertex ip is not too close from another one (for an isotropic metric).

Definition at line 1143 of file PRoctree_3d.c.

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

◆ MMG3D_seekIndex()

int MMG3D_seekIndex ( double *  distList,
double  dist,
int  indexMin,
int  indexMax 
)
Parameters
distListordered list of value from smallest to largest.
distvalue to be compared to elements in the list.
indexMinminimum index of the list.
indexMaxmaximum index of the list.
Returns
Index of the biggest value of disList that is strictly smaller than dist. Only search in the bounds of indexMin and indexMax.

Definition at line 337 of file PRoctree_3d.c.

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

◆ MMG3D_sizeArbre()

int * MMG3D_sizeArbre ( MMG3D_pPROctree  q,
int  dim 
)
Parameters
qpointer toward the global PROctree structure
dimdimension in which we work
Returns
the size of the tree or NULL pointer if fail

Print the PROctree memory size.

Warning
debug function, not safe

Definition at line 1119 of file PRoctree_3d.c.

Here is the call graph for this function:

◆ MMG3D_sizeArbreRec()

void MMG3D_sizeArbreRec ( MMG3D_PROctree_s q,
int  nv,
int  dim,
int *  s1,
int *  s2 
)
Parameters
qpointer toward an PROctree cell
nvmaximum number of vertices in an PROctree leaf
dimdimension in which we work
ssize of the PROctree

Print the memory size of the PROctree.

Warning
debug function, not safe

Definition at line 1077 of file PRoctree_3d.c.

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