Program Listing for File timestepper.hpp
↰ Return to documentation for file (src/pcms/transient/timestepper.hpp)
#ifndef PCMS_TRANSIENT_TIMESTEPPER_HPP
#define PCMS_TRANSIENT_TIMESTEPPER_HPP
#include "pcms/utility/types.h"
namespace pcms
{
struct Step
{
bool accepted;
Real next_step;
};
class Timestepper
{
public:
[[nodiscard]] virtual Real InitialStep() const = 0;
[[nodiscard]] virtual Step UpdateStep(Real dt, Real err) = 0;
virtual ~Timestepper() = default;
};
class FixedTimestepper : public Timestepper
{
public:
explicit FixedTimestepper(Real dt);
Real InitialStep() const override;
Step UpdateStep(Real dt, Real err) override;
private:
Real dt_;
};
} // namespace pcms
#endif // PCMS_TRANSIENT_TIMESTEPPER_HPP