OGS
anonymous_namespace{FixedTimeStepping.cpp} Namespace Reference

Functions

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

Function Documentation

◆ addTimeIncrement()

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

Returns sum of the newly added time increments.

Definition at line 23 of file FixedTimeStepping.cpp.

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

References OGS_FATAL.