From 1871e8c35d52d772c88e90481378126dee5d9c53 Mon Sep 17 00:00:00 2001 From: yye00 Date: Sun, 5 Sep 2004 20:44:43 +0000 Subject: fixing what might cause a problem in the future git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalReduce/trunk@40 7daa882c-dc44-4453-834e-278d26b18e6a --- src/local_reductions.h | 62 +++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/local_reductions.h b/src/local_reductions.h index 7ed8446..019651a 100644 --- a/src/local_reductions.h +++ b/src/local_reductions.h @@ -38,6 +38,16 @@ extern "C" { { \ while (iter < max_iter) \ { \ + sum_indices = actual_indices[0]; \ + for (k=N_dims-1;k>0;k--) \ + { \ + product = 1; \ + for (j=k-1;j>=0;j--) \ + { \ + product *= actual_iters_per_dim[j]; \ + } \ + sum_indices += actual_indices[k]*product; \ + } \ inval = (out_type) typed_vdata[sum_indices]; \ REDUCTION_OPERATION(*outval,inval); \ num_points++; \ @@ -71,6 +81,12 @@ extern "C" { return -1; \ } \ } \ + } \ + } \ + else \ + { \ + while (iter < max_iter) \ + { \ sum_indices = actual_indices[0]; \ for (k=N_dims-1;k>0;k--) \ { \ @@ -81,12 +97,6 @@ extern "C" { } \ sum_indices += actual_indices[k]*product; \ } \ - } \ - } \ - else \ - { \ - while (iter < max_iter) \ - { \ /* prevent offset from giving segfaults */ \ if (sum_indices >= max_iter) \ { \ @@ -126,6 +136,15 @@ extern "C" { return -1; \ } \ } \ + } \ + } \ + } \ + else if (mask_on == 0) \ + { \ + if ( input_array_offset == 0) \ + { \ + while (iter < max_iter) \ + { \ sum_indices = actual_indices[0]; \ for (k=N_dims-1;k>0;k--) \ { \ @@ -136,15 +155,6 @@ extern "C" { } \ sum_indices += actual_indices[k]*product; \ } \ - } \ - } \ - } \ - else if (mask_on == 0) \ - { \ - if ( input_array_offset == 0) \ - { \ - while (iter < max_iter) \ - { \ inval = (out_type) typed_vdata[sum_indices]; \ REDUCTION_OPERATION(*outval,inval); \ num_points++; \ @@ -178,6 +188,12 @@ extern "C" { return -1; \ } \ } \ + } \ + } \ + else \ + { \ + while (iter < max_iter) \ + { \ sum_indices = actual_indices[0]; \ for (k=N_dims-1;k>0;k--) \ { \ @@ -188,12 +204,6 @@ extern "C" { } \ sum_indices += actual_indices[k]*product; \ } \ - } \ - } \ - else \ - { \ - while (iter < max_iter) \ - { \ /* prevent offset from giving segfaults */ \ if (sum_indices >= max_iter) \ { \ @@ -233,16 +243,6 @@ extern "C" { return -1; \ } \ } \ - sum_indices = actual_indices[0]; \ - for (k=N_dims-1;k>0;k--) \ - { \ - product = 1; \ - for (j=k-1;j>=0;j--) \ - { \ - product *= actual_iters_per_dim[j]; \ - } \ - sum_indices += actual_indices[k]*product; \ - } \ } \ } \ } \ -- cgit v1.2.3