diff options
Diffstat (limited to 'src/WriteInfo.c')
-rw-r--r-- | src/WriteInfo.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/WriteInfo.c b/src/WriteInfo.c index ca06ae9..504b7a9 100644 --- a/src/WriteInfo.c +++ b/src/WriteInfo.c @@ -19,34 +19,49 @@ #include "cctk.h" #include "CactusBase/IOUtil/src/ioGH.h" -CCTK_REAL IOBasic_WriteInfo (cGH *GH, int index, const char *operator, const char *alias) +int IOBasic_WriteInfo (cGH *GH, + CCTK_REAL *val, + int index, + const char *operator, + const char *alias) { + int ierr; int reduce_handle; - CCTK_REAL retval = 0; - + int retval = 0; /* first, check if variable has storage assigned */ - if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) { + if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) + { char *fullname; fullname = CCTK_FullName (index); CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "No info output for '%s' (no storage)", fullname); + "IOBasic_WriteInfo: No info output for '%s' (no storage)", + fullname); free (fullname); - return (0); + return -3; } reduce_handle = CCTK_ReductionHandle(operator); if (reduce_handle > -1) { - CCTK_Reduce(GH,0,reduce_handle,1,CCTK_VARIABLE_REAL,&retval,1,index); + ierr = CCTK_Reduce(GH,0,reduce_handle,1, + CCTK_VARIABLE_REAL,val,1,index); + if (ierr < 0) + { + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "IOBasic_WriteInfo: Internal error in reduction '%s'", + operator); + retval = -2; + } } else { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Reduction operator '%s' doesn't exist or failed internally", operator); - retval = -27; + "IOBasic_WriteInfo: Reduction operator '%s' not found", + operator); + retval = -1; } return retval; |