diff options
-rw-r--r-- | src/local_reductions.h | 13 |
1 files 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) \ } |