From 85af1ac5a15668e35ed271c2741f9baf9b647dc1 Mon Sep 17 00:00:00 2001 From: schnetter Date: Sun, 27 Feb 2005 14:24:12 +0000 Subject: Analyse the options table more gracefully, and abort with a nice error message if something is wrong. git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/SummationByParts/trunk@29 f69c4107-0314-4c4f-9ad4-17e986b73f4a --- src/call_derivs.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/call_derivs.c b/src/call_derivs.c index d42a77b..2932e24 100644 --- a/src/call_derivs.c +++ b/src/call_derivs.c @@ -1,9 +1,9 @@ #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_Arguments.h" -#include "util_Table.h" -#include +#include "util_ErrorCodes.h" +#include "util_Table.h" void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, const CCTK_REAL *var, CCTK_REAL *dvar, @@ -78,7 +78,11 @@ void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, if ( table_handle >=0 ) { nelements = Util_TableGetInt ( table_handle, &loc_order, "order" ); - assert(nelements>0); + if ( nelements == UTIL_ERROR_TABLE_NO_SUCH_KEY ) { + loc_order = order; + } else if ( nelements != 1) { + CCTK_WARN (0, "The options table has an entry \"order\", but it does not have the right properties"); + } } else { loc_order = order; } @@ -103,7 +107,7 @@ void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, break; } default: - assert(0); + CCTK_WARN (0, "Wrong direction specified"); } if ( CCTK_Equals(norm_type,"Diagonal") ) { @@ -125,7 +129,7 @@ void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, break; } default: - assert(0); + CCTK_WARN (0, "Unknown stencil specified"); } } else { switch(loc_order) { @@ -138,7 +142,7 @@ void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, break; } default: - assert(0); + CCTK_WARN (0, "Unknown stencil specified"); } } } -- cgit v1.2.3