Skip to content

Commit

Permalink
TO REVERT : Add checks to validate the previous modifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Aug 22, 2024
1 parent 8ee20c9 commit 4a5e687
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/grpsplit_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/
#include "parmmg.h"
#include "metis_pmmg.h"
#include "mmgexterns_private.h"

/**
* \param nelem number of elements in the initial group
Expand Down Expand Up @@ -1843,6 +1844,13 @@ int PMMG_split_n2mGrps(PMMG_pParMesh parmesh,int target,int fitMesh,int repartit
if ( !ier ) {
fprintf(stderr,"\n ## Merge groups problem.\n");
}
for (int k=0; k<parmesh->ngrp; ++k ) {
if ( !MMG5_chkmsh(parmesh->listgrp[k].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}


if ( parmesh->info.imprim > PMMG_VERB_DETQUAL ) {
chrono(OFF,&(ctim[tim]));
Expand Down Expand Up @@ -1907,9 +1915,23 @@ int PMMG_split_n2mGrps(PMMG_pParMesh parmesh,int target,int fitMesh,int repartit
}

/** Split the group into the suitable number of groups */
for (int k=0; k<parmesh->ngrp; ++k ) {
if ( !MMG5_chkmsh(parmesh->listgrp[k].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}

if ( ier )
ier = PMMG_splitPart_grps(parmesh,target,fitMesh,repartitioning_mode);

for (int k=0; k<parmesh->ngrp; ++k ) {
if ( !MMG5_chkmsh(parmesh->listgrp[k].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}

if ( parmesh->info.imprim > PMMG_VERB_DETQUAL ) {
chrono(OFF,&(ctim[tim]));
printim(ctim[tim].gdif,stim);
Expand Down
24 changes: 22 additions & 2 deletions src/libparmmg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ int PMMG_packParMesh( PMMG_pParMesh parmesh )
}

/* to could save the mesh, the adjacency have to be correct */
if ( mesh->info.ddebug ) {
// if ( mesh->info.ddebug ) {
if ( (!mesh->adja) && !MMG3D_hashTetra(mesh,1) ) {
fprintf(stderr,"\n ## Error: %s: tetra hashing problem. Exit program.\n",
__func__);
Expand All @@ -279,7 +279,7 @@ int PMMG_packParMesh( PMMG_pParMesh parmesh )
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}
// }
}

return 1;
Expand Down Expand Up @@ -624,6 +624,12 @@ int PMMG_parmmglib1( PMMG_pParMesh parmesh )

if ( !mesh ) continue;

if ( !MMG5_chkmsh(mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}


memset(&mesh->xtetra[mesh->xt+1],0,(mesh->xtmax-mesh->xt)*sizeof(MMG5_xTetra));
memset(&mesh->xpoint[mesh->xp+1],0,(mesh->xpmax-mesh->xp)*sizeof(MMG5_xPoint));

Expand Down Expand Up @@ -665,6 +671,12 @@ int PMMG_parmmglib1( PMMG_pParMesh parmesh )
met = parmesh->listgrp[i].met;
field = parmesh->listgrp[i].field;


if ( !MMG5_chkmsh(mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}

#warning Luca: until analysis is not ready
#ifdef USE_POINTMAP
for( k = 1; k <= mesh->np; k++ )
Expand Down Expand Up @@ -939,6 +951,14 @@ int PMMG_parmmglib1( PMMG_pParMesh parmesh )
ier = PMMG_merge_grps(parmesh,0);
MPI_Allreduce( &ier, &ieresult, 1, MPI_INT, MPI_MIN, parmesh->comm );

for (int k=0; k<parmesh->ngrp; ++k ) {
if ( !MMG5_chkmsh(parmesh->listgrp[k].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}


if ( parmesh->info.imprim > PMMG_VERB_STEPS ) {
chrono(OFF,&(ctim[tim]));
printim(ctim[tim].gdif,stim);
Expand Down
16 changes: 16 additions & 0 deletions src/loadbalancing_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
*
*/
#include "parmmg.h"
#include "mmgexterns_private.h"


/**
* \param parmesh pointer toward a parmesh structure
Expand Down Expand Up @@ -89,6 +91,14 @@ int PMMG_loadBalancing(PMMG_pParMesh parmesh,int partitioning_mode) {
ier = PMMG_split_n2mGrps(parmesh,PMMG_GRPSPL_DISTR_TARGET,1,partitioning_mode);
}

for (int k=0; k<parmesh->ngrp; ++k ) {
if ( !MMG5_chkmsh(parmesh->listgrp[k].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}


/* There is mpi comms in distribute_grps thus we don't want that one proc
* enters the function and not the other proc */
MPI_Allreduce( &ier, &ier_glob, 1, MPI_INT, MPI_MIN, parmesh->comm);
Expand Down Expand Up @@ -152,6 +162,12 @@ int PMMG_loadBalancing(PMMG_pParMesh parmesh,int partitioning_mode) {
}
}
}
for (int k=0; k<parmesh->ngrp; ++k ) {
if ( !MMG5_chkmsh(parmesh->listgrp[k].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}

if ( parmesh->info.imprim > PMMG_VERB_DETQUAL ) {
chrono(OFF,&(ctim[tim]));
Expand Down

0 comments on commit 4a5e687

Please sign in to comment.