aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@f69c4107-0314-4c4f-9ad4-17e986b73f4a>2005-02-27 14:24:12 +0000
committerschnetter <schnetter@f69c4107-0314-4c4f-9ad4-17e986b73f4a>2005-02-27 14:24:12 +0000
commit85af1ac5a15668e35ed271c2741f9baf9b647dc1 (patch)
tree3ef3aa74ab2c846c77f8484a3132e3edc1ba4e0f
parentd6111c2ac4d5acad4c2b1cfa0141aa59e1be1b96 (diff)
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
-rw-r--r--src/call_derivs.c16
1 files 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 <assert.h>
+#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");
}
}
}