20 IT::Record(
"TimeGrid",
"Equally spaced grid of time points.")
24 "The start time of the grid.")
26 "The step of the grid. If not specified, the grid consists only of the start time.")
29 "The time greater or equal to the last time in the grid.")
31 "Definition of unit of all defined times (begin, step and end time).")
45 double simulation_end_time = tg.
end_time();
48 double time_unit_coef = tg.
read_coef(
it->find<
string>(
"time_unit"));
49 double t_begin =
it->val<
double>(
"begin", initial_time) * time_unit_coef;
50 double t_end =
it->val<
double>(
"end", simulation_end_time) * time_unit_coef;
52 if (!
it->opt_val(
"step", t_step) ) {
56 t_step *= time_unit_coef;
58 if ( t_begin > t_end) {
59 WarningOut().fmt(
"Ignoring output time grid. Time begin {} > time end {}. {}",
60 t_begin, t_end,
it->address_string());
63 if ( t_step < 2*numeric_limits<double>::epsilon()) {
64 WarningOut().fmt(
"Ignoring output time grid. Time step {} < two times machine epsilon {}. {}",
65 t_step, 2*numeric_limits<double>::epsilon(),
it->address_string());
69 this->
add(t_begin, t_step, t_end, mark_type);
82 auto mark =
TimeMark(time, output_mark_type);
84 times_.insert( mark_time );
92 ASSERT_GE( step, 2*numeric_limits<double>::epsilon());
98 if (n_steps_dbl > 1.0e+6) {
99 WarningOut().fmt(
"Output step: {} to small, fixing number of output steps to 1e6.", step);
101 step = (end - begin)/n_steps_dbl;
103 unsigned int n_steps = (
unsigned int)n_steps_dbl;
104 for(
unsigned int i = 0; i <= n_steps; i++) {
105 auto mark =
TimeMark(begin + i * step, output_mark_type);
double end_time() const
End time.
#define ASSERT_GE(a, b)
Definition of comparative assert macro (Greater or Equal)
double read_coef(Input::Iterator< std::string > unit_it) const
TimeMark::Type type_output()
void read_from_input(Input::Array in_array, const TimeGovernor &tg)
#define ASSERT_LE(a, b)
Definition of comparative assert macro (Less or Equal)
bool contains(TimeMark mark) const
Basic time management functionality for unsteady (and steady) solvers (class Equation).
static TimeMarks & marks()
Basic time management class.
std::set< double > times_
static const double time_step_precision
TimeMark::Type equation_fixed_mark_type() const
TimeMark add(const TimeMark &mark)
static const Input::Type::Array get_input_type()
double time() const
Getter for the time of the TimeMark.
#define WarningOut()
Macro defining 'warning' record of log.
Class used for marking specified times at which some events occur.
static const double inf_time
Infinity time used for steady case.
void add(double begin, TimeMark::Type mark_type)