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

[MaL] added ODE namespace

parent 1f2e2cac
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,8 @@ void printStats(void* cvode_mem)
namespace MathLib
{
namespace ODE
{
//! \addtogroup ExternalODESolverInterface
//! @{
......@@ -359,6 +361,7 @@ double CVodeSolver::getTime() const
CVodeSolver::~CVodeSolver() = default;
} // namespace ODE
} // namespace MathLib
#endif // CVODE_FOUND
......@@ -22,6 +22,8 @@ class ConfigTree;
namespace MathLib
{
namespace ODE
{
//! \addtogroup ExternalODESolverInterface
//! @{
......@@ -73,6 +75,7 @@ private:
//! @}}
} // namespace ODE
} // namespace MathLib
#endif // MATHLIB_CVODESOLVER_H
......@@ -22,6 +22,8 @@ class ConfigTree;
namespace MathLib
{
namespace ODE
{
template <unsigned NumEquations>
std::unique_ptr<ODESolver<NumEquations>> createODESolver(
BaseLib::ConfigTree const& config);
......@@ -115,6 +117,7 @@ private:
//! @}
} // namespace ODE
} // namespace MathLib
#endif // MATHLIB_ODE_CONCRETEODESOLVER_H
......@@ -14,6 +14,8 @@
namespace MathLib
{
namespace ODE
{
namespace detail
{
//! \addtogroup ExternalODESolverInterface
......@@ -107,6 +109,7 @@ struct FunctionHandlesImpl final : public FunctionHandles
//! @}
} // namespace detail
} // namespace ODE
} // namespace MathLib
#endif // MATHLIB_ODE_HANDLES_H
......@@ -16,6 +16,8 @@
namespace MathLib
{
namespace ODE
{
//! \addtogroup ExternalODESolverInterface
//! @{
......@@ -132,6 +134,7 @@ public:
//! @}
} // namespace ODE
} // namespace MathLib
#endif // MATHLIB_ODESOLVER_H
......@@ -26,6 +26,8 @@ class ConfigTree;
namespace MathLib
{
namespace ODE
{
//! \addtogroup ExternalODESolverInterface
//! @{
......@@ -51,6 +53,7 @@ std::unique_ptr<ODESolver<NumEquations>> createODESolver(
//! @}
} // namespace ODE
} // namespace MathLib
#endif // MATHLIB_ODE_ODESOLVERBUILDER_H
......@@ -15,6 +15,8 @@
namespace MathLib
{
namespace ODE
{
//! \addtogroup ExternalODESolverInterface
//! @{
......@@ -66,6 +68,7 @@ using JacobianFunction = std::function<bool(const double t,
//! @}
} // namespace ODE
} // namespace MathLib
#endif // MATHLIB_ODE_ODESOLVERTYPES_H
......@@ -17,8 +17,8 @@ const double abs_tol = 1e-8;
const double rel_tol = 1e-8;
bool f(const double,
MathLib::MappedConstVector<1> const& y,
MathLib::MappedVector<1>& ydot)
MathLib::ODE::MappedConstVector<1> const& y,
MathLib::ODE::MappedVector<1>& ydot)
{
if (y[0] <= 0.0) return false;
......@@ -27,9 +27,9 @@ bool f(const double,
}
bool df(const double /*t*/,
MathLib::MappedConstVector<1> const& y,
MathLib::MappedConstVector<1> const& /*ydot*/,
MathLib::MappedMatrix<1, 1>& jac)
MathLib::ODE::MappedConstVector<1> const& y,
MathLib::ODE::MappedConstVector<1> const& /*ydot*/,
MathLib::ODE::MappedMatrix<1, 1>& jac)
{
if (y[0] <= 0.0) return false;
......@@ -43,8 +43,8 @@ struct ExtraData
};
bool f_extra(const double,
MathLib::MappedConstVector<1> const& y,
MathLib::MappedVector<1>& ydot,
MathLib::ODE::MappedConstVector<1> const& y,
MathLib::ODE::MappedVector<1>& ydot,
ExtraData& data)
{
if (y[0] <= 0.0) return false;
......@@ -63,7 +63,7 @@ bool any_ode_solver_libs_available()
}
template <unsigned NumEquations>
std::unique_ptr<MathLib::ODESolver<NumEquations>> make_ode_solver(
std::unique_ptr<MathLib::ODE::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
......@@ -78,13 +78,13 @@ std::unique_ptr<MathLib::ODESolver<NumEquations>> make_ode_solver(
BaseLib::ConfigTree config(conf, "", BaseLib::ConfigTree::onerror,
BaseLib::ConfigTree::onwarning);
return MathLib::createODESolver<NumEquations>(config);
return MathLib::ODE::createODESolver<NumEquations>(config);
}
// There is no definition of this function in order to prevent passing temporary
// property trees! There will be linker errors if you do so anyway.
template <unsigned NumEquations>
std::unique_ptr<MathLib::ODESolver<NumEquations>> make_ode_solver(
std::unique_ptr<MathLib::ODE::ODESolver<NumEquations>> make_ode_solver(
boost::property_tree::ptree&&);
void check(const double time_reached, const double y, const double y_dot,
......@@ -164,15 +164,15 @@ TEST(MathLibCVodeTest, ExponentialExtraData)
ExtraData data;
auto f_lambda = [&](double t,
MathLib::MappedConstVector<1> const& y,
MathLib::MappedVector<1>& ydot)
MathLib::ODE::MappedConstVector<1> const& y,
MathLib::ODE::MappedVector<1>& ydot)
{
return f_extra(t, y, ydot, data);
};
ode_solver->setFunction(f_lambda, nullptr);
ode_solver->setTolerance(abs_tol, rel_tol);
ode_solver->setTolerance(abs_tol, rel_tol);
ode_solver->setIC(t0, {y0});
ode_solver->preSolve();
......
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