OGS
TimeDiscretization.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <vector>
14
17#include "Types.h"
18
19namespace NumLib
20{
23
93{
94public:
95 TimeDiscretization() = default;
96
98 virtual void setInitialState(const double t0) = 0;
99
106 virtual void nextTimestep(const double t, const double delta_t) = 0;
107
110 virtual double getCurrentTime() const = 0;
111
114 virtual double getCurrentTimeIncrement() const = 0;
115
117 virtual double getPreviousTimeIncrement() const = 0;
118
120 virtual void getWeightedOldX(
121 GlobalVector& y, GlobalVector const& x_old) const = 0; // = x_old
122
123 virtual ~TimeDiscretization() = default;
124};
125
128{
129public:
130 void setInitialState(const double t0) override { _t = t0; }
131 void nextTimestep(const double t, const double delta_t) override
132 {
134 _t = t;
135 _delta_t = delta_t;
136 }
137
138 double getCurrentTime() const override { return _t; }
139 double getCurrentTimeIncrement() const override { return _delta_t; }
140 double getPreviousTimeIncrement() const override { return _delta_t_prev; }
142 GlobalVector const& x_old) const override;
143
144private:
145 double _t = std::numeric_limits<double>::quiet_NaN();
146 double _delta_t =
147 std::numeric_limits<double>::quiet_NaN();
148
150 double _delta_t_prev = std::numeric_limits<double>::quiet_NaN();
151};
152
154} // namespace NumLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
Backward Euler scheme.
double getCurrentTime() const override
void setInitialState(const double t0) override
Sets the initial condition.
double getPreviousTimeIncrement() const override
Returns the value of from the previous time step.
void getWeightedOldX(GlobalVector &y, GlobalVector const &x_old) const override
Returns .
void nextTimestep(const double t, const double delta_t) override
double _delta_t
the timestep size
double _delta_t_prev
The timestep size of the previous timestep.
double getCurrentTimeIncrement() const override
virtual void setInitialState(const double t0)=0
Sets the initial condition.
virtual double getCurrentTimeIncrement() const =0
virtual void nextTimestep(const double t, const double delta_t)=0
virtual double getCurrentTime() const =0
virtual ~TimeDiscretization()=default
virtual double getPreviousTimeIncrement() const =0
Returns the value of from the previous time step.
virtual void getWeightedOldX(GlobalVector &y, GlobalVector const &x_old) const =0
Returns .