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 int16_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;
206 MMG5_int k,nt,ip1,ip2;
210 for (k=1; k<=
mesh->
ne; k++) {
212 if ( !
MG_EOK(pt) )
continue;
213 if ( !pt->
xt )
continue;
216 for (i=0; i<4; i++) {
227 for (k=1; k<=
mesh->
ne; k++) {
229 if ( !
MG_EOK(pt) )
continue;
230 if ( !pt->
xt )
continue;
233 for (i=0; i<6; i++) {
238 if ( tag != pxt->
tag[i] ) {
239 fprintf(stderr,
"Error: %s: %d: Non consistency at tet %" MMG5_PRId
" (%" MMG5_PRId
"), edge %d:%" MMG5_PRId
"--%" MMG5_PRId
"\n ",
241 assert( tag == pxt->
tag[i] &&
"edge tag error" );
267 for (k=1; k<=
mesh->
ne; k++) {
269 if ( !
MG_EOK(pt) )
continue;
270 if ( !pt->
xt )
continue;
273 for (i=0; i<6; i++) {
277 if ( ((i1==ip1) && (i2==ip2)) || ((i2==ip1) && (i1==ip2)) ) {
278 if ( pxt->
tag[i] != tag ) {
279 fprintf(stderr,
"Error: %s: %d: Non consistency at tet %" MMG5_PRId
" (%" MMG5_PRId
"), edge %d\n ",
302 assert (
mesh->
tetra &&
"no tetra array");
305 assert ( pt->
xt &&
"no xtetra");
308 fprintf(stderr,
"Error: %s: %d: Tag error at point %" MMG5_PRId
" (%" MMG5_PRId
"), "
309 "tetra %" MMG5_PRId
" (%" MMG5_PRId
"), edge %d:%" MMG5_PRId
"--%" MMG5_PRId
" (%" MMG5_PRId
310 "--%" MMG5_PRId
").\n",__func__,__LINE__,
313 fprintf(stderr,
" point tag: %d; edge tag: %d\n",ppt->
tag,pxt->
tag[i]);
337 for (k=1; k<=
mesh->
ne; k++) {
339 if ( !
MG_EOK(pt) )
continue;
340 if ( !pt->
xt )
continue;
344 for ( i=0; i<6; ++i ) {
381 MMG5_int *adja,*adja1;
384 for (k=1; k<=
mesh->
nt; k++) {
387 for (i=0; i<3; i++) {
395 if(adja1[voy] / 3 != k){
396 fprintf(stderr,
"\n ## Warning: %s: wrong adjacency relation"
397 " for triangles : %" MMG5_PRId
" %" MMG5_PRId
" \n",__func__,k,k1);
420 for (k=1; k<=
mesh->
ne; k++) {
423 else if ( !pt->
xt )
continue;
426 for (i=0; i<4; i++) {
428 for (j=0; j<3; j++) {
438 if ( ret < 0 )
return 0;
457 MMG5_int *adja,*adja1,adj,adj1,k,iadr,iel;
458 MMG5_int a0,a1,a2,b0,b1,b2;
461 static int8_t mmgErr0=0,mmgErr1=0,mmgErr2=0,mmgErr3=0,mmgErr4=0,mmgErr5=0;
474 for (k=1; k<=
mesh->
ne; k++) {
476 if ( !
MG_EOK(pt1) || pt1->
ref < 0 )
continue;
480 for (i=0; i<4; i++) {
483 if ( !adj )
continue;
489 fprintf(stderr,
"\n ## Error: %s: 1. at least 1 wrong adjacency %" MMG5_PRId
" %" MMG5_PRId
"\n",
491 fprintf(stderr,
"triangle %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
494 fprintf(stderr,
"adj (%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
504 fprintf(stderr,
"\n ## Error: %s: 4. at least 1 invalid adjacent %" MMG5_PRId
" %" MMG5_PRId
"\n",
506 fprintf(stderr,
"vertices of k %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
509 fprintf(stderr,
"vertices of adj %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,adj),
512 fprintf(stderr,
"adj(%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
519 iadr = (adj-1)*4 + 1;
521 adj1 = adja1[voy] / 4;
522 voy1 = adja1[voy] % 4;
523 if ( adj1 != k || voy1 != i ) {
525 fprintf(stderr,
"\n ## Error: %s: 2. at least 1 wrong adjacency %" MMG5_PRId
" %" MMG5_PRId
"\n",
527 fprintf(stderr,
"vertices of %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
530 fprintf(stderr,
"vertices of adj %" MMG5_PRId
": %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,adj),
533 fprintf(stderr,
"adj(%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,k),
536 fprintf(stderr,
"adj(%" MMG5_PRId
"): %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
"\n",
MMG3D_indElt(
mesh,adj),
552 if(!(((a0 == b0)&&(a1 == b1)&&(a2 ==b2))||((a0 == b0)&&(a1 == b2)&&(a2 ==b1))\
553 || ((a0 == b1)&&(a1 == b0)&&(a2 ==b2)) || ((a0 == b1)&&(a1 == b2)&&(a2 ==b0)) \
554 || ((a0 == b2)&&(a1 == b0)&&(a2 ==b1)) || ((a0 == b2)&&(a1 == b1)&&(a2 ==b0)) )){
556 fprintf(stderr,
"\n ## Warning: %s: Inconsistent faces : tetra %" MMG5_PRId
" face %d;"
559 fprintf(stderr,
"Tet 1 : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",
MMG3D_indPt(
mesh,a0),
561 fprintf(stderr,
"Tet 2 : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",
MMG3D_indPt(
mesh,b0),
574 if ( !
MG_EOK(pt) || pt->
ref < 0 )
continue;
581 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
": boundary face"
591 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
": boundary face"
603 for(k=1; k<=
mesh->
ne; k++){
605 if ( !
MG_EOK(pt) || pt->
ref < 0 )
continue;
609 if(!adja[i])
continue;
617 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
" face %d: common"
618 " face is a limit of two subdomains"
619 " and has not xt : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",__func__,
632 fprintf(stderr,
"\n ## Error: %s: Tetra %" MMG5_PRId
" %d : common"
633 " face is a limit of two subdomains"
634 " and is not tagged %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" -->%d\n",__func__,
662 static int8_t mmgWarn0=0,mmgWarn1=0;
668 for(k=1; k<=mesh->ne; k++){
671 if(!pt->
xt)
continue;
677 if(pt->
v[ip] == np) {
680 fprintf(stderr,
"\n ## Error: %s: point %" MMG5_PRId
" on face %d of tetra %" MMG5_PRId
" :"
681 " %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",__func__,
MMG3D_indPt(
mesh,pt->
v[ip]),i,
695 for(k=1; k<=
mesh->
np; k++){
698 if(p0->
flag)
continue;
702 fprintf(stderr,
"\n ## Error: %s: point %" MMG5_PRId
" tagged bdy while belonging to no BDY face\n",
724 static int8_t mmgWarn0 = 0;
728 for(k=1; k<=
mesh->
ne;k++){
731 if(!pt->
xt)
continue;
737 if(pt->
v[ip] == nump){
744 fprintf(stderr,
"\n ## Error: %s: face %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" in tetra : %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" \n",
771 MMG5_int k,ntet,ned,np,np1,ischk,npchk,iel;
774 int8_t i0,j,i,i1,ia,
ier;
777 for(k=1; k<=
mesh->
np; k++)
781 for (k=1; k<=
mesh->
ne; k++) {
783 if ( !
MG_EOK(pt) )
continue;
784 else if ( !pt->
xt )
continue;
788 for (i=0; i<4; i++) {
791 if ( nf >= 2 ) ntet++;
794 printf(
" *** %" MMG5_PRId
" tetras with at least 2 boundary faces.\n",ntet);
797 for (k=1; k<=
mesh->
ne; k++) {
799 if ( !
MG_EOK(pt) )
continue;
801 for (i=0; i<4; i++) {
806 ischk = p0->
flag % 2;
807 if ( ischk )
continue;
811 for (l=0; l<ilist; l++) {
817 for (j=0; j<3; j++) {
820 if ( np1 < np )
continue;
824 ischk = p1->
flag % 2;
825 npchk = p1->
flag / 2;
826 if ( npchk == np )
continue;
829 p1->
flag = 2*np + ischk;
832 if (
ier<0 )
return 0;
833 else if ( !
ier ) ned++;
839 printf(
" *** %" MMG5_PRId
" internal edges connecting boundary points.\n",ned);
853 MMG5_int ref,minn,maxn,sn,k,ip0,ip1,ip2,mins,maxs,sum;
856 static int8_t mmgWarn0 = 0;
863 for(k=1; k<=
mesh->
ne; k++) {
865 if( !
MG_EOK(pt) )
continue;
875 sum = ip0 + ip1 + ip2;
876 tag = pt->
xt ? pxt->
ftag[i] : 0;
877 ref = pt->
xt ? pxt->
ref[i] : 0;
879 if( mins == minn && maxs == maxn && sum == sn ) {
882 fprintf(stderr,
"\n ## Error: %s: Face %d in tetra %" MMG5_PRId
" with ref %" MMG5_PRId
":"
883 " corresponding ref %" MMG5_PRId
" , tag: %d\n",__func__,i,
int MMG5_boulevolp(MMG5_pMesh mesh, MMG5_int start, int ip, int64_t *list)
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)
static int MMG3D_chk_shellEdgeTag_oneDir(MMG5_pMesh mesh, MMG5_int start, MMG5_int na, MMG5_int nb, int16_t tag, MMG5_int ref, MMG5_int piv, MMG5_int adj)
int srcface(MMG5_pMesh mesh, MMG5_int n0, MMG5_int n1, MMG5_int n2)
static int MMG3D_chkcoquilface(MMG5_pMesh mesh)
int MMG3D_chk_shellEdgeTag(MMG5_pMesh mesh, MMG5_int start, int8_t ia, int16_t tag, MMG5_int ref)
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)
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_hashEdgeTag(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, int16_t tag)
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
API headers for the mmg3d library.
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)
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Structure to store points of a MMG mesh.
Structure to store the surface tetrahedra of a MMG mesh.