Skip to content
Snippets Groups Projects
Unverified Commit 954f0b76 authored by Thorsten Hater's avatar Thorsten Hater Committed by GitHub
Browse files

Users may not give dt < 0. (#1821)

* Users may not give dt < 0 to simulation.run()
* Add and throw domain_error.
parent 2bf54047
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,8 @@ namespace arb {
using arb::util::pprintf;
domain_error::domain_error(const std::string& w): arbor_exception(w) {}
bad_cell_probe::bad_cell_probe(cell_kind kind, cell_gid_type gid):
arbor_exception(pprintf("recipe::get_grobe() is not supported for cell with gid {} of kind {})", gid, kind)),
gid(gid),
......
......@@ -28,6 +28,13 @@ struct arbor_exception: std::runtime_error {
{}
};
// Logic errors
// Argument violates domain constraints, eg ln(-1)
struct domain_error: arbor_exception {
domain_error(const std::string&);
};
// Recipe errors:
struct bad_cell_probe: arbor_exception {
......
......@@ -514,6 +514,9 @@ void simulation::reset() {
}
time_type simulation::run(time_type tfinal, time_type dt) {
if (dt <= 0.0) {
throw domain_error("Finite time-step must be supplied.");
}
return impl_->run(tfinal, dt);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment