12#ifndef DUMUX_PYTHON_COMMON_TIMELOOP_HH
13#define DUMUX_PYTHON_COMMON_TIMELOOP_HH
17#include <dune/python/pybind11/pybind11.h>
18#include <dune/python/pybind11/stl.h>
22template <
class Scalar,
class... options>
26 using pybind11::operator
""_a;
29 cls.def(pybind11::init([](Scalar startTime, Scalar dt, Scalar endTime,
bool verbose){
30 return new TimeLoop(startTime, dt, endTime, verbose);
31 }),
"startTime"_a,
"dt"_a,
"endTime"_a,
"verbose"_a=
true);
36 cls.def_property_readonly(
"isCheckPoint", &TimeLoop::isCheckPoint);
38 cls.def(
"reset", &
TimeLoop::reset,
"startTime"_a,
"dt"_a,
"endTime"_a,
"verbose"_a=
true);
44 cls.def(
"setPeriodicCheckPoint", &TimeLoop::setPeriodicCheckPoint,
"interval"_a,
"offset"_a=0.0);
45 cls.def(
"setCheckPoints", [](
TimeLoop& self,
const std::vector<double>& checkPoints) {
46 self.setCheckPoint(checkPoints);
53 pybind11::class_<CheckPointTimeLoop<Scalar>> cls(scope, clsName);
A time loop with a check point mechanism.
Definition: common/timeloop.hh:396
The default time loop for instationary simulations.
Definition: common/timeloop.hh:101
void setMaxTimeStepSize(Scalar maxDt)
Set the maximum time step size to a given value.
Definition: common/timeloop.hh:258
void advanceTimeStep() override
Advance time step.
Definition: common/timeloop.hh:168
void start()
Tells the time loop to start tracking the time.
Definition: common/timeloop.hh:117
void finalize(const Communicator &comm=Dune::MPIHelper::getCommunication())
Print final status and stops tracking the time.
Definition: common/timeloop.hh:350
void reset(Scalar startTime, Scalar dt, Scalar tEnd, bool verbose=true)
Reset the time loop.
Definition: common/timeloop.hh:142
void setTimeStepSize(Scalar dt) final
Set the current time step size to a given value.
Definition: common/timeloop.hh:243
bool finished() const override
Returns true if the simulation is finished.
Definition: common/timeloop.hh:301
void reportTimeStep() const
State info on cpu time.
Definition: common/timeloop.hh:333
Scalar timeStepSize() const final
Returns the suggested time step length so that we don't miss the beginning of the next episode or cr...
Definition: common/timeloop.hh:269
Scalar time() const final
Return the time before the time integration. To get the time after the time integration you have to ...
Definition: common/timeloop.hh:206
Manages the handling of time dependent problems.
Definition: python/assembly/fvassembler.hh:18
void registerTimeLoop(pybind11::handle scope, pybind11::class_< CheckPointTimeLoop< Scalar >, options... > cls)
Definition: python/common/timeloop.hh:23