From bfaf73199cd8347ff37588bd6938fbda97a85fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Thu, 28 Sep 2023 12:33:54 +0200 Subject: [PATCH] [test][timeloop] outsource to function --- test/common/timeloop/test_timeloop.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/common/timeloop/test_timeloop.cc b/test/common/timeloop/test_timeloop.cc index 177e6a7d05..d2e1e50f6a 100644 --- a/test/common/timeloop/test_timeloop.cc +++ b/test/common/timeloop/test_timeloop.cc @@ -17,15 +17,9 @@ #include <dumux/common/initialize.hh> #include <dumux/common/timeloop.hh> -int main(int argc, char* argv[]) +template<class MPIHelper> +void testTimeLoops(const MPIHelper& mpiHelper, double tStart, double tEnd, double dt) { - // maybe initialize MPI and/or multithreading backend - Dumux::initialize(argc, argv); - const auto& mpiHelper = Dune::MPIHelper::instance(); - - //! Standard time loop - double tStart = 0; double tEnd = 1; double dt = 0.1; - //! Standard time loop { if (mpiHelper.rank() == 0) std::cout << "------- Test time loop ----------" << std::endl; @@ -203,6 +197,15 @@ int main(int argc, char* argv[]) if (result.empty()) DUNE_THROW(Dune::Exception, "Setting a zero timeStepSize should print a warning to std::cerr"); } +} + +int main(int argc, char* argv[]) +{ + // maybe initialize MPI and/or multithreading backend + Dumux::initialize(argc, argv); + const auto& mpiHelper = Dune::MPIHelper::instance(); + + testTimeLoops(mpiHelper, 0.0, 1.0, 0.1); return 0; } -- GitLab