aboutsummaryrefslogtreecommitdiff
path: root/src/ReductionMin.c
diff options
context:
space:
mode:
authortradke <tradke@d60812e6-3970-4df4-986e-c251b06effeb>2003-07-09 16:04:43 +0000
committertradke <tradke@d60812e6-3970-4df4-986e-c251b06effeb>2003-07-09 16:04:43 +0000
commit6d0154d89521ba27fec78ee4023f1a688b5954d0 (patch)
tree191498fc9440d0de2bd65f01640c06ed4e4c3fed /src/ReductionMin.c
parent16266c2af7fe606b142e3c8498b8bf690ce48cc3 (diff)
Fix for the reduction of grid arrays which don't have any point on a specific
processor. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHReduce/trunk@42 d60812e6-3970-4df4-986e-c251b06effeb
Diffstat (limited to 'src/ReductionMin.c')
-rw-r--r--src/ReductionMin.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ReductionMin.c b/src/ReductionMin.c
index d28e24f..ab76dfc 100644
--- a/src/ReductionMin.c
+++ b/src/ReductionMin.c
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <string.h>
+#include <float.h>
#include "pugh_reductions.h"
@@ -27,6 +28,7 @@ static int ReductionMinVal (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 */],
@@ -206,6 +208,7 @@ static int ReductionMinVal (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 */],
@@ -322,8 +325,19 @@ static int ReductionMinVal (const cGH *GH,
{
local_outvals = malloc (total_outvals * sizeof (CCTK_REAL));
- /* outvals[] contains now the local minimum */
- memcpy (local_outvals, outvals, total_outvals * sizeof (CCTK_REAL));
+ if (have_local_points)
+ {
+ /* outvals[] contains now the local minimum */
+ memcpy (local_outvals, outvals, total_outvals * sizeof (CCTK_REAL));
+ }
+ else
+ {
+ /* initialize local values to be largest possible fp number */
+ for (i = 0; i < total_outvals; i++)
+ {
+ local_outvals[i] = DBL_MAX;
+ }
+ }
if (proc < 0)
{
CACTUS_MPI_ERROR (MPI_Allreduce (local_outvals, outvals, total_outvals,