34 if (n_steps.has_value())
36 if (t_end <= t_initial)
39 "Creating linearly spaced time steps vector using "
40 "FixedTimeStepping algorithm failed! "
41 "User provided start value (t_initial) "
42 "{} is not smaller then end value (t_end) {}.",
49 "Requested number of time steps in time steps vector "
50 "(n_steps) must be greater then 0. "
51 "{} time steps were requested",
56 (t_end - t_initial) /
static_cast<double>(*n_steps);
57 std::vector
const repeat_pairs = {
58 RepeatDtPair{
static_cast<std::size_t
>(*n_steps), t_step}};
59 return {t_initial, t_end, repeat_pairs};
68 if (range.begin() == range.end())
70 OGS_FATAL(
"no timesteps have been given");
73 std::vector<RepeatDtPair> repeat_dt_pairs;
74 for (
auto const pair : range)
76 repeat_dt_pairs.emplace_back(
78 pair.getConfigParameter<std::size_t>(
"repeat"),
80 pair.getConfigParameter<
double>(
"delta_t"));
83 return {t_initial, t_end, repeat_dt_pairs};
88 std::vector<double>
const& fixed_times_for_output)
93 "fixed timestepping: end time ({}) is smaller than initial time "
102 "CreateFixedTimeStepping: invalid specification of (repeat, "
106 return std::make_unique<FixedTimeStepping>(parameters.
t_initial,
109 fixed_times_for_output);
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
T getConfigParameter(std::string const ¶m) const
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
ConfigTree getConfigSubtree(std::string const &root) const
void checkConfigParameter(std::string const ¶m, std::string_view const value) const
static bool areRepeatDtPairsValid(std::vector< RepeatDtPair > const &repeat_dt_pairs)
FixedTimeSteppingParameters parseFixedTimeStepping(BaseLib::ConfigTree const &config)
std::tuple< std::size_t, double > RepeatDtPair
std::unique_ptr< TimeStepAlgorithm > createFixedTimeStepping(FixedTimeSteppingParameters const ¶meters, std::vector< double > const &fixed_times_for_output)
std::vector< RepeatDtPair > repeat_dt_pairs