Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update boundary condition check message #317

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/utils/error_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cassert>
#include <iostream>
#include <string>

#ifdef MPI_CHOLLA
#include <mpi.h>
Expand Down Expand Up @@ -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
Expand Down