From 25199b8966ade69506cf2cc3f931b977ff31133a Mon Sep 17 00:00:00 2001 From: yye00 Date: Mon, 5 Dec 2005 20:57:51 +0000 Subject: changes to ELLSOR to use new reduction api, removed references to pointwise from ReduceArraysGlobally, removed unused variables and added the LocalReduce thorn to a .par file git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllSOR/trunk@96 fa3da13c-9f13-4301-a575-cf5b8c5e1907 --- src/ConfMetric.c | 23 ++++++++++++++++++----- src/Flat.c | 27 +++++++++++++++++++++------ 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/ConfMetric.c b/src/ConfMetric.c index db9fb98..ebbd0f0 100644 --- a/src/ConfMetric.c +++ b/src/ConfMetric.c @@ -138,10 +138,17 @@ int SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal, CCTK_REAL detrec_pm4, sqrtdet; char *robin=NULL; char *sor_accel=NULL; - - + const void* input_array[1]; + void* reduction_value[1]; + int input_array_dim[1]; + int input_array_type_codes[1]; + + input_array[0] = &resnorm; + reduction_value[0] = &glob_residual; + input_array_type_codes[0] = CCTK_VARIABLE_REAL; + /* Get the reduction handle */ - sum_handle = CCTK_ReductionArrayHandle("sum"); + sum_handle = CCTK_LocalArrayReductionHandle("sum"); if (sum_handle<0) { CCTK_WARN(1,"SORConfMetric3D: " @@ -526,8 +533,14 @@ int SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal, } /* reduction operation on processor-local residual values */ - if (CCTK_ReduceLocScalar(GH, -1, sum_handle, - &resnorm, &glob_residual, CCTK_VARIABLE_REAL)<0) + ierr = CCTK_ReduceArraysGlobally(GH, -1,sum_handle, -1, 1,input_array,0, + input_array_dim, + input_array_type_codes, + 1, + input_array_type_codes, + reduction_value); + + if (ierr<0) { CCTK_WARN(1,"SORConfMetric3D: Reduction of residual failed"); } diff --git a/src/Flat.c b/src/Flat.c index f83d5a1..c083eb5 100644 --- a/src/Flat.c +++ b/src/Flat.c @@ -71,7 +71,17 @@ int SORFlat3D(cGH *GH, int FieldIndex, int MIndex, int NIndex, CCTK_REAL dx2rec, dy2rec, dz2rec; char *robin = NULL; char *sor_accel = NULL; - + int ierr = 0; + const void* input_array[1]; + void* reduction_value[1]; + int input_array_dim[1]; + int input_array_type_codes[1]; + + input_array[0] = (CCTK_REAL *)&resnorm; + input_array_dim[0] = 0; + reduction_value[0] = (CCTK_REAL *)&glob_residual; + input_array_type_codes[0] = CCTK_VARIABLE_REAL; + /* Boundary conditions */ int use_robin = 0; @@ -79,7 +89,7 @@ int SORFlat3D(cGH *GH, int FieldIndex, int MIndex, int NIndex, RelTol = RelTol; /* Get the reduction handle */ - sum_handle = CCTK_ReductionArrayHandle("sum"); + sum_handle = CCTK_LocalArrayReductionHandle("sum"); if (sum_handle<0) { CCTK_WARN(1,"SORFlat3D: Cannot get reduction handle for sum operation"); @@ -285,11 +295,16 @@ int SORFlat3D(cGH *GH, int FieldIndex, int MIndex, int NIndex, } } } - + /* reduction operation on processor-local residual values */ - - if (CCTK_ReduceLocScalar(GH, -1, sum_handle, - &resnorm, &glob_residual, CCTK_VARIABLE_REAL)<0) + ierr = ierr = CCTK_ReduceArraysGlobally(GH, -1,sum_handle, -1, 1,input_array,0, + input_array_dim, + input_array_type_codes, + 1, + input_array_type_codes, + reduction_value); + + if (ierr<0) { CCTK_WARN(1,"SORFlat3D: Reduction of Norm failed"); } -- cgit v1.2.3