Reference documentation for deal.II version Git 952cf78591 2020-12-01 06:11:44 +0100
\(\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 
233 {
234 public:
255  DiscreteTime(const double start_time,
256  const double end_time,
257  const double desired_start_step_size = 0.);
258 
262  double
263  get_current_time() const;
264 
272  double
273  get_next_time() const;
274 
281  double
282  get_previous_time() const;
283 
287  double
288  get_start_time() const;
289 
297  double
298  get_end_time() const;
299 
303  bool
304  is_at_start() const;
305 
309  bool
310  is_at_end() const;
311 
321  double
322  get_next_step_size() const;
323 
329  double
330  get_previous_step_size() const;
331 
336  unsigned int
337  get_step_number() const;
338 
350  void
351  set_desired_next_step_size(const double time_step_size);
352 
366  void
367  set_next_step_size(const double time_step_size);
368 
387  void
388  advance_time();
389 
394  void
395  restart();
396 
397 private:
401  double start_time;
402 
406  double end_time;
407 
411  double current_time;
412 
425  double next_time;
426 
431 
436 
441  unsigned int step_number;
442 };
443 
444 
445 /*---------------------- Inline functions ------------------------------*/
446 
447 
448 inline double
450 {
451  return start_time;
452 }
453 
454 
455 
456 inline double
458 {
459  return end_time;
460 }
461 
462 
463 
464 inline bool
466 {
467  return step_number == 0;
468 }
469 
470 
471 
472 inline bool
474 {
475  return current_time == end_time;
476 }
477 
478 
479 
480 inline double
482 {
483  return next_time - current_time;
484 }
485 
486 
487 
488 inline double
490 {
491  return current_time - previous_time;
492 }
493 
494 
495 
496 inline double
498 {
499  return current_time;
500 }
501 
502 
503 
504 inline double
506 {
507  return next_time;
508 }
509 
510 
511 
512 inline double
514 {
515  return previous_time;
516 }
517 
518 
519 
520 inline unsigned int
522 {
523  return step_number;
524 }
525 
526 
528 
529 #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
void set_next_step_size(const double time_step_size)
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:372
double next_time
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:371
unsigned int get_step_number() const
double get_start_time() const
double get_next_time() const
bool is_at_start() const