From 595959f2baa67365e7f6a90dab9e450b0de06050 Mon Sep 17 00:00:00 2001 From: Bob Caddy Date: Wed, 9 Aug 2023 10:12:23 -0400 Subject: [PATCH] Update boundary condition check message --- src/utils/error_handling.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/utils/error_handling.cpp b/src/utils/error_handling.cpp index 38374c704..37e527ca8 100644 --- a/src/utils/error_handling.cpp +++ b/src/utils/error_handling.cpp @@ -2,6 +2,7 @@ #include #include +#include #ifdef MPI_CHOLLA #include @@ -55,18 +56,20 @@ void Check_Configuration(parameters const &P) #endif // Only one integrator check // Check the boundary conditions - auto Check_Boundary = [](int const &boundary) { + auto Check_Boundary = [](int const &boundary, std::string const &direction) { bool is_allowed_bc = boundary >= 0 and boundary <= 4; - assert(is_allowed_bc && - "WARNING: Possibly invalid boundary conditions for direction: %d flag: %d. Must select between (periodic), " - "2 (reflective), 3 (transmissive), 4 (custom), 5 (mpi).\n"); + std::string const error_message = + "WARNING: Possibly invalid boundary conditions for direction: " + direction + + " flag: " + std::to_string(boundary) + + ". Must select between 0 (no boundary), 1 (periodic), 2 (reflective), 3 (transmissive), 4 (custom), 5 (mpi)."; + assert(is_allowed_bc && error_message.c_str()); }; - Check_Boundary(P.xl_bcnd); - Check_Boundary(P.xu_bcnd); - Check_Boundary(P.yl_bcnd); - Check_Boundary(P.yu_bcnd); - Check_Boundary(P.zl_bcnd); - Check_Boundary(P.zu_bcnd); + Check_Boundary(P.xl_bcnd, "xl_bcnd"); + Check_Boundary(P.xu_bcnd, "xu_bcnd"); + Check_Boundary(P.yl_bcnd, "yl_bcnd"); + Check_Boundary(P.yu_bcnd, "yu_bcnd"); + Check_Boundary(P.zl_bcnd, "zl_bcnd"); + Check_Boundary(P.zu_bcnd, "zu_bcnd"); // warn if error checking is disabled #ifndef CUDA_ERROR_CHECK