Skip to content

Commit

Permalink
Merge pull request #232 from MmgTools/feature/fix-edgeLength-in-ParMmg
Browse files Browse the repository at this point in the history
Feature/fix edge length in parmmg
  • Loading branch information
Algiane authored Dec 7, 2023
2 parents 89d537a + b38aab9 commit dc78641
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mmg2d/length_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ int MMG2D_prilen(MMG5_pMesh mesh,MMG5_pSol sol) {
ibmax = 0;
nullEdge = 0;

if ( (!sol) || (!sol->m) ) {
/* the functions that computes the edge length cannot be called without an
* allocated metric */
return 0;
}

if ( !mesh->nt ) {
return 0;
}
Expand Down
10 changes: 10 additions & 0 deletions src/mmg3d/quality_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ int MMG3D_computePrilen( MMG5_pMesh mesh, MMG5_pSol met, double* avlen,
*amin = *amax = *bmin = *bmax = 0;
*nullEdge = 0;

if ( (!met) || (!met->m) ) {
/* the functions that computes the edge length cannot be called without an
* allocated metric */
return 0;
}

if ( !mesh->ne ) {
return 0;
}

/* Hash all edges in the mesh */
if ( !MMG5_hashNew(mesh,&hash,mesh->np,7*mesh->np) ) return 0;

Expand Down
10 changes: 10 additions & 0 deletions src/mmgs/quality_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@ int MMGS_prilen(MMG5_pMesh mesh, MMG5_pSol met, int metRidTyp) {
amin = amax = bmin = bmax = 0;
nullEdge = 0;

if ( (!met) || (!met->m) ) {
/* the functions that computes the edge length cannot be called without an
* allocated metric */
return 0;
}

if ( !mesh->nt ) {
return 0;
}

/* Hash all edges in the mesh */
if ( !MMG5_hashNew(mesh,&hash,mesh->np,7*mesh->np) ) return 0;

Expand Down

0 comments on commit dc78641

Please sign in to comment.