37 MMG5_int k,kk,pp,l,ll,mins,mins1,maxs,maxs1;
38 MMG5_int *hcode,*link,inival,hsize,iadr;
50 printf(
" Exit program.\n");
60 for (k=0; k<=
mesh->
nt; k++)
64 for (k=1; k<=
mesh->
nt; k++) {
67 if ( !pt->
v[0] )
continue;
71 if ( pt->
v[i1] < pt->
v[i2] ) {
81 key = (
KTA*(int64_t)mins +
KTB*(int64_t)maxs)%hsize+1;
85 link[iadr] = hcode[key];
91 for (l=3*
mesh->
nt; l>0; l--) {
92 if ( link[l] >= 0 )
continue;
99 mins =
M_MIN(pt->
v[i1],pt->
v[i2]);
100 maxs =
M_MAX(pt->
v[i1],pt->
v[i2]);
107 while ( ll != inival ) {
113 if ( pt1->
v[i1] < pt1->
v[i2] ) {
122 if ( mins1 == mins && maxs1 == maxs ) {
124 if ( pp != 0 ) link[pp] = link[ll];
155 MMG5_int k,kk,pp,l,ll,mins,mins1,maxs,maxs1,iadr;
156 MMG5_int *hcode,*link,hsize,inival;
168 fprintf(stderr,
"\n ## Warning: %s: no re-build of adjacencies of quadrangles. "
169 "mesh->adjq must be freed to enforce analysis.\n",__func__);
175 fprintf(stdout,
" ** SETTING QUAD ADJACENCY\n");
179 fprintf(stderr,
" Exit program.\n");
190 inival = MMG5_INTMAX;
199 if ( !
MG_EOK(pq) )
continue;
200 for (i=0; i<4; i++) {
203 if ( pq->
v[i1] < pq->
v[i2] ) {
213 key = (
KTA*(int64_t)mins +
KTB*(int64_t)maxs)%hsize+1;
217 link[iadr] = hcode[key];
223 if (
mesh->
info.
ddebug ) fprintf(stdout,
" h- stage 2: adjacencies\n");
225 for (l=iadr; l>0; l--) {
226 if ( link[l] >= 0 )
continue;
235 if ( pq->
v[i1] < pq->
v[i2] ) {
248 while ( ll != inival ) {
255 if ( pq1->
v[i1] < pq1->
v[i2] ) {
264 if ( mins1 == mins && maxs1 == maxs ) {
266 if ( pp != 0 ) link[pp] = link[ll];
282 for (k=1; k<=
mesh->
nt; k++) {
284 if ( !
MG_EOK(pt) )
continue;
287 for (i=0; i<3; i++) {
300 if ( !
MG_EOK(pq) )
continue;
303 for (i=0; i<4; i++) {
304 assert ( hcode[i] >= 0 );
358 for (k=1; k<=
mesh->
nt; k++) {
360 if ( !
MG_EOK(pt) )
continue;
368 for ( ia = 0; ia < 3; ++ia ) {
369 pt->
tag[ia] &= ~MG_REQ;
375 if ( !
mesh->
na )
return 1;
380 printf(
" ## Error: %s: Unable to allocate edge hash table\n.",__func__);
385 for (k=1; k<=
mesh->
na; k++) {
388 fprintf(stderr,
"\n ## Error: %s: unable to hash edge %" MMG5_PRId
" %" MMG5_PRId
".\n",__func__,
395 for (k=1; k<=
mesh->
nt; k++) {
397 if ( !
MG_EOK(pt) )
continue;
399 for (i=0; i<3; i++) {
415 if ( !
MG_EOK(pq) )
continue;
417 for (i=0; i<4; i++) {
453 MMG5_int k,*adja,natmp,iel;
460 for (k=1; k<=
mesh->
nt; k++) {
462 if ( !
MG_EOK(pt) )
continue;
466 for (i=0; i<3; i++) {
470 if ( iel && pt->
ref <= pt1->
ref )
continue;
479 for (k=1; k<=
mesh->
nt; k++) {
481 if ( !
MG_EOK(pt) )
continue;
485 for (i=0; i<3; i++) {
489 if ( iel && pt->
ref <= pt1->
ref )
continue;
506 for (k=1; k<=
mesh->
na; k++) {
535 MMG5_int np,ned,nt,k,iel,nbl,isol,isolnew,memWarn,nc;
536 MMG5_int iadr,iadrnew,iadrv,*adjav,*adja,*adjanew,voy;
544 fprintf(stderr,
"\n ## Warning: %s: hashing problem. Exit program.\n",
551 for (k=1; k<=
mesh->
np; k++) {
553 if ( !
MG_VOK(ppt) )
continue;
559 ppt->
tag &= ~MG_NOSURF;
569 fprintf(stderr,
"\n ## Warning: %s: unexpected edge table..."
570 " Ignored data.\n",__func__);
577 fprintf(stderr,
"\n ## Warning: %s: unable to build quad adjacencies."
578 " Quad edges will be ignored.\n",__func__);
584 for (k=1; k<=
mesh->
nt; k++) {
586 if ( !
MG_EOK(pt) )
continue;
589 for (i=0; i<3; i++) {
593 pt->
tag[i] &= ~MG_REQ;
594 pt->
tag[i] &= ~MG_NOSURF;
598 if ( (!iel) || (pt->
ref > pt1->
ref) ) {
615 if ( !
MG_EOK(pq) )
continue;
618 for (i=0; i<4; i++) {
627 if ( (!iel) || (pq->
ref > pq1->
ref) ) {
650 printf(
" -- Attempt to allocate a smallest edge table...\n");
654 fprintf(stderr,
"\n ## Warning: %s: uncomplete mesh.\n",
667 for (k=1; k<=
mesh->
nt; k++) {
669 if ( !
MG_EOK(pt) )
continue;
673 for (i=0; i<3; i++) {
678 if ( !iel || (pt->
ref > pt1->
ref) ||
698 if ( !
MG_EOK(pq) )
continue;
702 for (i=0; i<4; i++) {
714 if ( !iel || (pq->
ref > pq1->
ref) ||
732 for (k=1; k<=
mesh->
na; k++) {
734 if ( !ped->
a )
continue;
742 for (k=1; k<=
mesh->
nt; k++) {
744 if ( !
MG_EOK(pt) )
continue;
758 iadrnew = 3*(nbl-1) + 1;
762 adjanew[i] = adja[i];
763 if ( !adja[i] )
continue;
764 iadrv = 3*(adja[i]/3-1)+1;
767 adjav[adja[i]%3] = 3*nbl + voy;
783 assert( pq && pq1 &&
MG_EOK(pq1) );
788 while ( ++k < mesh->nquad );
794 if ( !
MG_EOK(pq) )
continue;
805 for (k=1; k<=
mesh->
np; k++) {
807 if ( !
MG_VOK(ppt) )
continue;
808 isol = k *
sol->size;
809 isolnew = nbl *
sol->size;
811 for (i=0; i<
sol->size; i++)
812 sol->m[isolnew + i] =
sol->m[isol + i];
817 if ( met && met->
m ) {
819 for (k=1; k<=
mesh->
np; k++) {
821 if ( !
MG_VOK(ppt) )
continue;
822 isol = k * met->
size;
823 isolnew = nbl * met->
size;
825 for (i=0; i<met->
size; i++)
826 met->
m[isolnew + i] = met->
m[isol + i];
834 for (k=1; k<=
mesh->
np; k++) {
836 if ( !
MG_VOK(ppt) )
continue;
842 assert ( ppt->
tmp == nbl );
856 for(k=1 ; k<=
mesh->
np ; k++)
861 for (k=
mesh->
npnil; k<mesh->npmax-1; k++)
871 for (k=
mesh->
nenil; k<mesh->ntmax-1; k++)
879 fprintf(stdout,
" NUMBER OF VERTICES %8" MMG5_PRId
" CORNERS %8" MMG5_PRId
"\n",
mesh->
np,nc);
880 fprintf(stdout,
" NUMBER OF TRIANGLES %8" MMG5_PRId
"\n",
mesh->
nt);
882 fprintf(stdout,
" NUMBER OF QUADRILATERALS %8" MMG5_PRId
"\n",
mesh->
nquad);
885 fprintf(stdout,
" NUMBER OF EDGES %8" MMG5_PRId
"\n",
mesh->
na);
888 if ( memWarn )
return 0;
MMG5_pMesh MMG5_pSol * sol
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
MMG5_int MMG5_hashGet(MMG5_Hash *hash, MMG5_int a, MMG5_int b)
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
int MMG2D_bdryEdge(MMG5_pMesh mesh)
int MMG2D_hashQuad(MMG5_pMesh mesh)
int MMG2D_assignEdge(MMG5_pMesh mesh)
int MMG2D_hashTria(MMG5_pMesh mesh)
int MMG2D_pack(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
MMG5_int MMG2D_indPt(MMG5_pMesh mesh, MMG5_int kp)
static const unsigned int MMG2D_idir[5]
static const uint8_t MMG2D_idir_q[4][2]
idir[i]: vertices of edge i for a quad
void MMG2D_keep_only1Subdomain(MMG5_pMesh mesh, int nsd)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_ADD_MEM(mesh, size, message, law)
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
#define MMG5_SAFE_FREE(ptr)
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store edges of am MMG mesh.
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Structure to store vertices of an MMG mesh.
Structure to store quadrangles of an MMG mesh.
Structure to store triangles of a MMG mesh.