From 79978d173f0a7354e22419d2665edc734e3cee69 Mon Sep 17 00:00:00 2001 From: jthorn Date: Fri, 1 Aug 2003 17:01:39 +0000 Subject: 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 --- doc/documentation.tex | 22 +++++++++++++++---- src/InterpLocalUniform.c | 25 +++++++++++++++++++++- src/InterpLocalUniform.h | 4 ++++ src/template.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 5 deletions(-) diff --git a/doc/documentation.tex b/doc/documentation.tex index 2883518..c1e2723 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -520,8 +520,9 @@ Interpolation Operator & Order & Size \subsection{Handling of Grid Boundaries} \label{AEIThorns/AEILocalInterp/sect-grid-boundaries} -Near grid boundaries and/or excised points the interpolator can either -off-center the interpolation molecules, or refuse to interpolate +If an interpolation point is too near a grid boundary and/or an +excised region the interpolator can either off-center the interpolation +molecule, or refuse to interpolate that point (returning a \verb|CCTK_INTERP_ERROR_POINT_OUTSIDE|\,%%% \footnote{%%% For backwards compatability the error code @@ -529,8 +530,9 @@ off-center the interpolation molecules, or refuse to interpolate is also defined; it's a synonym for {\tt CCTK\_INTERP\_ERROR\_POINT\_OUTSIDE}. }%%% -{} or \verb|CCTK_INTERP_ERROR_POINT_EXCISED| error code). This behavior -is controlled by the (optional) parameter-table entries +{} or \verb|CCTK_INTERP_ERROR_POINT_EXCISED| error code, and possibly +also printing a warning message). This behavior is controlled by the +(optional) parameter-table entries \begin{verbatim} const CCTK_INT N_boundary_points_to_omit[2*N_dims] const CCTK_REAL boundary_off_centering_tolerance[2*N_dims] @@ -814,6 +816,18 @@ This would leave Lagrange interpolation unchanged, while for Hermite interpolation the defaults would forbid any significant off-centering of the interpolation molecules.] +%%%%%%%%%%%%%%%%%%%% + +\subsubsection{Suppressing Warning Messages about Off-Centering} + +By default, \thorn{AEILocalInterp} prints a Cactus level~1 warning +message for each interpolation point which causes it to return a +\verb|CCTK_INTERP_ERROR_POINT_OUTSIDE| or +\verb|CCTK_INTERP_ERROR_POINT_EXCISED| error code. If the key +\verb|suppress_warnings| is present in the parameter table +(it may have any datatype and value), then these messages are +not printed. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Per-Point Status Reporting} 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; -- cgit v1.2.3