Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
discrete_time.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_discrete_time_h
17 #define dealii_discrete_time_h
18 
19 #include <deal.II/base/config.h>
20 
22 
234 {
235 public:
256  DiscreteTime(const double start_time,
257  const double end_time,
258  const double desired_start_step_size = 0.);
259 
263  double
264  get_current_time() const;
265 
273  double
274  get_next_time() const;
275 
282  double
283  get_previous_time() const;
284 
288  double
289  get_start_time() const;
290 
298  double
299  get_end_time() const;
300 
304  bool
305  is_at_start() const;
306 
310  bool
311  is_at_end() const;
312 
322  double
323  get_next_step_size() const;
324 
330  double
331  get_previous_step_size() const;
332 
337  unsigned int
338  get_step_number() const;
339 
351  void
352  set_desired_next_step_size(const double time_step_size);
353 
372  void
373  advance_time();
374 
379  void
380  restart();
381 
382 private:
386  double start_time;
387 
391  double end_time;
392 
396  double current_time;
397 
410  double next_time;
411 
416 
421 
426  unsigned int step_number;
427 };
428 
429 
430 /*---------------------- Inline functions ------------------------------*/
431 
432 
433 inline double
435 {
436  return start_time;
437 }
438 
439 
440 
441 inline double
443 {
444  return end_time;
445 }
446 
447 
448 
449 inline bool
451 {
452  return step_number == 0;
453 }
454 
455 
456 
457 inline bool
459 {
460  return current_time == end_time;
461 }
462 
463 
464 
465 inline double
467 {
468  return next_time - current_time;
469 }
470 
471 
472 
473 inline double
475 {
476  return current_time - previous_time;
477 }
478 
479 
480 
481 inline double
483 {
484  return current_time;
485 }
486 
487 
488 
489 inline double
491 {
492  return next_time;
493 }
494 
495 
496 
497 inline double
499 {
500  return previous_time;
501 }
502 
503 
504 
505 inline unsigned int
507 {
508  return step_number;
509 }
510 
511 
513 
514 #endif
double start_step_size
double get_end_time() const
void set_desired_next_step_size(const double time_step_size)
double get_next_step_size() const
DiscreteTime(const double start_time, const double end_time, const double desired_start_step_size=0.)
void advance_time()
double previous_time
double get_current_time() const
double get_previous_step_size() const
double start_time
unsigned int step_number
double current_time
bool is_at_end() const
double get_previous_time() const
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
double next_time
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
unsigned int get_step_number() const
double get_start_time() const
double get_next_time() const
bool is_at_start() const