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 25 of file FixedTimeStepping.cpp.

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

References OGS_FATAL.