From 5a829d54ecca797d8ff3d5bf09174e69a2db2143 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Tue, 20 Dec 2011 15:35:19 -0500 Subject: CarpetInterp2: Improve error message Give more information in error message. Rename macro. Correct typo. --- Carpet/CarpetInterp2/src/fasterp.cc | 60 ++++++++++++++++++------------------- Carpet/CarpetInterp2/src/fasterp.hh | 8 ++--- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'Carpet/CarpetInterp2') diff --git a/Carpet/CarpetInterp2/src/fasterp.cc b/Carpet/CarpetInterp2/src/fasterp.cc index be0acfc74..54848d6dc 100644 --- a/Carpet/CarpetInterp2/src/fasterp.cc +++ b/Carpet/CarpetInterp2/src/fasterp.cc @@ -84,7 +84,7 @@ namespace CarpetInterp2 { } dist::mpi_struct_descr_t const descr[] = { ENTRY(int, mrc), -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK ENTRY(int, pn), ENTRY(int, ipos), ENTRY(int, ind), @@ -109,7 +109,7 @@ namespace CarpetInterp2 { { os << "fasterp_iloc_t{" << "mrc=" << mrc << "," -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK << "pn=" << pn << "," << "ipos=" << ipos << "," << "ind=" << ind << "," @@ -198,7 +198,7 @@ namespace CarpetInterp2 { assert (order <= max_order); CCTK_REAL const eps = 1.0e-12; -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK mrc = iloc.mrc; pn = iloc.pn; ipos = iloc.ipos; @@ -222,7 +222,7 @@ namespace CarpetInterp2 { exact[d] = true; } -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK ind = iloc.ind; #endif ind3d = iloc.ind3d; @@ -249,8 +249,7 @@ namespace CarpetInterp2 { // round is not available with PGI compilers // CCTK_REAL const rx = round(x); CCTK_REAL const rx = floor(x+0.5); -#warning "TODO: make eps a relative error my taking max(abs(xmin),abs(xmax)) into account" - if (abs(x - rx) < eps) { + if (abs(x - rx) < eps * (1.0 + abs(x))) { // The interpolation point coincides with a grid point; no // interpolation is necessary (this is a special case) iorigin[d] += int(rx); @@ -278,11 +277,12 @@ namespace CarpetInterp2 { } // Set 3D location of stencil anchor -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK ind = iloc.ind + iorigin; if (not (all (ind>=0 and ind+either(exact,0,order)=0 and ind+ivect(O0,O1,O2) recv_points (recv_descr.npoints * nvars); fill_with_poison (recv_points); vector recv_reqs (recv_descr.procs.size()); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK vector recv_pn (recv_descr.npoints); vector recv_reqs_pn (recv_descr.procs.size()); #endif @@ -1136,7 +1136,7 @@ namespace CarpetInterp2 { recv_proc.npoints * nvars, dist::mpi_datatype(), recv_proc.p, mpi_tag, comm_world, & recv_reqs.AT(pp)); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK MPI_Irecv (& recv_pn.AT(recv_proc.offset), recv_proc.npoints * 2, dist::mpi_datatype(), recv_proc.p, mpi_tag, @@ -1150,7 +1150,7 @@ namespace CarpetInterp2 { vector send_points (send_descr.npoints * nvars); fill_with_poison (send_points); vector send_reqs (send_descr.procs.size()); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK vector send_pn (send_descr.npoints); vector send_reqs_pn (send_descr.procs.size()); #endif @@ -1159,7 +1159,7 @@ namespace CarpetInterp2 { vector computed_points (send_proc.npoints * nvars); fill_with_poison (computed_points); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK vector computed_pn (send_descr.npoints); #endif for (size_t comp=0; comp(), send_proc.p, mpi_tag, comm_world, & send_reqs.AT(pp)); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK MPI_Isend (& send_pn.AT(send_proc.offset), send_proc.npoints * 2, dist::mpi_datatype(), send_proc.p, mpi_tag, @@ -1240,7 +1240,7 @@ namespace CarpetInterp2 { // Wait for Irecvs to complete if (verbose) CCTK_INFO ("Waiting for MPI_Irevcs to complete"); MPI_Waitall (recv_reqs.size(), & recv_reqs.front(), MPI_STATUSES_IGNORE); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK MPI_Waitall (recv_reqs.size(), & recv_reqs_pn.front(), MPI_STATUSES_IGNORE); #endif @@ -1255,7 +1255,7 @@ namespace CarpetInterp2 { recv_points.AT(nn * nvars + v) = poison; #endif } -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK assert (recv_pn.AT(nn).p == dist::rank()); assert (recv_pn.AT(nn).n == n); #endif @@ -1264,7 +1264,7 @@ namespace CarpetInterp2 { // Wait for Isends to complete if (verbose) CCTK_INFO ("Waiting for MPI_Isends to complete"); MPI_Waitall (send_reqs.size(), & send_reqs.front(), MPI_STATUSES_IGNORE); -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK MPI_Waitall (send_reqs.size(), & send_reqs_pn.front(), MPI_STATUSES_IGNORE); #endif diff --git a/Carpet/CarpetInterp2/src/fasterp.hh b/Carpet/CarpetInterp2/src/fasterp.hh index cad64a9df..5dc9cf2c1 100644 --- a/Carpet/CarpetInterp2/src/fasterp.hh +++ b/Carpet/CarpetInterp2/src/fasterp.hh @@ -17,7 +17,7 @@ // Define this at all times, because otherwise out-of-bounds // interpolations may not be detected early enough -#define CARPETINTER2_CHECK +#define CARPETINTERP2_CHECK @@ -144,7 +144,7 @@ namespace CarpetInterp2 { struct fasterp_iloc_t { mrc_t mrc; // map, refinement level, component -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK pn_t pn; // origin of this point ivect ipos; // closest grid point (Carpet indexing) ivect ind; // closest grid point (local indexing) @@ -172,7 +172,7 @@ namespace CarpetInterp2 { CCTK_REAL coeffs[dim][max_order+1]; // interpolation coefficients bvect exact; -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK public: pn_t pn; // origin of this point mrc_t mrc; // map, refinement level, component @@ -182,7 +182,7 @@ namespace CarpetInterp2 { #endif int ind3d; // source grid point offset -#ifdef CARPETINTER2_CHECK +#ifdef CARPETINTERP2_CHECK public: ivect saved_lsh; // copy of lsh private: -- cgit v1.2.3