From 7271151af14e7274ce215c309ab29c1738839bf1 Mon Sep 17 00:00:00 2001 From: yye00 Date: Tue, 18 Oct 2005 21:04:03 +0000 Subject: fixed the false warning messages, added parameter table creation/deletion checking git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHReduce/trunk@71 d60812e6-3970-4df4-986e-c251b06effeb --- src/ReduceGA.c | 11 +++++++++-- 1 file 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; } -- cgit v1.2.3