aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjthorn <jthorn@0f49ee68-0e4f-0410-9b9c-b2c123ded7ef>2003-08-01 17:01:39 +0000
committerjthorn <jthorn@0f49ee68-0e4f-0410-9b9c-b2c123ded7ef>2003-08-01 17:01:39 +0000
commit79978d173f0a7354e22419d2665edc734e3cee69 (patch)
treea918398655055234280ab35a6f5ec66f9ce8c946 /src
parent0e22802fd9f269731fa8035eff7617174bc743c5 (diff)
by default,
print a level 1 warning if we return an error code due to a point being outside (or too close to the boundary of) the grid if the key "suppress_warnings" is in the parameter table, don't print these warnings git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/AEILocalInterp/trunk@12 0f49ee68-0e4f-0410-9b9c-b2c123ded7ef
Diffstat (limited to 'src')
-rw-r--r--src/InterpLocalUniform.c25
-rw-r--r--src/InterpLocalUniform.h4
-rw-r--r--src/template.c55
3 files changed, 83 insertions, 1 deletions
diff --git a/src/InterpLocalUniform.c b/src/InterpLocalUniform.c
index 76882d4..860e085 100644
--- a/src/InterpLocalUniform.c
+++ b/src/InterpLocalUniform.c
@@ -1735,7 +1735,6 @@ int status;
status = Util_TableGetPointer(param_table_handle,
&per_point_status,
"per_point_status");
-
if (status == 1)
then {
p_error_info->found_per_point_status = true;
@@ -1756,6 +1755,30 @@ else {
return status; /*** ERROR RETURN ***/
}
+status = Util_TableQueryValueInfo(param_table_handle,
+ NULL, NULL,
+ "suppress_warnings");
+if (status == 1)
+ then {
+ /* key "suppress_warnings" is in table ==> no warning msgs */
+ p_error_info->print_warning_msg = false;
+ }
+else if (status == 0)
+ then {
+ /* key "suppress_warnings" is NOT in table */
+ /* ==> leave warning msgs on by default*/
+ p_error_info->print_warning_msg = true;
+ }
+else {
+ CCTK_VWarn(ERROR_MSG_SEVERITY_LEVEL,
+ __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" CCTK_InterpLocalUniform(): bad \"suppress_warnings\" table entry!\n"
+" error status=%d",
+ status);
+ return status; /*** ERROR RETURN ***/
+ }
+
return 0; /*** NORMAL RETURN ***/
}
diff --git a/src/InterpLocalUniform.h b/src/InterpLocalUniform.h
index 3515ff0..85fd0e6 100644
--- a/src/InterpLocalUniform.h
+++ b/src/InterpLocalUniform.h
@@ -144,6 +144,10 @@ struct error_info
/* did we find error_point_status in the parameter table? */
bool found_per_point_status;
+ /* should we print a Cactus level WARNING_MSG_SEVERITY_LEVEL */
+ /* warning message if we find a point in error? */
+ bool print_warning_msg;
+
/* NULL pointer to skip per-point status, or */
/* --> array of size N_interp_points to be set to per-point status */
CCTK_INT* per_point_status;
diff --git a/src/template.c b/src/template.c
index 6cce81c..6c46e4e 100644
--- a/src/template.c
+++ b/src/template.c
@@ -977,6 +977,61 @@ fflush(stdout);
then {
++error_info->error_count;
+ if (error_info->print_warning_msg)
+ then {
+ fp grid_min_xyz[MAX_N_DIMS], grid_max_xyz[MAX_N_DIMS];
+ for (axis = 0 ; axis < N_DIMS ; ++axis)
+ {
+ grid_min_xyz[axis]
+ = coord_origin[axis]
+ + input_array_min_subscripts[axis]*coord_delta[axis];
+ grid_max_xyz[axis]
+ = coord_origin[axis]
+ + input_array_max_subscripts[axis]*coord_delta[axis];
+ }
+ CCTK_VWarn(WARNING_MSG_SEVERITY_LEVEL,
+ __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" CCTK_InterpLocalUniform():\n"
+" interpolation point is either outside the grid,\n"
+" or inside but too close to the grid boundary!\n"
+" 0-origin interpolation point number pt=%d\n"
+" 0-origin coordinate axis=%d\n"
+#if (N_DIMS == 1)
+" interpolation point x=%g\n"
+" grid [x_min,x_max] = [%g,%g]\n"
+#elif (N_DIMS == 2)
+" interpolation point (x,y)=(%g,%g)\n"
+" grid [x_min,x_max] = [%g,%g]\n"
+" grid [y_min,y_max] = [%g,%g]\n"
+#elif (N_DIMS == 3)
+" interpolation point (x,y,z)=(%g,%g,%g)\n"
+" grid [x_min,x_max] = [%g,%g]\n"
+" grid [y_min,y_max] = [%g,%g]\n"
+" grid [z_min,z_max] = [%g,%g]\n"
+#else
+ #error "N_DIMS may not be > 3!"
+#endif
+ ,
+ pt, axis,
+ #if (N_DIMS == 1)
+ (double) interp_coords_fp[X_AXIS],
+ (double) grid_min_xyz[X_AXIS], (double) grid_max_xyz[X_AXIS]);
+ #elif (N_DIMS == 2)
+ (double) interp_coords_fp[X_AXIS], (double) interp_coords_fp[Y_AXIS],
+ (double) grid_min_xyz[X_AXIS], (double) grid_max_xyz[X_AXIS],
+ (double) grid_min_xyz[Y_AXIS], (double) grid_max_xyz[Y_AXIS]);
+ #elif (N_DIMS == 3)
+ (double) interp_coords_fp[X_AXIS], (double) interp_coords_fp[Y_AXIS],
+ (double) interp_coords_fp[Z_AXIS],
+ (double) grid_min_xyz[X_AXIS], (double) grid_max_xyz[X_AXIS],
+ (double) grid_min_xyz[Y_AXIS], (double) grid_max_xyz[Y_AXIS],
+ (double) grid_min_xyz[Z_AXIS], (double) grid_max_xyz[Z_AXIS]);
+ #else
+ #error "N_DIMS may not be > 3!"
+ #endif
+ }
+
if (this_point_status < return_status)
then return_status = this_point_status;