deal.II version GIT relicensing-2574-g486eec3ad1 2025-02-07 04:40:00+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: 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
20#include <cstddef>
21
22
24
236{
237public:
258 DiscreteTime(const double start_time,
259 const double end_time,
260 const double desired_start_step_size = 0.);
261
265 double
266 get_current_time() const;
267
275 double
276 get_next_time() const;
277
284 double
285 get_previous_time() const;
286
290 double
291 get_start_time() const;
292
300 double
301 get_end_time() const;
302
306 bool
307 is_at_start() const;
308
312 bool
313 is_at_end() const;
314
324 double
325 get_next_step_size() const;
326
332 double
334
339 unsigned int
340 get_step_number() const;
341
353 void
354 set_desired_next_step_size(const double time_step_size);
355
369 void
370 set_next_step_size(const double time_step_size);
371
390 void
391 advance_time();
392
397 void
398 restart();
399
404 std::size_t
405 memory_consumption() const;
406
414 template <class Archive>
415 void
416 serialize(Archive &ar, const unsigned int version);
417
418private:
423
427 double end_time;
428
433
446 double next_time;
447
452
457
462 unsigned int step_number;
463};
464
465
466/*---------------------- Inline functions ------------------------------*/
467
468
469inline double
471{
472 return start_time;
473}
474
475
476
477inline double
479{
480 return end_time;
481}
482
483
484
485inline bool
487{
488 return step_number == 0;
489}
490
491
492
493inline bool
495{
496 return current_time == end_time;
497}
498
499
500
501inline double
506
507
508
509inline double
514
515
516
517inline double
519{
520 return current_time;
521}
522
523
524
525inline double
527{
528 return next_time;
529}
530
531
532
533inline double
535{
536 return previous_time;
537}
538
539
540
541inline unsigned int
543{
544 return step_number;
545}
546
547
548
549template <class Archive>
550inline void
551DiscreteTime::serialize(Archive &ar, const unsigned int)
552{
553 ar &start_time;
554 ar &end_time;
555 ar &current_time;
556 ar &next_time;
557 ar &previous_time;
558 ar &start_step_size;
559 ar &step_number;
560}
561
563
564#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:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499