Skip to content
Snippets Groups Projects
Commit 47bbd58c authored by wenqing's avatar wenqing
Browse files

[dt] Apply clang-format to the files in TimeStepping

parent 1a4ffc37
No related branches found
No related tags found
1 merge request!1803Time stepping frame work
...@@ -24,17 +24,28 @@ ...@@ -24,17 +24,28 @@
namespace NumLib namespace NumLib
{ {
FixedTimeStepping::FixedTimeStepping(double t0,
FixedTimeStepping::FixedTimeStepping(double t0, double tn, const std::vector<double> &vec_all_dt) double tn,
: _t_initial(t0), _t_end(computeEnd(t0, tn, vec_all_dt)), _dt_vector(vec_all_dt), _ts_prev(t0), _ts_current(t0) const std::vector<double>& vec_all_dt)
{} : _t_initial(t0),
_t_end(computeEnd(t0, tn, vec_all_dt)),
_dt_vector(vec_all_dt),
_ts_prev(t0),
_ts_current(t0)
{
}
FixedTimeStepping::FixedTimeStepping(double t0, double tn, double dt) FixedTimeStepping::FixedTimeStepping(double t0, double tn, double dt)
: _t_initial(t0), _t_end(tn), _dt_vector(static_cast<std::size_t>(std::ceil((tn-t0)/dt)), dt), _ts_prev(t0), _ts_current(t0) : _t_initial(t0),
{} _t_end(tn),
_dt_vector(static_cast<std::size_t>(std::ceil((tn - t0) / dt)), dt),
_ts_prev(t0),
_ts_current(t0)
{
}
std::unique_ptr<ITimeStepAlgorithm> std::unique_ptr<ITimeStepAlgorithm> FixedTimeStepping::newInstance(
FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) BaseLib::ConfigTree const& config)
{ {
//! \ogs_file_param{prj__time_loop__time_stepping__type} //! \ogs_file_param{prj__time_loop__time_stepping__type}
config.checkConfigParameter("type", "FixedTimeStepping"); config.checkConfigParameter("type", "FixedTimeStepping");
...@@ -42,9 +53,9 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) ...@@ -42,9 +53,9 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config)
//! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__t_initial} //! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__t_initial}
auto const t_initial = config.getConfigParameter<double>("t_initial"); auto const t_initial = config.getConfigParameter<double>("t_initial");
//! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__t_end} //! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__t_end}
auto const t_end = config.getConfigParameter<double>("t_end"); auto const t_end = config.getConfigParameter<double>("t_end");
//! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps} //! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps}
auto const delta_ts = config.getConfigSubtree("timesteps"); auto const delta_ts = config.getConfigSubtree("timesteps");
std::vector<double> timesteps; std::vector<double> timesteps;
double t_curr = t_initial; double t_curr = t_initial;
...@@ -53,7 +64,8 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) ...@@ -53,7 +64,8 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config)
// TODO: consider adding call "listNonEmpty" to config tree // TODO: consider adding call "listNonEmpty" to config tree
//! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps__pair} //! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps__pair}
auto const range = delta_ts.getConfigSubtreeList("pair"); auto const range = delta_ts.getConfigSubtreeList("pair");
if (range.begin() == range.end()) { if (range.begin() == range.end())
{
OGS_FATAL("no timesteps have been given"); OGS_FATAL("no timesteps have been given");
} }
for (auto const pair : range) for (auto const pair : range)
...@@ -61,16 +73,19 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config) ...@@ -61,16 +73,19 @@ FixedTimeStepping::newInstance(BaseLib::ConfigTree const& config)
//! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps__pair__repeat} //! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps__pair__repeat}
auto const repeat = pair.getConfigParameter<std::size_t>("repeat"); auto const repeat = pair.getConfigParameter<std::size_t>("repeat");
//! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps__pair__delta_t} //! \ogs_file_param{prj__time_loop__time_stepping__FixedTimeStepping__timesteps__pair__delta_t}
delta_t = pair.getConfigParameter<double>("delta_t"); delta_t = pair.getConfigParameter<double>("delta_t");
if (repeat == 0) { if (repeat == 0)
{
OGS_FATAL("<repeat> is zero."); OGS_FATAL("<repeat> is zero.");
} }
if (delta_t <= 0.0) { if (delta_t <= 0.0)
{
OGS_FATAL("timestep <delta_t> is <= 0.0."); OGS_FATAL("timestep <delta_t> is <= 0.0.");
} }
if (t_curr <= t_end) { if (t_curr <= t_end)
{
timesteps.resize(timesteps.size() + repeat, delta_t); timesteps.resize(timesteps.size() + repeat, delta_t);
t_curr += repeat * delta_t; t_curr += repeat * delta_t;
...@@ -96,8 +111,9 @@ const TimeStep FixedTimeStepping::getTimeStep() const ...@@ -96,8 +111,9 @@ const TimeStep FixedTimeStepping::getTimeStep() const
bool FixedTimeStepping::next() bool FixedTimeStepping::next()
{ {
// check if last time step // check if last time step
if (_ts_current.steps() == _dt_vector.size() if (_ts_current.steps() == _dt_vector.size() ||
|| std::abs(_ts_current.current()-_t_end) < std::numeric_limits<double>::epsilon()) std::abs(_ts_current.current() - _t_end) <
std::numeric_limits<double>::epsilon())
return false; return false;
// confirm current time and move to the next if accepted // confirm current time and move to the next if accepted
...@@ -107,17 +123,20 @@ bool FixedTimeStepping::next() ...@@ -107,17 +123,20 @@ bool FixedTimeStepping::next()
// prepare the next time step info // prepare the next time step info
_ts_current = _ts_prev; _ts_current = _ts_prev;
double dt = _dt_vector[_ts_prev.steps()]; double dt = _dt_vector[_ts_prev.steps()];
if (_ts_prev.current() + dt > _t_end) // upper bound by t_end if (_ts_prev.current() + dt > _t_end) // upper bound by t_end
dt = _t_end - _ts_prev.current(); dt = _t_end - _ts_prev.current();
_ts_current += dt; _ts_current += dt;
return true; return true;
} }
double FixedTimeStepping::computeEnd(double t_initial, double t_end, const std::vector<double> &dt_vector) double FixedTimeStepping::computeEnd(double t_initial,
double t_end,
const std::vector<double>& dt_vector)
{ {
double t_sum = t_initial + std::accumulate(dt_vector.begin(), dt_vector.end(), 0.); double t_sum =
t_initial + std::accumulate(dt_vector.begin(), dt_vector.end(), 0.);
return std::min(t_end, t_sum); return std::min(t_end, t_sum);
} }
} //NumLib } // NumLib
...@@ -16,18 +16,19 @@ ...@@ -16,18 +16,19 @@
#include "ITimeStepAlgorithm.h" #include "ITimeStepAlgorithm.h"
namespace BaseLib { class ConfigTree; } namespace BaseLib
{
class ConfigTree;
}
namespace NumLib namespace NumLib
{ {
/** /**
* \brief Fixed time stepping algorithm * \brief Fixed time stepping algorithm
* *
* This algorithm returns time step size defined by a user priori. * This algorithm returns time step size defined by a user priori.
*/ */
class FixedTimeStepping final class FixedTimeStepping final : public ITimeStepAlgorithm
: public ITimeStepAlgorithm
{ {
public: public:
/** /**
...@@ -58,17 +59,17 @@ public: ...@@ -58,17 +59,17 @@ public:
* @param t_end finish time * @param t_end finish time
* @param vec_all_dt a vector of all time steps * @param vec_all_dt a vector of all time steps
*/ */
FixedTimeStepping(double t_initial, double t_end, const std::vector<double> &vec_all_dt); FixedTimeStepping(double t_initial, double t_end,
const std::vector<double>& vec_all_dt);
/// Create timestepper from the given configuration /// Create timestepper from the given configuration
static std::unique_ptr<ITimeStepAlgorithm> newInstance(BaseLib::ConfigTree const& config); static std::unique_ptr<ITimeStepAlgorithm> newInstance(
BaseLib::ConfigTree const& config);
/// return the beginning of time steps /// return the beginning of time steps
double begin() const override { return _t_initial; } double begin() const override { return _t_initial; }
/// return the end of time steps /// return the end of time steps
double end() const override { return _t_end; } double end() const override { return _t_end; }
/// return current time step /// return current time step
const TimeStep getTimeStep() const override; const TimeStep getTimeStep() const override;
...@@ -77,13 +78,16 @@ public: ...@@ -77,13 +78,16 @@ public:
/// return if current time step is accepted /// return if current time step is accepted
bool accepted() const override { return true; } bool accepted() const override { return true; }
/// return a history of time step sizes /// return a history of time step sizes
const std::vector<double>& getTimeStepSizeHistory() const override { return _dt_vector; } const std::vector<double>& getTimeStepSizeHistory() const override
{
return _dt_vector;
}
private: private:
/// determine true end time /// determine true end time
static double computeEnd(double t_initial, double t_end, const std::vector<double> &dt_vector); static double computeEnd(double t_initial, double t_end,
const std::vector<double>& dt_vector);
/// initial time /// initial time
const double _t_initial; const double _t_initial;
...@@ -97,4 +101,4 @@ private: ...@@ -97,4 +101,4 @@ private:
TimeStep _ts_current; TimeStep _ts_current;
}; };
} //NumLib } // NumLib
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
namespace NumLib namespace NumLib
{ {
/** /**
* \brief Interface of time stepping algorithms * \brief Interface of time stepping algorithms
* *
...@@ -47,4 +46,4 @@ public: ...@@ -47,4 +46,4 @@ public:
virtual ~ITimeStepAlgorithm() = default; virtual ~ITimeStepAlgorithm() = default;
}; };
} //NumLib } // NumLib
...@@ -43,14 +43,18 @@ IterationNumberBasedAdaptiveTimeStepping:: ...@@ -43,14 +43,18 @@ IterationNumberBasedAdaptiveTimeStepping::
bool IterationNumberBasedAdaptiveTimeStepping::next() bool IterationNumberBasedAdaptiveTimeStepping::next()
{ {
// check current time step // check current time step
if (std::abs(_ts_current.current()-_t_end) < std::numeric_limits<double>::epsilon()) if (std::abs(_ts_current.current() - _t_end) <
std::numeric_limits<double>::epsilon())
return false; return false;
// confirm current time and move to the next if accepted // confirm current time and move to the next if accepted
if (accepted()) { if (accepted())
{
_ts_pre = _ts_current; _ts_pre = _ts_current;
_dt_vector.push_back(_ts_current.dt()); _dt_vector.push_back(_ts_current.dt());
} else { }
else
{
++_n_rejected_steps; ++_n_rejected_steps;
} }
...@@ -72,7 +76,7 @@ double IterationNumberBasedAdaptiveTimeStepping::getNextTimeStepSize() const ...@@ -72,7 +76,7 @@ double IterationNumberBasedAdaptiveTimeStepping::getNextTimeStepSize() const
// if this is the first time step // if this is the first time step
// then we use initial guess provided by a user // then we use initial guess provided by a user
if ( _ts_pre.steps() == 0 ) if (_ts_pre.steps() == 0)
{ {
dt = _initial_ts; dt = _initial_ts;
} }
...@@ -83,17 +87,17 @@ double IterationNumberBasedAdaptiveTimeStepping::getNextTimeStepSize() const ...@@ -83,17 +87,17 @@ double IterationNumberBasedAdaptiveTimeStepping::getNextTimeStepSize() const
if (!_multiplier_vector.empty()) if (!_multiplier_vector.empty())
tmp_multiplier = _multiplier_vector[0]; tmp_multiplier = _multiplier_vector[0];
// finding the right multiplier // finding the right multiplier
for (std::size_t i=0; i<_iter_times_vector.size(); i++ ) for (std::size_t i = 0; i < _iter_times_vector.size(); i++)
if ( this->_iter_times > _iter_times_vector[i] ) if (this->_iter_times > _iter_times_vector[i])
tmp_multiplier = _multiplier_vector[i]; tmp_multiplier = _multiplier_vector[i];
// multiply the the multiplier // multiply the the multiplier
dt = _ts_pre.dt() * tmp_multiplier; dt = _ts_pre.dt() * tmp_multiplier;
} }
// check whether out of the boundary // check whether out of the boundary
if ( dt < _min_ts ) if (dt < _min_ts)
dt = _min_ts; dt = _min_ts;
else if ( dt > _max_ts ) else if (dt > _max_ts)
dt = _max_ts; dt = _max_ts;
double t_next = dt + _ts_pre.current(); double t_next = dt + _ts_pre.current();
...@@ -105,7 +109,7 @@ double IterationNumberBasedAdaptiveTimeStepping::getNextTimeStepSize() const ...@@ -105,7 +109,7 @@ double IterationNumberBasedAdaptiveTimeStepping::getNextTimeStepSize() const
bool IterationNumberBasedAdaptiveTimeStepping::accepted() const bool IterationNumberBasedAdaptiveTimeStepping::accepted() const
{ {
return ( this->_iter_times <= this->_max_iter ); return (this->_iter_times <= this->_max_iter);
} }
} // NumLib } // NumLib
...@@ -17,20 +17,22 @@ ...@@ -17,20 +17,22 @@
namespace NumLib namespace NumLib
{ {
/** /**
* \brief Iteration number based adaptive time stepping * \brief Iteration number based adaptive time stepping
* *
* This algorithm estimates a time step size depending on the number of * This algorithm estimates a time step size depending on the number of
* iterations (e.g. of iterative linear solvers, nonlinear methods, partitioned * iterations (e.g. of iterative linear solvers, nonlinear methods, partitioned
* coupling) needed in the last time step (see Hoffmann (2010) for Newton-Raphson case). * coupling) needed in the last time step (see Hoffmann (2010) for
* Newton-Raphson case).
* The new time step \f$\Delta t_{n+1}\f$ size is calculated as * The new time step \f$\Delta t_{n+1}\f$ size is calculated as
* \f[ * \f[
* \Delta t_{n+1} = \alpha \Delta t_n * \Delta t_{n+1} = \alpha \Delta t_n
* \f] * \f]
* with the previous time step size \f$\Delta t_{n}\f$ and a multiplier coefficient * with the previous time step size \f$\Delta t_{n}\f$ and a multiplier
* coefficient
* \f$\alpha\f$ depending on the iteration number. * \f$\alpha\f$ depending on the iteration number.
* Note that a time step size is always bounded by the minimum and maximum allowed * Note that a time step size is always bounded by the minimum and maximum
* allowed
* value. * value.
* \f[ * \f[
* \Delta t_{\min} \le \Delta t \le \Delta t_{\max} * \Delta t_{\min} \le \Delta t \le \Delta t_{\max}
...@@ -39,24 +41,30 @@ namespace NumLib ...@@ -39,24 +41,30 @@ namespace NumLib
* For example, users can setup the following time stepping strategy based on * For example, users can setup the following time stepping strategy based on
* the iteration number of the Newton-Raphson method in the last time step. * the iteration number of the Newton-Raphson method in the last time step.
* <table border="1"> * <table border="1">
* <tr><th>Num. of Newton steps</th><th>0-2</th><th>3-6</th><th>7-8</th><th>9<</th></tr> * <tr><th>Num. of Newton
* <tr><th>Time step size multiplier</th><th>1.6</th><th>1.</th><th>0.5</th><th>0.25 (repeat time step)</th></tr> * steps</th><th>0-2</th><th>3-6</th><th>7-8</th><th>9<</th></tr>
* <tr><th>Upper and lower bound</th><th colspan="4"> \f$ 1. \le \Delta t \le 10.\f$ </th></tr> * <tr><th>Time step size
* multiplier</th><th>1.6</th><th>1.</th><th>0.5</th><th>0.25 (repeat time
* step)</th></tr>
* <tr><th>Upper and lower bound</th><th colspan="4"> \f$ 1. \le \Delta t \le
* 10.\f$ </th></tr>
* </table> * </table>
* A time step size is increased for the small iteration number, and decreased for the * A time step size is increased for the small iteration number, and decreased
* large iteration number. If the iteration number exceeds a user-defined threshold (e.g. 9), * for the
* large iteration number. If the iteration number exceeds a user-defined
* threshold (e.g. 9),
* a time step is repeated with a smaller time step size. * a time step is repeated with a smaller time step size.
* *
* Reference * Reference
* - Hoffmann J (2010) Reactive Transport and Mineral Dissolution/Precipitation * - Hoffmann J (2010) Reactive Transport and Mineral Dissolution/Precipitation
* in Porous Media:Efficient Solution Algorithms, Benchmark Computations and * in Porous Media:Efficient Solution Algorithms, Benchmark Computations and
* Existence of Global Solutions. PhD thesis. pp82. Friedrich-Alexander-Universität Erlangen-Nürnberg. * Existence of Global Solutions. PhD thesis. pp82.
* Friedrich-Alexander-Universität Erlangen-Nürnberg.
* *
*/ */
class IterationNumberBasedAdaptiveTimeStepping : public ITimeStepAlgorithm class IterationNumberBasedAdaptiveTimeStepping : public ITimeStepAlgorithm
{ {
public: public:
/** /**
* Constructor * Constructor
* *
...@@ -71,18 +79,18 @@ public: ...@@ -71,18 +79,18 @@ public:
* If an iteration number is larger than \f$i_n\f$, current time step is * If an iteration number is larger than \f$i_n\f$, current time step is
* repeated with the new time step size. * repeated with the new time step size.
* @param multiplier_vector a vector of multiplier coefficients * @param multiplier_vector a vector of multiplier coefficients
* (\f$a_1\f$, \f$a_2\f$, ..., \f$a_n\f$) corresponding to the intervals given by iter_times_vector. * (\f$a_1\f$, \f$a_2\f$, ..., \f$a_n\f$) corresponding to the intervals
* given by iter_times_vector.
* A time step size is calculated by \f$\Delta t_{n+1} = a * \Delta t_{n}\f$ * A time step size is calculated by \f$\Delta t_{n+1} = a * \Delta t_{n}\f$
*/ */
IterationNumberBasedAdaptiveTimeStepping(double t_initial, IterationNumberBasedAdaptiveTimeStepping(
double t_end, double t_initial,
double min_ts, double t_end,
double max_ts, double min_ts,
double initial_ts, double max_ts,
std::vector<std::size_t> double initial_ts,
iter_times_vector, std::vector<std::size_t>& iter_times_vector,
std::vector<double> std::vector<double>& multiplier_vector);
multiplier_vector);
~IterationNumberBasedAdaptiveTimeStepping() override = default; ~IterationNumberBasedAdaptiveTimeStepping() override = default;
...@@ -106,10 +114,12 @@ public: ...@@ -106,10 +114,12 @@ public:
} }
/// set the number of iterations /// set the number of iterations
void setNIterations(std::size_t n_itr) {this->_iter_times = n_itr;} void setNIterations(std::size_t n_itr) { this->_iter_times = n_itr; }
/// return the number of repeated steps /// return the number of repeated steps
std::size_t getNumberOfRepeatedSteps() const {return this->_n_rejected_steps;} std::size_t getNumberOfRepeatedSteps() const
{
return this->_n_rejected_steps;
}
private: private:
/// calculate the next time step size /// calculate the next time step size
...@@ -119,7 +129,8 @@ private: ...@@ -119,7 +129,8 @@ private:
const double _t_initial; const double _t_initial;
/// end time /// end time
const double _t_end; const double _t_end;
/// this vector stores the number of iterations to which the respective multiplier coefficient will be applied /// this vector stores the number of iterations to which the respective
/// multiplier coefficient will be applied
const std::vector<std::size_t> _iter_times_vector; const std::vector<std::size_t> _iter_times_vector;
/// this vector stores the multiplier coefficients /// this vector stores the multiplier coefficients
const std::vector<double> _multiplier_vector; const std::vector<double> _multiplier_vector;
...@@ -143,4 +154,4 @@ private: ...@@ -143,4 +154,4 @@ private:
std::size_t _n_rejected_steps; std::size_t _n_rejected_steps;
}; };
} // NumLib } // NumLib
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
namespace NumLib namespace NumLib
{ {
/** /**
* \brief Time step object * \brief Time step object
* *
* TimeStep class contains previous time(\f$t_{n}\f$), current time (\f$t_{n+1}\f$), * TimeStep class contains previous time(\f$t_{n}\f$), current time
* time step length (\f$\Delta t_{n+1}\f$), and the number of time steps (\f$n+1\f$). * (\f$t_{n+1}\f$),
* time step length (\f$\Delta t_{n+1}\f$), and the number of time steps
* (\f$n+1\f$).
*/ */
class TimeStep class TimeStep
{ {
...@@ -30,7 +31,12 @@ public: ...@@ -30,7 +31,12 @@ public:
* @param current_time current time * @param current_time current time
*/ */
explicit TimeStep(double current_time) explicit TimeStep(double current_time)
: _previous(current_time), _current(current_time), _dt(_current-_previous), _steps(0) {} : _previous(current_time),
_current(current_time),
_dt(_current - _previous),
_steps(0)
{
}
/** /**
* Initialize a time step * Initialize a time step
...@@ -39,11 +45,21 @@ public: ...@@ -39,11 +45,21 @@ public:
* @param n the number of time steps * @param n the number of time steps
*/ */
TimeStep(double previous_time, double current_time, std::size_t n) TimeStep(double previous_time, double current_time, std::size_t n)
: _previous(previous_time), _current(current_time), _dt(_current-_previous), _steps(n) {} : _previous(previous_time),
_current(current_time),
_dt(_current - _previous),
_steps(n)
{
}
/// copy a time step /// copy a time step
TimeStep(const TimeStep &src) TimeStep(const TimeStep& src)
: _previous(src._previous), _current(src._current), _dt(_current-_previous), _steps(src._steps) {} : _previous(src._previous),
_current(src._current),
_dt(_current - _previous),
_steps(src._steps)
{
}
/// copy a time step /// copy a time step
TimeStep& operator=(const TimeStep& src) = default; TimeStep& operator=(const TimeStep& src) = default;
...@@ -57,7 +73,7 @@ public: ...@@ -57,7 +73,7 @@ public:
} }
/// increment time step /// increment time step
TimeStep &operator+=(const double dt) TimeStep& operator+=(const double dt)
{ {
_previous = _current; _previous = _current;
_current += dt; _current += dt;
...@@ -67,35 +83,33 @@ public: ...@@ -67,35 +83,33 @@ public:
} }
/// compare current time /// compare current time
bool operator<(const TimeStep &t) const {return (_current < t._current);} bool operator<(const TimeStep& t) const { return (_current < t._current); }
/// compare current time /// compare current time
bool operator<(const double &t) const {return (_current < t);} bool operator<(const double& t) const { return (_current < t); }
/// compare current time /// compare current time
bool operator<=(const TimeStep &t) const {return (_current <= t._current);} bool operator<=(const TimeStep& t) const
{
return (_current <= t._current);
}
/// compare current time /// compare current time
bool operator<=(const double &t) const {return (_current <= t);} bool operator<=(const double& t) const { return (_current <= t); }
/// compare current time /// compare current time
bool operator==(const TimeStep &t) const {return (_current == t._current);} bool operator==(const TimeStep& t) const
{
return (_current == t._current);
}
/// compare current time /// compare current time
bool operator==(const double &t) const {return (_current == t);} bool operator==(const double& t) const { return (_current == t); }
/// return previous time step /// return previous time step
double previous() const {return _previous;} double previous() const { return _previous; }
/// return current time step /// return current time step
double current() const {return _current;} double current() const { return _current; }
/// time step size from _previous /// time step size from _previous
double dt() const {return _dt;} double dt() const { return _dt; }
/// the number of time _steps /// the number of time _steps
std::size_t steps() const {return _steps;} std::size_t steps() const { return _steps; }
private: private:
/// previous time step /// previous time step
double _previous; double _previous;
...@@ -107,4 +121,4 @@ private: ...@@ -107,4 +121,4 @@ private:
std::size_t _steps; std::size_t _steps;
}; };
} //NumLib } // NumLib
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