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

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

References OGS_FATAL.