Skip to content
Snippets Groups Projects
Commit 4a088c44 authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Dmitri Naumov
Browse files

[MaL] abort if no ODE solver can be created.

And also in the tests prevent abort if no ODE solver can be created.
parent 8ef89641
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,8 @@
#ifndef MATHLIB_ODE_ODESOLVERBUILDER_H
#define MATHLIB_ODE_ODESOLVERBUILDER_H
#include <logog/include/logog.hpp>
#include "ODESolver.h"
#include "ConcreteODESolver.h"
......@@ -38,9 +40,13 @@ std::unique_ptr<ODESolver<NumEquations>> createODESolver(
#ifdef CVODE_FOUND
return std::unique_ptr<ODESolver<NumEquations>>(
new ConcreteODESolver<CVodeSolver, NumEquations>(config));
#else
return nullptr;
#endif // CVODE_FOUND
#endif
(void)config; // Unused parameter warning if no library is available.
ERR(
"No ODE solver could be created. Maybe it is because you did not build"
" OGS6 with support for any external ODE solver library.");
std::abort();
}
//! @}
......
......@@ -66,6 +66,10 @@ template <unsigned NumEquations>
std::unique_ptr<MathLib::ODESolver<NumEquations>> make_ode_solver(
boost::property_tree::ptree const& conf)
{
// Make sure testrunner does not crash if we haven't built with support for
// any external ODE solver lib.
if (!any_ode_solver_libs_available()) return nullptr;
BaseLib::ConfigTree config(conf, "", BaseLib::ConfigTree::onerror,
BaseLib::ConfigTree::onwarning);
return MathLib::createODESolver<NumEquations>(config);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment