Reference documentation for deal.II version 9.6.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\}}\)
Loading...
Searching...
No Matches
discrete_time.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2020 - 2022 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_discrete_time_h
16#define dealii_discrete_time_h
17
18#include <deal.II/base/config.h>
19
21
233{
234public:
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
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
401 std::size_t
402 memory_consumption() const;
403
411 template <class Archive>
412 void
413 serialize(Archive &ar, const unsigned int version);
414
415private:
420
424 double end_time;
425
430
443 double next_time;
444
449
454
459 unsigned int step_number;
460};
461
462
463/*---------------------- Inline functions ------------------------------*/
464
465
466inline double
468{
469 return start_time;
470}
471
472
473
474inline double
476{
477 return end_time;
478}
479
480
481
482inline bool
484{
485 return step_number == 0;
486}
487
488
489
490inline bool
492{
493 return current_time == end_time;
494}
495
496
497
498inline double
503
504
505
506inline double
511
512
513
514inline double
516{
517 return current_time;
518}
519
520
521
522inline double
524{
525 return next_time;
526}
527
528
529
530inline double
532{
533 return previous_time;
534}
535
536
537
538inline unsigned int
540{
541 return step_number;
542}
543
544
545
546template <class Archive>
547inline void
548DiscreteTime::serialize(Archive &ar, const unsigned int)
549{
550 ar &start_time;
551 ar &end_time;
552 ar &current_time;
553 ar &next_time;
554 ar &previous_time;
555 ar &start_step_size;
556 ar &step_number;
557}
558
560
561#endif
double get_previous_time() const
double get_next_step_size() const
void set_desired_next_step_size(const double time_step_size)
std::size_t memory_consumption() const
unsigned int get_step_number() const
double previous_time
void serialize(Archive &ar, const unsigned int version)
bool is_at_end() const
double get_current_time() const
bool is_at_start() const
void set_next_step_size(const double time_step_size)
DiscreteTime(const double start_time, const double end_time, const double desired_start_step_size=0.)
double get_next_time() const
double get_previous_step_size() const
void advance_time()
double current_time
double start_step_size
unsigned int step_number
double get_start_time() const
double get_end_time() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504