90 memcpy(&pttmp ,&tetras[ind2],
sizeof(
MMG5_Tetra));
91 memcpy(&tetras[ind2],&tetras[ind1],
sizeof(
MMG5_Tetra));
92 memcpy(&tetras[ind1],&pttmp ,
sizeof(
MMG5_Tetra));
96 perm[ind2] = perm[ind1];
115 MMG5_pSol fields,MMG5_int* permNodGlob) {
120 SCOTCH_Num *vertTab, *edgeTab, *permVrtTab;
122 MMG5_int vertNbr, nodeGlbIdx, tetraIdx, ballTetIdx;
126 MMG5_int *vertOldTab, *permNodTab, nereal, npreal;
136 for(tetraIdx = 1 ; tetraIdx <
mesh->
ne + 1 ; tetraIdx++) {
140 vertOldTab[tetraIdx] = ++vertNbr;
143 if ( vertNbr/2 < 0 ) {
154 if (!memset(vertTab, ~0,
sizeof(SCOTCH_Num)*(vertNbr + 2))) {
155 perror(
" ## Memory problem: memset");
174 for(tetraIdx = 1 ; tetraIdx <
mesh->
ne + 1 ; tetraIdx++) {
179 iadr = 4*(tetraIdx-1) + 1;
181 for (i=0; i<4; i++) {
182 ballTetIdx = adja[i];
184 if (!ballTetIdx)
continue;
189 if (vertTab[vertOldTab[tetraIdx]] < 0)
190 vertTab[vertOldTab[tetraIdx]] = edgeNbr;
193 if (edgeNbr >= edgeSiz) {
194 MMG5_int oldsize = edgeSiz;
203 edgeTab[edgeNbr++] = vertOldTab[ballTetIdx];
206 vertTab[vertNbr+1] = edgeNbr;
209 for(tetraIdx = 1 ; tetraIdx <
mesh->
ne + 1 ; tetraIdx++) {
213 if (vertTab[vertOldTab[tetraIdx]] < 0) {
214 if(vertOldTab[tetraIdx] == vertNbr) {
215 fprintf(stderr,
" ## Warning: %s: graph error, no renumbering.\n",
221 if(vertTab[vertOldTab[tetraIdx] + 1] > 0)
222 vertTab[vertOldTab[tetraIdx]] = vertTab[vertOldTab[tetraIdx] + 1];
224 if(vertOldTab[tetraIdx]+1 == vertNbr) {
225 fprintf(stderr,
" ## Warning: %s: graph error, no renumbering.\n",
234 }
while((vertTab[vertOldTab[tetraIdx] + i] < 0) && ((vertOldTab[tetraIdx] + i) < vertNbr));
235 if(vertOldTab[tetraIdx] + i == vertNbr) {
236 fprintf(stderr,
" ## Warning: %s: graph error, no renumbering.\n",
242 vertTab[vertOldTab[tetraIdx]] = vertTab[vertOldTab[tetraIdx] + i];
251 SCOTCH_graphInit(&graf) ;
252 CHECK_SCOTCH(SCOTCH_graphBuild(&graf, (SCOTCH_Num) 1, vertNbr, vertTab+1,
253 NULL, NULL, NULL, edgeNbr, edgeTab+1, NULL),
254 "scotch_graphbuild", 0) ;
258 fprintf(stdout,
"** Checking scotch graph.\n");
259 CHECK_SCOTCH(SCOTCH_graphCheck(&graf),
"scotch_graphcheck", 0);
273 SCOTCH_graphExit(&graf) ;
282 for(tetraIdx = 1 ; tetraIdx <
mesh->
ne + 1 ; tetraIdx++) {
284 vertOldTab[tetraIdx] = permVrtTab[vertOldTab[tetraIdx]];
288 for(tetraIdx = 1 ; tetraIdx <
mesh->
ne + 1 ; tetraIdx++) {
289 while ( vertOldTab[tetraIdx] != tetraIdx && vertOldTab[tetraIdx] )
299 for(tetraIdx = 1 ; tetraIdx <
mesh->
ne + 1 ; tetraIdx++) {
303 if (!ptet->
v[0])
continue;
307 for(j = 0 ; j <= 3 ; j++) {
309 nodeGlbIdx = ptet->
v[j];
311 if ( permNodTab[nodeGlbIdx] )
continue;
317 permNodTab[nodeGlbIdx] = ++npreal;
323 if ( !
MG_EOK(pp) )
continue;
325 for(j = 0; j<6 ; j++) {
326 nodeGlbIdx = pp->
v[j];
328 if ( permNodTab[nodeGlbIdx] )
continue;
334 permNodTab[nodeGlbIdx] = ++npreal;
339 for ( k=1; k<=
mesh->
np; ++k) {
344 if ( permNodTab[k] )
continue;
349 permNodTab[k] = ++npreal;
354 for( tetraIdx = 1; tetraIdx < nereal + 1; tetraIdx++) {
355 for(j = 0 ; j <= 3 ; j++) {
362 for(j = 0; j<6 ; j++) {
369 for(j = 0; j<4 ; j++) {
376 for ( k=1; k<=
mesh->
npi; ++k ) {
378 permNodGlob[k] = permNodTab[permNodGlob[k]];
379 assert ( permNodGlob[k] > 0 );
385 for (j=1; j<=
mesh->
np; j++) {
386 while ( permNodTab[j] != j && permNodTab[j] )
405 for (k=
mesh->
npnil; k<mesh->npmax-1; k++) {
413 for (k=
mesh->
nenil; k<mesh->nemax-1; k++) {
MMG5_pMesh MMG5_pSol * sol
int MMG3D_hashTetra(MMG5_pMesh mesh, int pack)
Create array of adjacency.
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
int MMG5_kPartBoxCompute(SCOTCH_Graph *graf, MMG5_int vertNbr, MMG5_int boxVertNbr, SCOTCH_Num *permVrtTab, MMG5_pMesh mesh)
void MMG5_swapNod(MMG5_pMesh mesh, MMG5_pPoint points, double *sols, MMG5_pSol field, MMG5_int *perm, MMG5_int ind1, MMG5_int ind2, int solsiz)
static void MMG5_swapTet(MMG5_pTetra tetras, MMG5_int *perm, MMG5_int ind1, MMG5_int ind2)
int MMG5_mmg3dRenumbering(int boxVertNbr, MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol fields, MMG5_int *permNodGlob)
#define CHECK_SCOTCH(t, m, e)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_SAFE_REALLOC(ptr, prevSize, newSize, type, message, law)
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store vertices of an MMG mesh.
Structure to store prsim of a MMG mesh.
Structure to store tetrahedra of an MMG mesh.