diff options
Diffstat (limited to 'src/ReductionNormInf.c')
-rw-r--r-- | src/ReductionNormInf.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ReductionNormInf.c b/src/ReductionNormInf.c index 363ca5b..fa4ea97 100644 --- a/src/ReductionNormInf.c +++ b/src/ReductionNormInf.c @@ -12,6 +12,7 @@ #include <stdlib.h> #include <string.h> +#include <float.h> #include "pugh_reductions.h" @@ -28,6 +29,7 @@ static int ReductionNormInf (const cGH *GH, int iterator[/* dim */], const int points_per_dim[/* dim */], int num_points, + int have_local_points, int num_inarrays, const int intypes[/* num_inarrays */], const void *const inarrays[/* num_inarrays */], @@ -209,6 +211,7 @@ static int ReductionNormInf (const cGH *GH, int iterator[/* dim */], const int points_per_dim[/* dim */], int num_points, + int have_local_points, int num_inarrays, const int intypes[/* num_inarrays */], const void *const inarrays[/* num_inarrays */], @@ -361,8 +364,19 @@ static int ReductionNormInf (const cGH *GH, { local_outvals = malloc (total_outvals * sizeof (CCTK_REAL)); - /* outvals[] contains now the local sum */ - memcpy (local_outvals, outvals, total_outvals * sizeof (CCTK_REAL)); + if (have_local_points) + { + /* outvals[] contains now the local sum */ + memcpy (local_outvals, outvals, total_outvals * sizeof (CCTK_REAL)); + } + else + { + /* initialize local values to be smallest possible fp number */ + for (i = 0; i < total_outvals; i++) + { + local_outvals[i] = -DBL_MAX; + } + } pughGH = PUGH_pGH (GH); if (proc < 0) { |