aboutsummaryrefslogtreecommitdiff
path: root/src/ReductionAvg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ReductionAvg.c')
-rw-r--r--src/ReductionAvg.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/ReductionAvg.c b/src/ReductionAvg.c
index b844bb7..ee1c2bc 100644
--- a/src/ReductionAvg.c
+++ b/src/ReductionAvg.c
@@ -1,7 +1,7 @@
/*@@
@file ReductionAvg.c
- @date Thu Apr 3 11:54:53 1997
- @author Thomas Radke, Paul Walker, Erik Schnetter
+ @date
+ @author Tom Goodale, Yaakoub Y El Khamra
@desc
Defines the reduction operator to get the average
of an arbitrary array.
@@ -36,8 +36,8 @@ static int ReductionAvg (int N_dims, int operator_handle,
/*@@
@routine LocalReduce_Mean
- @author Thomas Radke
- @date 19 Aug 1999
+ @author Tom Goodale, Yaakoub Y El Khamra
+ @date
@desc
@enddesc
@history
@@ -117,8 +117,8 @@ int LocalReduce_Mean (int N_dims, int operator_handle,
/*****************************************************************************/
/*@@
@routine ReductionAvg
- @date Aug 19 1999
- @author Thomas Radke
+ @date
+ @author Tom Goodale, Yaakoub Y El Khamra
@desc Returns the average of a distributed array with
'num_points' elements. Global reduction is done element-wise
(num_outvals == 1) or on the results of the local reductions.
@@ -137,8 +137,6 @@ static int ReductionAvg (int N_dims, int operator_handle,
int i, j, k, flag, product, num_points;
int ierr;
int * iters_per_dim;
- void * data_pointer[10];
- void * output_buffer[10];
/* indices to hold the temp indices of size N_dims and iteration indices*/
int * indices;
@@ -163,9 +161,6 @@ static int ReductionAvg (int N_dims, int operator_handle,
CCTK_INT mask_offset;
CCTK_INT mask_time_level;
-
-
-
/* set the number of points */
num_points = 0;
@@ -247,7 +242,7 @@ static int ReductionAvg (int N_dims, int operator_handle,
#undef EXTRA_STEP
#define REDUCTION_OPERATION(avg, scalar) avg = avg + scalar;
-#define REDUCTION_INITIAL(num) num = 1.0;
+#define REDUCTION_INITIAL(num) num = 0;
#define EXTRA_STEP(a, b) a = a/b;
for (i = 0; i < N_input_arrays; i++)
@@ -1230,6 +1225,16 @@ static int ReductionAvg (int N_dims, int operator_handle,
#endif
}
}
+
+ /* free memory */
+ free (iters_per_dim);
+ free (indices);
+ free (actual_indices);
+ free (actual_iters_per_dim);
+ free (input_array_offsets);
+ free (input_array_strides);
+ free (input_array_min_subscripts);
+ free (input_array_max_subscripts);
return (0);
}