From 03115fde61c9671e92490dfd9b86f68d75ecd1e4 Mon Sep 17 00:00:00 2001 From: Piotr Dziekan Date: Thu, 13 Apr 2023 14:26:56 +0200 Subject: [PATCH] add 'libmpdata++' to all runtime errors --- libmpdata++/concurr/detail/concurr_common.hpp | 2 +- libmpdata++/concurr/detail/distmem.hpp | 4 ++-- libmpdata++/concurr/detail/sharedmem.hpp | 16 ++++++++-------- libmpdata++/output/gnuplot.hpp | 6 +++--- .../solvers/detail/mpdata_rhs_vip_prs_common.hpp | 2 +- .../detail/mpdata_rhs_vip_prs_sgs_dns.hpp | 2 +- .../detail/mpdata_rhs_vip_prs_sgs_smg.hpp | 2 +- libmpdata++/solvers/detail/solver_2d.hpp | 2 +- libmpdata++/solvers/detail/solver_3d.hpp | 2 +- libmpdata++/solvers/detail/solver_common.hpp | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libmpdata++/concurr/detail/concurr_common.hpp b/libmpdata++/concurr/detail/concurr_common.hpp index 49e53eeb..c1edb658 100644 --- a/libmpdata++/concurr/detail/concurr_common.hpp +++ b/libmpdata++/concurr/detail/concurr_common.hpp @@ -201,7 +201,7 @@ namespace libmpdataxx { // sanity check - polar coords do not work with MPI yet if (type == bcond::polar && mem->distmem.size() > 1) - throw std::runtime_error("Polar boundary conditions do not work with MPI."); + throw std::runtime_error("libmpdata++: Polar boundary conditions do not work with MPI."); // distmem overrides if (mem->distmem.size() > 1 && dim == 0) diff --git a/libmpdata++/concurr/detail/distmem.hpp b/libmpdata++/concurr/detail/distmem.hpp index d17503f0..44c8e181 100644 --- a/libmpdata++/concurr/detail/distmem.hpp +++ b/libmpdata++/concurr/detail/distmem.hpp @@ -173,7 +173,7 @@ namespace libmpdataxx std::getenv("OMPI_COMM_WORLD_RANK") != NULL && std::atoi(std::getenv("OMPI_COMM_WORLD_SIZE")) > 1 || // lam std::getenv("LAMRANK") != NULL && std::atoi(std::getenv("LAMSIZE")) > 1 - ) throw std::runtime_error("mpirun environment variable detected but libmpdata++ was compiled with MPI disabled"); + ) throw std::runtime_error("libmpdata++: mpirun environment variable detected but libmpdata++ was compiled with MPI disabled"); #else // init mpi here, since distmem is constructed before hdf5 // will be finalized in slvr_common dtor, since distmem is destructed before hdf5; @@ -188,7 +188,7 @@ namespace libmpdataxx } if (boost::mpi::environment::thread_level() != boost::mpi::threading::multiple) { - throw std::runtime_error("failed to initialise MPI environment with MPI_THREAD_MULTIPLE"); + throw std::runtime_error("libmpdata++: failed to initialise MPI environment with MPI_THREAD_MULTIPLE"); } mpicom = boost::mpi::communicator(MPI_COMM_WORLD, boost::mpi::comm_duplicate); // use a duplicate of MPI_COMM_WORLD, can't construct it before MPI_Init call (?) #endif diff --git a/libmpdata++/concurr/detail/sharedmem.hpp b/libmpdata++/concurr/detail/sharedmem.hpp index f6ae1c5e..b73fce5d 100644 --- a/libmpdata++/concurr/detail/sharedmem.hpp +++ b/libmpdata++/concurr/detail/sharedmem.hpp @@ -104,7 +104,7 @@ namespace libmpdataxx } if (size > grid_size[0]) - throw std::runtime_error("number of subdomains greater than number of gridpoints"); + throw std::runtime_error("libmpdata++: number of subdomains greater than number of gridpoints"); if (n_dims != 1) sumtmp.reset(new blitz::Array(this->grid_size[shmem_decomp_dim])); @@ -374,7 +374,7 @@ namespace libmpdataxx { // a sanity check if (this->G.get() == nullptr) - throw std::runtime_error("g_factor() called with nug option unset?"); + throw std::runtime_error("libmpdata++: g_factor() called with nug option unset?"); // the same logic as in advectee() - see above return (*this->G)( @@ -459,7 +459,7 @@ namespace libmpdataxx { // a sanity check if (this->G.get() == nullptr) - throw std::runtime_error("g_factor() called with nug option unset?"); + throw std::runtime_error("libmpdata++: g_factor() called with nug option unset?"); // the same logic as in advectee() - see above return (*this->G)( @@ -472,7 +472,7 @@ namespace libmpdataxx { // a sanity check if (this->vab_coeff.get() == nullptr) - throw std::runtime_error("vab_coeff() called with option vip_vab unset?"); + throw std::runtime_error("libmpdata++: vab_coeff() called with option vip_vab unset?"); // the same logic as in advectee() - see above return (*this->vab_coeff)( @@ -486,7 +486,7 @@ namespace libmpdataxx assert(d == 0 || d== 1); // a sanity check if (this->vab_coeff.get() == nullptr) - throw std::runtime_error("vab_relaxed_state() called with option vip_vab unset?"); + throw std::runtime_error("libmpdata++: vab_relaxed_state() called with option vip_vab unset?"); // the same logic as in advectee() - see above return this->vab_relax[d]( this->grid_size[0], @@ -580,7 +580,7 @@ namespace libmpdataxx { // a sanity check if (this->G.get() == nullptr) - throw std::runtime_error("g_factor() called with nug option unset?"); + throw std::runtime_error("libmpdata++: g_factor() called with nug option unset?"); // the same logic as in advectee() - see above return (*this->G)( @@ -594,7 +594,7 @@ namespace libmpdataxx { // a sanity check if (this->vab_coeff.get() == nullptr) - throw std::runtime_error("vab_coeff() called with option vip_vab unset?"); + throw std::runtime_error("libmpdata++: vab_coeff() called with option vip_vab unset?"); // the same logic as in advectee() - see above return (*this->vab_coeff)( @@ -609,7 +609,7 @@ namespace libmpdataxx assert(d == 0 || d == 1 || d == 2); // a sanity check if (this->vab_coeff.get() == nullptr) - throw std::runtime_error("vab_relaxed_state() called with option vip_vab unset?"); + throw std::runtime_error("libmpdata++: vab_relaxed_state() called with option vip_vab unset?"); // the same logic as in advectee() - see above return this->vab_relax[d]( this->grid_size[0], diff --git a/libmpdata++/output/gnuplot.hpp b/libmpdata++/output/gnuplot.hpp index 2b02d2ed..9ffd8f4d 100644 --- a/libmpdata++/output/gnuplot.hpp +++ b/libmpdata++/output/gnuplot.hpp @@ -77,16 +77,16 @@ namespace libmpdataxx << "set ticslevel " << p.gnuplot_ticslevel << "\n"; if (p.gnuplot_xyplane_at != "") *gp << "set xyplane at " << p.gnuplot_xyplane_at << "\n"; if (p.gnuplot_yrange != "[*:*]") - throw std::runtime_error("gnupot_yrange was specified for a 1D splot where Y axis represents time"); + throw std::runtime_error("libmpdata++: gnupot_yrange was specified for a 1D splot where Y axis represents time"); if (p.gnuplot_ylabel == "") *gp << "set ylabel 't/dt'\n"; } else if (p.gnuplot_command == "plot") { - if (p.gnuplot_with != "histeps") throw std::runtime_error("histeps is the only meaningfull style for 1D plots"); + if (p.gnuplot_with != "histeps") throw std::runtime_error("libmpdata++: histeps is the only meaningfull style for 1D plots"); *gp << "set yrange " << p.gnuplot_yrange << "\n"; } - else throw std::runtime_error("gnuplot_command must equal plot or splot"); + else throw std::runtime_error("libmpdata++: gnuplot_command must equal plot or splot"); *gp << "set output '" << p.gnuplot_output; diff --git a/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_common.hpp b/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_common.hpp index d014a882..7ea735b1 100644 --- a/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_common.hpp +++ b/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_common.hpp @@ -121,7 +121,7 @@ namespace libmpdataxx if (iters > 10000) // going beyond 10000 iters means something is really wrong, // usually boundary conditions but not always ! { - throw std::runtime_error("stuck in pressure solver"); + throw std::runtime_error("libmpdata++: stuck in pressure solver"); } } diff --git a/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_dns.hpp b/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_dns.hpp index 50abd128..fed38f27 100644 --- a/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_dns.hpp +++ b/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_dns.hpp @@ -56,7 +56,7 @@ namespace libmpdataxx parent_t(args, p), eta(p.eta) { - if (eta == 0) throw std::runtime_error("eta == 0"); + if (eta == 0) throw std::runtime_error("libmpdata++: eta == 0"); } }; } // namespace detail diff --git a/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_smg.hpp b/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_smg.hpp index 44aab6b6..b9615221 100644 --- a/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_smg.hpp +++ b/libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_smg.hpp @@ -73,7 +73,7 @@ namespace libmpdataxx c_m(p.c_m), k_m(args.mem->tmp[__FILE__][0][0]) { - if (smg_c == 0) throw std::runtime_error("smg_c == 0"); + if (smg_c == 0) throw std::runtime_error("libmpdata++: smg_c == 0"); } static void alloc( diff --git a/libmpdata++/solvers/detail/solver_2d.hpp b/libmpdata++/solvers/detail/solver_2d.hpp index fa8876f4..53175240 100644 --- a/libmpdata++/solvers/detail/solver_2d.hpp +++ b/libmpdata++/solvers/detail/solver_2d.hpp @@ -213,7 +213,7 @@ namespace libmpdataxx real_t max_abs_div = max_abs_vctr_div(this->mem->GC); if (max_abs_div > this->max_abs_div_eps) - throw std::runtime_error("initial advector field is divergent"); + throw std::runtime_error("libmpdata++: initial advector field is divergent"); } } diff --git a/libmpdata++/solvers/detail/solver_3d.hpp b/libmpdata++/solvers/detail/solver_3d.hpp index ea62aac9..811ab100 100644 --- a/libmpdata++/solvers/detail/solver_3d.hpp +++ b/libmpdata++/solvers/detail/solver_3d.hpp @@ -292,7 +292,7 @@ namespace libmpdataxx real_t max_abs_div = max_abs_vctr_div(this->mem->GC); if (max_abs_div > this->max_abs_div_eps) - throw std::runtime_error("initial advector field is divergent"); + throw std::runtime_error("libmpdata++: initial advector field is divergent"); } } diff --git a/libmpdata++/solvers/detail/solver_common.hpp b/libmpdata++/solvers/detail/solver_common.hpp index 5aab5f07..9ee57184 100644 --- a/libmpdata++/solvers/detail/solver_common.hpp +++ b/libmpdata++/solvers/detail/solver_common.hpp @@ -243,7 +243,7 @@ namespace libmpdataxx // run-time sanity checks for (int d = 0; d < n_dims; ++d) if (p.grid_size[d] < 1) - throw std::runtime_error("bogus grid size"); + throw std::runtime_error("libmpdata++: bogus grid size"); } // dtor