From 731ae5f566092ad3fc89f038005dc9968efd6bcc Mon Sep 17 00:00:00 2001 From: yye00 Date: Wed, 2 Nov 2005 17:28:39 +0000 Subject: change to use new reduction api git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@118 eff87b29-5268-4891-90a3-a07138403961 --- src/Write.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Write.c b/src/Write.c index faf87ef..fb33d5a 100644 --- a/src/Write.c +++ b/src/Write.c @@ -83,7 +83,16 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) CCTK_REAL min, max; const CCTK_INT htype = CCTK_VARIABLE_REAL; DECLARE_CCTK_PARAMETERS + + /* Reduction variables */ + int input_array[1]; + CCTK_INT input_array_type_codes[1]; + void* value_min[1], *value_max[1]; + input_array_type_codes[0] = CCTK_VARIABLE_REAL; + input_array[0] = vindex; + value_min[0] = &min; + value_max[0] = &max; /* get the variable name and group information */ fullname = CCTK_FullName (vindex); @@ -111,10 +120,10 @@ int IOJpeg_Write (const cGH *GH, CCTK_INT vindex, const char *alias) } else { - i = CCTK_ReductionHandle ("minimum"); - CCTK_Reduce (GH, 0, i, 1, CCTK_VARIABLE_REAL, &min, 1, vindex); - i = CCTK_ReductionHandle ("maximum"); - CCTK_Reduce (GH, 0, i, 1, CCTK_VARIABLE_REAL, &max, 1, vindex); + i = CCTK_LocalArrayReductionHandle ("minimum"); + i = CCTK_ReduceGridArrays (GH, 0, i, -1, 1, input_array , 1, input_array_type_codes, value_min); + i = CCTK_LocalArrayReductionHandle ("maximum"); + i = CCTK_ReduceGridArrays (GH, 0, i, -1, 1, input_array , 1, input_array_type_codes, value_max); } /* get the number of slices to output */ -- cgit v1.2.3