diff options
Diffstat (limited to 'src/GeneralizedPolynomial-Uniform/InterpLocalUniform.c')
-rw-r--r-- | src/GeneralizedPolynomial-Uniform/InterpLocalUniform.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/GeneralizedPolynomial-Uniform/InterpLocalUniform.c b/src/GeneralizedPolynomial-Uniform/InterpLocalUniform.c index f6982ac..b4eef31 100644 --- a/src/GeneralizedPolynomial-Uniform/InterpLocalUniform.c +++ b/src/GeneralizedPolynomial-Uniform/InterpLocalUniform.c @@ -348,23 +348,26 @@ return LocalInterp_InterpLocalUniform(interp_operator_Hermite, @vtype CCTK_INT order @endvar - @var out_of_range_tolerance + @var out_of_range_tolerance, @vdesc Specifies how out-of-range interpolation points should - be handled: - If out_of_range_tolerance[axis] >= 0.0, + be handled. The array elements are matched up with + the axes and minimum/maximum ends of the grid in the + order [x_min, x_max, y_min, y_max, z_min, z_max, ...]. + An array value TOL is interpreted as follows: + If TOL >= 0.0, then an interpolation point is considered to be "out of range" if and only if the interpolation - point is > out_of_range_tolerance[axis] - * coord_delta[axis] - outside the grid in any coordinate. - If out_of_range_tolerance[axis] == -1.0, + point is > TOL * coord_delta[axis] + outside the grid in this coordinate direction. + If TOL == -1.0, then an interpolation point is considered to be "out of range" if and only if a centered molecule (or more generally, a molecule whose centering is chosen pretending that the grid is of infinite - extent), would require data from outside the grid. - Other values of out_of_range_tolerance[axis] are illegal. - @vtype const CCTK_REAL out_of_range_tolerance[N_dims] + extent), would require data from outside the grid + in this direction. + Other values of TOL are illegal. + @vtype const CCTK_REAL out_of_range_tolerance[2*N_dims] @endvar @var input_array_offsets @@ -710,34 +713,38 @@ if ((order < 1) || (order > MAX_ORDER)) * out-of-range interpolation-point handling */ { -CCTK_REAL out_of_range_tolerance[MAX_N_DIMS]; +CCTK_REAL out_of_range_tolerance[2*MAX_N_DIMS]; +const int N_tolerances = 2*N_dims; status = Util_TableGetRealArray(param_table_handle, - N_dims, out_of_range_tolerance, + N_tolerances, out_of_range_tolerance, "out_of_range_tolerance"); if (status == UTIL_ERROR_TABLE_NO_SUCH_KEY) then { /* default */ - int axis; - for (axis = 0 ; axis < N_dims ; ++axis) + int tol_index; + for (tol_index = 0 ; tol_index < N_tolerances ; ++tol_index) { - out_of_range_tolerance[axis] = OUT_OF_RANGE_TOLERANCE_DEFAULT; + out_of_range_tolerance[tol_index] + = OUT_OF_RANGE_TOLERANCE_DEFAULT; } } -else if (status == N_dims) +else if (status == N_tolerances) then { /* check that all values are valid */ - int axis; - for (axis = 0 ; axis < N_dims ; ++axis) + int tol_index; + for (tol_index = 0 ; tol_index < N_tolerances ; ++tol_index) { - if (! ( (out_of_range_tolerance[axis] >= 0.0) - || (out_of_range_tolerance[axis] == -1.0) ) ) + if (! ( (out_of_range_tolerance[tol_index] >= 0.0) + || (out_of_range_tolerance[tol_index] == -1.0) ) ) then { CCTK_VWarn(ERROR_MSG_SEVERITY_LEVEL, __LINE__, __FILE__, CCTK_THORNSTRING, "\n" -" CCTK_InterpLocalUniform(): invalid out_of_range_tolerance[axis=%d] = %g!\n" -" (valid values are -1.0 or >= 0.0)", - axis, out_of_range_tolerance[axis]); +" CCTK_InterpLocalUniform():\n" +" invalid out_of_range_tolerance[tol_index=%d] = %g!\n" +" (valid values are -1.0 or >= 0.0)", + tol_index, + out_of_range_tolerance[tol_index]); return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ } } |