Skip to content
Snippets Groups Projects
Commit ff8efd63 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fixes for C++ compiler.

parent 19caade8
No related branches found
No related tags found
No related merge requests found
...@@ -42,10 +42,14 @@ ...@@ -42,10 +42,14 @@
#include <mpi.h> #include <mpi.h>
/* METIS/ParMETIS headers only used when MPI is also available. */ /* METIS/ParMETIS headers only used when MPI is also available. */
#ifdef HAVE_PARMETIS #ifdef HAVE_PARMETIS
#define __STDC_LIMIT_MACROS
#include <parmetis.h> #include <parmetis.h>
#include <stdint.h>
#endif #endif
#ifdef HAVE_METIS #ifdef HAVE_METIS
#define __STDC_LIMIT_MACROS
#include <metis.h> #include <metis.h>
#include <stdint.h>
#endif #endif
#endif #endif
...@@ -290,8 +294,8 @@ static void split_metis(struct space *s, int nregions, int *celllist) { ...@@ -290,8 +294,8 @@ static void split_metis(struct space *s, int nregions, int *celllist) {
struct indexval { struct indexval {
int index; int index;
int count; int count;
int old; int old_val;
int new; int new_val;
}; };
static int indexvalcmp(const void *p1, const void *p2) { static int indexvalcmp(const void *p1, const void *p2) {
const struct indexval *iv1 = (const struct indexval *)p1; const struct indexval *iv1 = (const struct indexval *)p1;
...@@ -329,8 +333,8 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells, ...@@ -329,8 +333,8 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells,
int index = newlist[k] + nregions * oldlist[k]; int index = newlist[k] + nregions * oldlist[k];
ivs[index].count++; ivs[index].count++;
ivs[index].index = index; ivs[index].index = index;
ivs[index].old = oldlist[k]; ivs[index].old_val = oldlist[k];
ivs[index].new = newlist[k]; ivs[index].new_val = newlist[k];
} }
qsort(ivs, indmax, sizeof(struct indexval), indexvalcmp); qsort(ivs, indmax, sizeof(struct indexval), indexvalcmp);
...@@ -340,7 +344,7 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells, ...@@ -340,7 +344,7 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells,
int *oldmap = NULL; int *oldmap = NULL;
int *newmap = NULL; int *newmap = NULL;
oldmap = permlist; /* Reuse this */ oldmap = permlist; /* Reuse this */
if ((newmap = malloc(sizeof(int) * nregions)) == NULL) if ((newmap = (int *)malloc(sizeof(int) * nregions)) == NULL)
error("Failed to allocate newmap array"); error("Failed to allocate newmap array");
for (int k = 0; k < nregions; k++) { for (int k = 0; k < nregions; k++) {
...@@ -354,9 +358,9 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells, ...@@ -354,9 +358,9 @@ void permute_regions(int *newlist, int *oldlist, int nregions, int ncells,
if (ivs[k].count == 0) break; if (ivs[k].count == 0) break;
/* Store old and new IDs, if not already used. */ /* Store old and new IDs, if not already used. */
if (newmap[ivs[k].new] == -1 && oldmap[ivs[k].old] == -1) { if (newmap[ivs[k].new_val] == -1 && oldmap[ivs[k].old_val] == -1) {
newmap[ivs[k].new] = ivs[k].old; newmap[ivs[k].new_val] = ivs[k].old_val;
oldmap[ivs[k].old] = ivs[k].new; oldmap[ivs[k].old_val] = ivs[k].new_val;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment