62 MMG5_int *adja,hmax,k,ia,ib,jel,lel,dup,nmf;
67 hmax =(MMG5_int)(3.71*
mesh->
np);
74 for (k=hash->
siz; k<hash->max; k++)
82 for (k=1; k<=
mesh->
nt; k++) {
84 if ( !
MG_EOK(pt) )
continue;
91 adja = &adjt[3*(k-1)+1];
94 if ( !
MG_EOK(pt) )
continue;
106 ph = &hash->
item[key];
122 if ( ph->
a == ia && ph->
b == ib ) {
127 if ( pt1->
v[j] == pt->
v[i] ) {
132 else if ( !adjt[3*(jel-1)+1+j] ) {
134 adjt[3*(jel-1)+1+j] = 3*k + i;
138 else if ( adja[i] != 3*jel+j ) {
139 lel = adjt[3*(jel-1)+1+j]/3;
140 l = adjt[3*(jel-1)+1+j]%3;
144 adjt[3*(lel-1)+1+l] = 0;
146 adjt[3*(jel-1)+1+j] = 3*k + i;
159 else if ( !ph->
nxt ) {
164 if ( hash->
nxt >= hash->
max-1 ) {
166 fprintf(stderr,
"\n ## Warning: %s: memory alloc problem (edge):"
167 " %" MMG5_PRId
"\n",__func__,hash->
max);
176 for (kk=ph->
nxt; kk<hash->max; kk++)
209 for (k=1; k<=
mesh->
nt; k++) {
211 if ( !
MG_EOK(pt) )
continue;
212 for (i=0; i<3; i++) {
221 ph = &hash->
item[key];
223 if ( ph->
a == 0 )
continue;
225 if ( ph->
a == ia && ph->
b == ib ) {
233 lel = adjt[3*(jel-1)+1+j]/3;
234 l = adjt[3*(jel-1)+1+j]%3;
242 }
else if ( !ph->
nxt ) {
252 for (k=1; k<=
mesh->
nt; k++) {
254 for (i=0; i<3; i++) {
263 fprintf(stdout,
" ## "); fflush(stdout);
264 if ( nmf > 0 ) fprintf(stdout,
"[non-manifold model] ");
265 if ( dup > 0 ) fprintf(stdout,
" %" MMG5_PRId
" duplicate removed",dup);
266 fprintf(stdout,
"\n");
289 MMG5_int mins,maxs,sum,j;
297 ph = &hash->
item[key];
300 if ( ph->
a == mins && ph->
b == maxs && ph->
s == sum )
303 while ( ph->
nxt && ph->
nxt < hash->
max ) {
305 if ( ph->
a == mins && ph->
b == maxs && ph->
s == sum )
return ph->
k;
317 if ( hash->
nxt >= hash->
max ) {
319 for (j=hash->
nxt; j<hash->max; j++) hash->
item[j].
nxt = j+1;
354 ph = &hash->
item[key];
356 if ( ph->
a == ia && ph->
b == ib )
359 while ( ph->
nxt && ph->
nxt < hash->
max ) {
361 if ( ph->
a == ia && ph->
b == ib )
return 1;
366 if ( hash->
nxt >= hash->
max-1 ) {
368 fprintf(stderr,
"\n ## Warning: %s: memory alloc problem (edge):"
369 " %" MMG5_PRId
"\n",__func__,hash->
max);
372 "MMG5_edge",
return 0);
376 for (j=ph->
nxt; j<hash->max; j++) hash->
item[j].
nxt = j+1;
412 ph = &hash->
item[key];
415 if ( ph->
a == ia && ph->
b == ib ) {
420 if ( !ph->
nxt )
return 0;
449 ph = &hash->
item[key];
452 if ( ph->
a == ia && ph->
b == ib ) {
457 while ( ph->
nxt && ph->
nxt < hash->
max ) {
459 if ( ph->
a == ia && ph->
b == ib ) {
473 if ( hash->
nxt >= hash->
max ) {
475 "edge hash table",
return 0);
476 for (j=hash->
nxt; j<hash->max; j++) hash->
item[j].
nxt = j+1;
506 if ( !hash->
item )
return 0;
511 ph = &hash->
item[key];
513 if ( !ph->
a )
return 0;
514 if ( ph->
a == ia && ph->
b == ib )
return ph->
k;
517 if ( ph->
a == ia && ph->
b == ib )
return ph->
k;
537 hash->
max = hmax + 2;
544 for (k=hash->
siz; k<hash->max; k++)
if(!ier) exit(EXIT_FAILURE)
MMG5_int MMG5_hashFace(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int ia, MMG5_int ib, MMG5_int ic, MMG5_int k)
int MMG5_mmgHashTria(MMG5_pMesh mesh, MMG5_int *adjt, MMG5_Hash *hash, int chkISO)
int MMG5_hashEdgeTag(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, uint16_t tag)
int MMG5_hashUpdate(MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
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)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_ADD_MEM(mesh, size, message, law)
static const uint8_t MMG5_iprv2[3]
#define MMG5_TAB_RECALLOC(mesh, ptr, initSize, wantedGap, type, message, law)
static const uint8_t MMG5_inxt2[6]
#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 triangles of a MMG mesh.
Used to hash edges (memory economy compared to MMG5_hgeom).