Skip to content

Commit

Permalink
Merge pull request #491 from pdziekan/rename_error_msg
Browse files Browse the repository at this point in the history
add 'libmpdata++' to all runtime errors
  • Loading branch information
pdziekan committed Apr 13, 2023
2 parents 46b15dc + 03115fd commit 0752cb6
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion libmpdata++/concurr/detail/concurr_common.hpp
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions libmpdata++/concurr/detail/distmem.hpp
Expand Up @@ -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;
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions libmpdata++/concurr/detail/sharedmem.hpp
Expand Up @@ -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<double, 1>(this->grid_size[shmem_decomp_dim]));
Expand Down Expand Up @@ -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)(
Expand Down Expand Up @@ -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)(
Expand All @@ -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)(
Expand All @@ -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],
Expand Down Expand Up @@ -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)(
Expand All @@ -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)(
Expand All @@ -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],
Expand Down
6 changes: 3 additions & 3 deletions libmpdata++/output/gnuplot.hpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libmpdata++/solvers/detail/mpdata_rhs_vip_prs_common.hpp
Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_dns.hpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libmpdata++/solvers/detail/mpdata_rhs_vip_prs_sgs_smg.hpp
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion libmpdata++/solvers/detail/solver_2d.hpp
Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion libmpdata++/solvers/detail/solver_3d.hpp
Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion libmpdata++/solvers/detail/solver_common.hpp
Expand Up @@ -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
Expand Down

0 comments on commit 0752cb6

Please sign in to comment.