OGS
anonymous_namespace{FixedTimeStepping.cpp} Namespace Reference

Functions

NumLib::Time addTimeIncrement (std::vector< double > &delta_ts, std::size_t const repeat, double const delta_t, NumLib::Time const t_curr)
 Returns sum of the newly added time increments.

Function Documentation

◆ addTimeIncrement()

NumLib::Time anonymous_namespace{FixedTimeStepping.cpp}::addTimeIncrement ( std::vector< double > & delta_ts,
std::size_t const repeat,
double const delta_t,
NumLib::Time const t_curr )

Returns sum of the newly added time increments.

Definition at line 18 of file FixedTimeStepping.cpp.

21{
22 auto const new_size = delta_ts.size() + repeat;
23 try
24 {
25 delta_ts.resize(new_size, delta_t);
26 }
27 catch (std::exception const& e)
28 {
30 "Resize of the time steps vector failed for the requested new size "
31 "{:d}. Probably there is not enough memory ({:g} GiB "
32 "requested).\nThrown exception: {:s}",
33 new_size,
34 new_size * sizeof(double) / 1024. / 1024. / 1024.,
35 e.what());
36 }
37
38 // Multiplying dt * repeat is not the same as in the current
39 // implementation of the time loop, where the dt's are added.
40 // Therefore the sum of all dt is taken here.
41 return std::accumulate(end(delta_ts) - repeat, end(delta_ts), t_curr);
42}
#define OGS_FATAL(...)
Definition Error.h:19

References OGS_FATAL.