From a579d77b8f8bb82b722c5f9ee15abb13f09ef46d Mon Sep 17 00:00:00 2001 From: allen Date: Wed, 19 Jul 2000 13:05:15 +0000 Subject: Registered reduction operators return ints git-svn-id: http://svn.cactuscode.org/flesh/trunk@1766 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/comm/Reduction.c | 55 +++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/comm/Reduction.c b/src/comm/Reduction.c index f5ee66fd..ec7181e7 100644 --- a/src/comm/Reduction.c +++ b/src/comm/Reduction.c @@ -18,10 +18,11 @@ #include "cctk_Flesh.h" #include "cctk_FortranString.h" #include "cctk_Groups.h" -#include "StoreHandledData.h" #include "cctk_Reduction.h" #include "cctk_WarnLevel.h" +#include "StoreHandledData.h" + static char *rcsid = "$Header$"; CCTK_FILEVERSION(comm_Reduction_c) @@ -55,7 +56,7 @@ static int num_reductions_array = 0; int CCTK_RegisterReductionOperator( - void (*function)(REDUCTION_OPERATOR_REGISTER_ARGLIST), + int (*function)(REDUCTION_OPERATOR_REGISTER_ARGLIST), const char *name) { int handle; @@ -66,7 +67,7 @@ int CCTK_RegisterReductionOperator( if(handle < 0) { /* Get a handle for it. */ - handle = Util_NewHandle(&ReductionOperators, name, (void *)function); + handle = Util_NewHandle(&ReductionOperators, name, (int *)function); /* Remember how many reduction operators there are */ num_reductions++; @@ -124,8 +125,9 @@ int CCTK_ReductionHandle(const char *reduction) #endif if (handle < 0) - CCTK_Warn(1,__LINE__,__FILE__,"Cactus", - "No handle found for this reduction operator"); + CCTK_VWarn(1,__LINE__,__FILE__,"Cactus", + "CCTK_ReductionHandle: No handle found reduction operator %s", + reduction); return handle; @@ -201,25 +203,27 @@ int CCTK_Reduce(cGH *GH, { va_list indices; int i; + int retval; int *in_fields; - void (*function)(REDUCTION_OPERATOR_REGISTER_ARGLIST); + int (*function)(REDUCTION_OPERATOR_REGISTER_ARGLIST); /* Get the pointer to the reduction operator */ if (operation_handle < 0) { CCTK_Warn(3,__LINE__,__FILE__,"Cactus", - "Invalid handle passed to CCTK_Reduce"); + "CCTK_Reduce: Invalid handle passed to CCTK_Reduce"); return (-1); } - function = (void (*)(REDUCTION_OPERATOR_REGISTER_ARGLIST)) + function = (int (*)(REDUCTION_OPERATOR_REGISTER_ARGLIST)) Util_GetHandledData(ReductionOperators,operation_handle); if (! function) { CCTK_Warn(3,__LINE__,__FILE__,"Cactus", - "Reduction operation is not registered and cannot be called"); + "CCTK_Reduce: Reduction operation is not registered" + "and cannot be called"); return (-1); } @@ -227,15 +231,17 @@ int CCTK_Reduce(cGH *GH, in_fields = malloc(num_in_fields*sizeof(int)); va_start(indices, num_in_fields); for (i=0; i