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.

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

References OGS_FATAL.