Skip to content

Commit c611bed

Browse files
committed
Replace if with assert.
1 parent aa02454 commit c611bed

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libmetis/mesh.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "metislib.h"
1717

18+
#include <assert.h>
1819

1920
/*****************************************************************************/
2021
/*! This function creates a graph corresponding to the dual of a finite element
@@ -251,10 +252,9 @@ idx_t FindCommonElements(idx_t qid, idx_t elen, idx_t *eind, idx_t *nptr,
251252
}
252253
}
253254

254-
/* put qid into the neighbor list (in case it is not there) so that it
255-
will be removed in the next step */
256-
if (marker[qid] == 0)
257-
nbrs[k++] = qid;
255+
/* The element whose index is qid is always a trivial neighbor of itself,
256+
so it should be excluded from the list of its neighbors. */
257+
assert(marker[qid] == elen);
258258
marker[qid] = 0;
259259

260260
/* compact the list to contain only those with at least ncommon nodes */

0 commit comments

Comments
 (0)