diff options
author | yye00 <yye00@7daa882c-dc44-4453-834e-278d26b18e6a> | 2005-01-24 04:49:25 +0000 |
---|---|---|
committer | yye00 <yye00@7daa882c-dc44-4453-834e-278d26b18e6a> | 2005-01-24 04:49:25 +0000 |
commit | 5641aab1d4d3a254483dc51ff128b0372c83e65e (patch) | |
tree | ece14d673f53ac6073fbf39e128a801f7340b981 | |
parent | 1adb82796f50c2777c9d538cbbb65fe9e4b93a2e (diff) |
no processing for scalars, save some time
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalReduce/trunk@52 7daa882c-dc44-4453-834e-278d26b18e6a
-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) \ } |