aboutsummaryrefslogtreecommitdiff
path: root/src/ReduceGA.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ReduceGA.c')
-rw-r--r--src/ReduceGA.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ReduceGA.c b/src/ReduceGA.c
index 86530d0..0a6b752 100644
--- a/src/ReduceGA.c
+++ b/src/ReduceGA.c
@@ -145,12 +145,13 @@ static int ReduceGridArrays (const cGH *GH,
int perform_all_reduce = 1;
pGA *GA;
const void *data;
+ int created_local_par_table = 0;
/* weight variables */
int weight_variable_index;
int weight_on = 0;
CCTK_REAL weight_sum = 0.0;
- CCTK_REAL total_weight_sum = 0.0;
+ CCTK_REAL total_weight_sum = 1.0;
const void * weight;
CCTK_INT * lower_array_bounds;
@@ -258,6 +259,7 @@ static int ReduceGridArrays (const cGH *GH,
/* Create the parameter table if it is not there and add the bounds to it */
if ( Util_TableQueryNKeys(param_table_handle) == 0)
{
+ created_local_par_table = 1;
param_table_handle = Util_TableCreate (UTIL_TABLE_FLAGS_DEFAULT);
ierr = Util_TableSetGenericArray (param_table_handle, CCTK_VARIABLE_INT, dim,min_array_subscript, "input_array_min_subscripts");
ierr = Util_TableSetGenericArray (param_table_handle, CCTK_VARIABLE_INT, dim,array_lsh, "input_array_max_subscripts");
@@ -322,7 +324,7 @@ static int ReduceGridArrays (const cGH *GH,
CACTUS_MPI_ERROR (MPI_Reduce (&num_points, &total_num_points, 1,
PUGH_MPI_INT, MPI_SUM, dest_proc, pughGH->PUGH_COMM_WORLD));
CACTUS_MPI_ERROR (MPI_Reduce (&weight_sum, &total_weight_sum, 1,
- PUGH_MPI_INT, MPI_SUM, dest_proc, pughGH->PUGH_COMM_WORLD));
+ PUGH_MPI_REAL, MPI_SUM, dest_proc, pughGH->PUGH_COMM_WORLD));
}
for (i = 0; i< M_output_values; i++)
{
@@ -1221,6 +1223,11 @@ static int ReduceGridArrays (const cGH *GH,
}
}
}
+
+ if(created_local_par_table)
+ {
+ ierr = Util_TableDestroy(param_table_handle);
+ }
return ierr;
}