deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\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: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2020 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_discrete_time_h
14#define dealii_discrete_time_h
15
16#include <deal.II/base/config.h>
17
18#include <cstddef>
19
20
22
234{
235public:
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
332
337 unsigned int
338 get_step_number() const;
339
351 void
352 set_desired_next_step_size(const double time_step_size);
353
367 void
368 set_next_step_size(const double time_step_size);
369
388 void
389 advance_time();
390
395 void
396 restart();
397
402 std::size_t
403 memory_consumption() const;
404
412 template <class Archive>
413 void
414 serialize(Archive &ar, const unsigned int version);
415
416private:
421
425 double end_time;
426
431
444 double next_time;
445
450
455
460 unsigned int step_number;
461};
462
463
464/*---------------------- Inline functions ------------------------------*/
465
466
467inline double
469{
470 return start_time;
471}
472
473
474
475inline double
477{
478 return end_time;
479}
480
481
482
483inline bool
485{
486 return step_number == 0;
487}
488
489
490
491inline bool
493{
494 return current_time == end_time;
495}
496
497
498
499inline double
504
505
506
507inline double
512
513
514
515inline double
517{
518 return current_time;
519}
520
521
522
523inline double
525{
526 return next_time;
527}
528
529
530
531inline double
533{
534 return previous_time;
535}
536
537
538
539inline unsigned int
541{
542 return step_number;
543}
544
545
546
547template <class Archive>
548inline void
549DiscreteTime::serialize(Archive &ar, const unsigned int)
550{
551 ar &start_time;
552 ar &end_time;
553 ar &current_time;
554 ar &next_time;
555 ar &previous_time;
556 ar &start_step_size;
557 ar &step_number;
558}
559
561
562#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)
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:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39