From 5641aab1d4d3a254483dc51ff128b0372c83e65e Mon Sep 17 00:00:00 2001 From: yye00 Date: Mon, 24 Jan 2005 04:49:25 +0000 Subject: no processing for scalars, save some time git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalReduce/trunk@52 7daa882c-dc44-4453-834e-278d26b18e6a --- src/local_reductions.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/local_reductions.h b/src/local_reductions.h index 2f6804b..f7451f1 100644 --- a/src/local_reductions.h +++ b/src/local_reductions.h @@ -32,6 +32,14 @@ extern "C" { sum_indices = 0; \ num_points = 1; \ REDUCTION_INITIAL( * outval) \ + \ + if ( N_dims == 0 ) \ + { \ + REDUCTION_PREOP_CAST(inval, typed_vdata,sum_indices, out_type); \ + REDUCTION_OPERATION(*outval,inval); \ + } \ + else \ + { \ if ( mask_on == 1) \ { \ if ( input_array_offset == 0) \ @@ -44,7 +52,7 @@ extern "C" { product = 1; \ for (j=k-1;j>=0;j--) \ { \ - product *= input_array_dims[j]; \ + product *= input_array_dims[j]; \ } \ sum_indices += actual_indices[k]*product; \ } \ @@ -59,7 +67,7 @@ extern "C" { { \ if (flag==1) \ { \ - actual_indices[k] += input_array_strides[k]; \ + actual_indices[k] += input_array_strides[k]; \ indices[k]++; \ flag = 0; \ break; \ @@ -143,6 +151,7 @@ extern "C" { { \ CCTK_WARN(1, "mask_on is not set to a valid value"); \ } \ + } \ EXTRA_STEP(*outval, (out_type)num_points) \ } -- cgit v1.2.3