diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-06-07 14:20:42 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-06-07 14:20:42 +0000 |
commit | 21315b44f93b27982fbcc9ce60194f03f1b87871 (patch) | |
tree | 3b622938526a204c49810c1eadf8b199848d7b71 /src | |
parent | 58bb180664a3f6e8bc515bb64922fc25e88117a5 (diff) |
[[from Jonathan Thornburg]]
Improve error checking for nonexistent interpolation operators:
* Instead of just testing that *some* operator is registered under
this handle, also test that the particular operator being called
is registered.
* Upgrade the test-failed warning for this test (i.e. the warning
you get if you try to use an unregistered interpolation operator)
from level 3 to level 0 ==> should always abort the Cactus run
rather than going ahead and trying to call through a null function
pointer and core-dumping.
* Add a hint to the error message about one common cause of this
problem, eg
CCTK_InterpGV(): no interpolation operator is registered
under the handle 1
(did you activate PUGHInterp or some other thorn
providing this interpolation operator?
CCTK_InterpLocal(): no interpolation operator is registered
under the handle 1
(did you activate LocalInterp or some other thorn
providing this interpolation operator?
CCTK_InterpLocalUniform(): no interpolation operator is registered
under the handle 1
(did you activate LocalInterp or some other thorn
providing this interpolation operator?
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2901 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/comm/Interp.c | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/src/comm/Interp.c b/src/comm/Interp.c index 51a11766..e84c8f2f 100644 --- a/src/comm/Interp.c +++ b/src/comm/Interp.c @@ -260,7 +260,7 @@ const char *CCTK_InterpOperatorImplementation(int handle) \ if (operator_ptr_fnarg == NULL) \ { \ - CCTK_VWarn(1, __LINE__, __FILE__, "Cactus", \ + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", \ function_name_string ":\n" \ " (called from thorn %s)\n" \ " NULL function pointer passed\n" \ @@ -282,7 +282,7 @@ const char *CCTK_InterpOperatorImplementation(int handle) /* check that the operator isn't already registered */ \ if (p_interp_info->struct_field_name != NULL) \ { \ - CCTK_VWarn(1, __LINE__, __FILE__, "Cactus", \ + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", \ function_name_string ":\n" \ " (called from thorn %s)\n" \ " Ignoring attempt to register operator \"%s\"\n" \ @@ -683,10 +683,16 @@ int CCTK_InterpGV (cGH *GH, operator_handle); coord_system = CCTK_CoordSystemName (coord_system_handle); - if (operator == NULL) + if ((operator == NULL) || (operator->interp_operator_GV == NULL)) { - CCTK_Warn (3, __LINE__, __FILE__, "Cactus", - "CCTK_InterpGV: Invalid interpolation operator handle passed to CCTK_InterpGV"); + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", +"\n" +" CCTK_InterpGV(): no interpolation operator is registered\n" +" under the handle %d\n" +" (did you activate PUGHInterp or some other thorn\n" +" providing this interpolation operator?)" + , + operator_handle); retcode = -1; } else if (coord_system == NULL) @@ -758,17 +764,22 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpGV) *operator_handle); coord_system = CCTK_CoordSystemName (*coord_system_handle); - if (operator == NULL) + if ((operator == NULL) || (operator->interp_operator_GV == NULL)) { - CCTK_Warn (3, __LINE__, __FILE__, "Cactus", - "CCTK_InterpGV: " - "Invalid interpolation operator handle passed to CCTK_InterpGV"); + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", +"\n" +" CCTK_InterpGV(): no interpolation operator is registered\n" +" under the handle %d\n" +" (did you activate PUGHInterp or some other thorn\n" +" providing this interpolation operator?)" + , + *operator_handle); retcode = -1; } else if (coord_system == NULL) { - CCTK_Warn (3, __LINE__, __FILE__, "Cactus", - "CCTK_InterpGV: Invalid coordinate system handle passed to CCTK_InterpGV"); + CCTK_Warn (0, __LINE__, __FILE__, "Cactus", +"CCTK_InterpGV: Invalid coordinate system handle passed to CCTK_InterpGV"); retcode = -1; } else @@ -924,12 +935,14 @@ int CCTK_InterpLocal (cGH *GH, /* Get the interpolation operator */ operator = (struct interp_info *) Util_GetHandledData (interp_operators, operator_handle); - if (operator == NULL) + if ((operator == NULL) || (operator->interp_operator_local == NULL)) { - CCTK_VWarn(3, __LINE__, __FILE__, "Cactus", + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", "\n" " CCTK_InterpLocal(): no interpolation operator is registered\n" -" under the handle %d" +" under the handle %d\n" +" (did you activate LocalInterp or some other thorn\n" +" providing this interpolation operator?)" , operator_handle); retcode = -1; @@ -1007,12 +1020,14 @@ void CCTK_FCALL CCTK_FNAME (CCTK_InterpLocal) /* Get the interpolation operator */ operator = (struct interp_info *) Util_GetHandledData (interp_operators, *operator_handle); - if (operator == NULL) + if ((operator == NULL) || (operator->interp_operator_local == NULL)) { - CCTK_VWarn(3, __LINE__, __FILE__, "Cactus", + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", "\n" " CCTK_InterpLocal(): no interpolation operator is registered\n" -" under the handle %d" +" under the handle %d\n" +" (did you activate LocalInterp or some other thorn\n" +" providing this interpolation operator?)" , *operator_handle); retcode = -1; @@ -1209,12 +1224,15 @@ int CCTK_InterpLocalUniform(int N_dims, const struct interp_info *p_interp_info = (struct interp_info *)Util_GetHandledData(interp_operators, operator_handle); - if (p_interp_info == NULL) + if ( (p_interp_info == NULL) + || (p_interp_info->interp_op_local_uniform == NULL) ) { - CCTK_VWarn(3, __LINE__, __FILE__, "Cactus", + CCTK_VWarn(0, __LINE__, __FILE__, "Cactus", "\n" " CCTK_InterpLocalUniform(): no interpolation operator is registered\n" -" under the handle %d" +" under the handle %d\n" +" (did you activate LocalInterp or some other thorn\n" +" providing this interpolation operator?)" , operator_handle); return UTIL_ERROR_BAD_HANDLE; |