39#define MMG5_EPSLOC 1.00005
40#define IEDG(a,b) (((a) > 0) && ((b) > 0)) ? ((a)+(b)) : (((a)+(b))-(1))
58 for (k=1; k<=
mesh->
ne; k++) {
60 if ( !
MG_EOK(pt) )
continue;
62 fprintf(stderr,
"\n ## Warning: %s: tetra %" MMG5_PRId
" volume %e\n",__func__,
93 uint16_t tag,MMG5_int ref, MMG5_int piv,MMG5_int adj) {
99 while ( adj && (adj != start) ) {
110 assert (pxt->
tag[i] == tag &&
"non consistent tags");
111 assert (pxt->
edg[i] == ref &&
"non consistent refs");
145 MMG5_int piv,na,nb,adj,*adja;
149 assert( start >= 1 &&
MG_EOK(pt) &&
"invalid tetra" );
150 assert ( tag &
MG_BDY &&
"Unexpected non boundary tag");
160 assert (pxt->
tag[ia] == tag &&
"non consistent tags"); ;
161 assert (pxt->
edg[ia] == ref &&
"non consistent refs"); ;
174 assert ( adj == start );
177 else if ( adj < 0 )
return 0;
188 if ( adj < 0 )
return 0;
205 MMG5_int k,nt,ip1,ip2;
209 for (k=1; k<=
mesh->
ne; k++) {
211 if ( !
MG_EOK(pt) )
continue;
212 if ( !pt->
xt )
continue;
215 for (i=0; i<4; i++) {
226 uint16_t ignored_tag = (~MG_PARBDYBDY) & (~
MG_OLDPARBDY);
228 for (k=1; k<=
mesh->
ne; k++) {
230 if ( !
MG_EOK(pt) )
continue;
231 if ( !pt->
xt )
continue;
235 for (i=0; i<6; i++) {
253 fprintf(stderr,
"Error: %s: %d: Unable to add to hash table the edge "
254 "%d:%" MMG5_PRId
"--%" MMG5_PRId
" from tetra %" MMG5_PRId
255 " (%" MMG5_PRId
").\n ",__func__,__LINE__,i,ip1,ip2,k,
265 if ( tag != (pxt->
tag[i] & ignored_tag) ) {
266 fprintf(stderr,
"Error: %s: %d: Non consistency at tet %" MMG5_PRId
267 " (%" MMG5_PRId
"), edge %d:%" MMG5_PRId
"--%" MMG5_PRId
"\n ",
269 assert( tag == pxt->
tag[i] &&
"edge tag error" );
296 for (k=1; k<=
mesh->
ne; k++) {
298 if ( !
MG_EOK(pt) )
continue;
299 if ( !pt->
xt )
continue;
302 for (i=0; i<6; i++) {
306 if ( ((i1==ip1) && (i2==ip2)) || ((i2==ip1) && (i1==ip2)) ) {
307 if ( pxt->
tag[i] != tag ) {
308 fprintf(stderr,
"Error: %s: %d: Non consistency at tet %" MMG5_PRId
" (%" MMG5_PRId
"), edge %d\n ",
329 for (k=1; k<=
mesh->
ne; k++) {
331 if ( !
MG_EOK(pt) )
continue;
332 if ( !pt->
xt )
continue;
335 for (i=0; i<4; i++) {
356 assert (
mesh->
tetra &&
"no tetra array");
359 assert ( pt->
xt &&
"no xtetra");
362 fprintf(stderr,
"Error: %s: %d: Tag error at point %" MMG5_PRId
" (%" MMG5_PRId
"), "
363 "tetra %" MMG5_PRId
" (%" MMG5_PRId
"), edge %d:%" MMG5_PRId
"--%" MMG5_PRId
" (%" MMG5_PRId
364 "--%" MMG5_PRId
").\n",__func__,__LINE__,
367 fprintf(stderr,
" point tag: %d; edge tag: %d\n",ppt->
tag,pxt->
tag[i]);
391 for (k=1; k<=
mesh->
ne; k++) {
393 if ( !
MG_EOK(pt) )
continue;
394 if ( !pt->
xt )
continue;
398 for ( i=0; i<6; ++i ) {
435 MMG5_int *adja,*adja1;
438 for (k=1; k<=
mesh->
nt; k++) {
441 for (i=0; i<3; i++) {
449 if(adja1[voy] / 3 != k){
450 fprintf(stderr,
"\n ## Warning: %s: wrong adjacency relation"
451 " for triangles : %" MMG5_PRId
" %" MMG5_PRId
" \n",__func__,k,k1);
474 for (k=1; k<=
mesh->
ne; k++) {
477 else if ( !pt->
xt )
continue;
480 for (i=0; i<4; i++) {
482 for (j=0; j<3; j++) {
492 if ( ret < 0 )
return 0;
511 MMG5_int *adja,*adja1,adj,adj1,k,iadr,iel;
512 MMG5_int a0,a1,a2,b0,b1,b2;
515 static int8_t mmgErr0=0,mmgErr1=0,mmgErr2=0,mmgErr3=0,mmgErr4=0,mmgErr5=0;
531 for (k=1; k<=
mesh->
ne; k++) {
533 if ( !
MG_EOK(pt1) || pt1->
ref < 0 )
continue;
537 for (i=0; i<4; i++) {
540 if ( !adj )
continue;
546 fprintf(stderr,
"\n ## Error: %s: 1. at least 1 wrong adjacency %" MMG5_PRId
" %" MMG5_PRId
"\n",
548 fprintf(stderr,
"triangle %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
551 fprintf(stderr,
"adj (%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
561 fprintf(stderr,
"\n ## Error: %s: 4. at least 1 invalid adjacent %" MMG5_PRId
" %" MMG5_PRId
"\n",
563 fprintf(stderr,
"vertices of k %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
566 fprintf(stderr,
"vertices of adj %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,adj),
569 fprintf(stderr,
"adj(%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
576 iadr = (adj-1)*4 + 1;
578 adj1 = adja1[voy] / 4;
579 voy1 = adja1[voy] % 4;
580 if ( adj1 != k || voy1 != i ) {
582 fprintf(stderr,
"\n ## Error: %s: 2. at least 1 wrong adjacency %" MMG5_PRId
" %" MMG5_PRId
"\n",
584 fprintf(stderr,
"vertices of %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
587 fprintf(stderr,
"vertices of adj %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,adj),
590 fprintf(stderr,
"adj(%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
593 fprintf(stderr,
"adj(%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,adj),
609 if(!(((a0 == b0)&&(a1 == b1)&&(a2 ==b2))||((a0 == b0)&&(a1 == b2)&&(a2 ==b1))\
610 || ((a0 == b1)&&(a1 == b0)&&(a2 ==b2)) || ((a0 == b1)&&(a1 == b2)&&(a2 ==b0)) \
611 || ((a0 == b2)&&(a1 == b0)&&(a2 ==b1)) || ((a0 == b2)&&(a1 == b1)&&(a2 ==b0)) )){
613 fprintf(stderr,
"\n ## Warning: %s: Inconsistent faces : tetra %" MMG5_PRId
" face %d;"
616 fprintf(stderr,
"Tet 1 : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",
MMG3D_indPt(
mesh,a0),
618 fprintf(stderr,
"Tet 2 : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",
MMG3D_indPt(
mesh,b0),
631 if ( !
MG_EOK(pt) || pt->
ref < 0 )
continue;
638 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
": boundary face"
648 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
": boundary face"
660 for(k=1; k<=
mesh->
ne; k++){
662 if ( !
MG_EOK(pt) || pt->
ref < 0 )
continue;
666 if(!adja[i])
continue;
674 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
" face %d: common"
675 " face is a limit of two subdomains"
676 " and has not xt : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",__func__,
689 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
" %d : common"
690 " face is a limit of two subdomains"
691 " and is not tagged %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" -->%d\n",__func__,
719 static int8_t mmgWarn0=0,mmgWarn1=0;
725 for(k=1; k<=mesh->ne; k++){
728 if(!pt->
xt)
continue;
734 if(pt->
v[ip] == np) {
737 fprintf(stderr,
"\n ## Error: %s: point %" MMG5_PRId
" on face %d of tetra %" MMG5_PRId
" :"
738 " %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",__func__,
MMG3D_indPt(
mesh,pt->
v[ip]),i,
752 for(k=1; k<=
mesh->
np; k++){
755 if(p0->
flag)
continue;
759 fprintf(stderr,
"\n ## Error: %s: point %" MMG5_PRId
" tagged bdy while belonging to no BDY face\n",
781 static int8_t mmgWarn0 = 0;
785 for(k=1; k<=
mesh->
ne;k++){
788 if(!pt->
xt)
continue;
794 if(pt->
v[ip] == nump){
801 fprintf(stderr,
"\n ## Error: %s: face %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" in tetra : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",
828 MMG5_int k,ntet,ned,np,np1,ischk,npchk,iel;
831 int8_t i0,j,i,i1,ia,
ier;
834 for(k=1; k<=
mesh->
np; k++)
838 for (k=1; k<=
mesh->
ne; k++) {
840 if ( !
MG_EOK(pt) )
continue;
841 else if ( !pt->
xt )
continue;
845 for (i=0; i<4; i++) {
848 if ( nf >= 2 ) ntet++;
851 printf(
" *** %" MMG5_PRId
" tetras with at least 2 boundary faces.\n",ntet);
854 for (k=1; k<=
mesh->
ne; k++) {
856 if ( !
MG_EOK(pt) )
continue;
858 for (i=0; i<4; i++) {
863 ischk = p0->
flag % 2;
864 if ( ischk )
continue;
868 for (l=0; l<ilist; l++) {
874 for (j=0; j<3; j++) {
877 if ( np1 < np )
continue;
881 ischk = p1->
flag % 2;
882 npchk = p1->
flag / 2;
883 if ( npchk == np )
continue;
886 p1->
flag = 2*np + ischk;
889 if (
ier<0 )
return 0;
890 else if ( !
ier ) ned++;
896 printf(
" *** %" MMG5_PRId
" internal edges connecting boundary points.\n",ned);
910 MMG5_int ref,minn,maxn,sn,k,ip0,ip1,ip2,mins,maxs,sum;
913 static int8_t mmgWarn0 = 0;
920 for(k=1; k<=
mesh->
ne; k++) {
922 if( !
MG_EOK(pt) )
continue;
932 sum = ip0 + ip1 + ip2;
933 tag = pt->
xt ? pxt->
ftag[i] : 0;
934 ref = pt->
xt ? pxt->
ref[i] : 0;
936 if( mins == minn && maxs == maxn && sum == sn ) {
939 fprintf(stderr,
"\n ## Error: %s: Face %d in tetra %" MMG5_PRId
" with ref %" MMG5_PRId
":"
940 " corresponding ref %" MMG5_PRId
" , tag: %d\n",__func__,i,
int MMG5_boulevolp(MMG5_pMesh mesh, MMG5_int start, int ip, int64_t *list)
Given a vertex and a tetrahedron, find all tetrahedra in the ball of this vertex.
int MMG3D_findEdge(MMG5_pMesh mesh, MMG5_pTetra pt, MMG5_int k, MMG5_int na, MMG5_int nb, int error, int8_t *mmgWarn, int8_t *ia)
int MMG5_srcbdy(MMG5_pMesh mesh, MMG5_int start, int ia)
int MMG5_coquilface(MMG5_pMesh mesh, MMG5_int start, int8_t iface, int ia, int64_t *list, MMG5_int *it1, MMG5_int *it2, int silent)
int MMG3D_chk_shellEdgeTag(MMG5_pMesh mesh, MMG5_int start, int8_t ia, uint16_t tag, MMG5_int ref)
int srcface(MMG5_pMesh mesh, MMG5_int n0, MMG5_int n1, MMG5_int n2)
void MMG3D_chkfacetags(MMG5_pMesh mesh)
static int MMG3D_chkcoquilface(MMG5_pMesh mesh)
static void MMG3D_consistency_error_message(MMG5_pMesh mesh, MMG5_pPoint ppt, MMG5_int k, int i, MMG5_int ip1, MMG5_int ip2)
int MMG5_chkmshsurf(MMG5_pMesh mesh)
int MMG5_chkfemtopo(MMG5_pMesh mesh)
int MMG5_mmg3dChkmsh(MMG5_pMesh mesh, int severe, MMG5_int base)
void MMG3D_chkmeshedgestags(MMG5_pMesh mesh)
int MMG5_chkptonbdy(MMG5_pMesh mesh, MMG5_int np)
static int MMG3D_chk_shellEdgeTag_oneDir(MMG5_pMesh mesh, MMG5_int start, MMG5_int na, MMG5_int nb, uint16_t tag, MMG5_int ref, MMG5_int piv, MMG5_int adj)
void MMG3D_chkedgetag(MMG5_pMesh mesh, MMG5_int ip1, MMG5_int ip2, int tag)
int MMG5_cntbdypt(MMG5_pMesh mesh, MMG5_int nump)
void MMG5_chkvol(MMG5_pMesh mesh)
void MMG3D_chkpointtag(MMG5_pMesh mesh)
int MMG5_hEdge(MMG5_pMesh mesh, 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_hNew(MMG5_pMesh mesh, MMG5_HGeom *hash, MMG5_int hsiz, MMG5_int hmax)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
MMG5_int MMG3D_indPt(MMG5_pMesh mesh, MMG5_int kp)
static const int8_t MMG5_iarf[4][3]
iarf[i]: edges of face opposite to vertex i
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
static const uint8_t MMG5_ifar[6][2]
ifar[i][]: faces sharing the ith edge of the tetra
static const uint8_t MMG5_inxt3[7]
next vertex of tetra: {1,2,3,0,1,2,3}
static const uint8_t MMG5_idir[4][3]
idir[i]: vertices of face opposite to vertex i
MMG5_int MMG3D_indElt(MMG5_pMesh mesh, MMG5_int kel)
#define MG_EDG_OR_NOM(tag)
double MMG5_orvol(MMG5_pPoint point, MMG5_int *v)
#define MG_SIN_OR_NOM(tag)
#define MMG5_DEL_MEM(mesh, ptr)
Hash table to store geometric edges.
Structure to store vertices of an MMG mesh.
Structure to store tetrahedra of an MMG mesh.
Structure to store triangles of a MMG mesh.
Structure to store additional information for the surface tetrahedra of an MMG mesh.