GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/experimental/timestepping/timelevel.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 2 3 66.7%
Functions: 0 1 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 //
4 // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 /*!
8 * \file
9 * \ingroup Experimental
10 * \brief Class that represents a time level during time integration.
11 */
12 #ifndef DUMUX_TIMESTEPPING_TIME_LEVEL_HH
13 #define DUMUX_TIMESTEPPING_TIME_LEVEL_HH
14
15 namespace Dumux::Experimental {
16
17 /*!
18 * \brief Class that represents a time level during time integration.
19 */
20 template<class Scalar>
21 class TimeLevel
22 {
23 public:
24
25 /*!
26 * \brief Construct a time level with a time.
27 * \note This can be used in contexts outside of time integration,
28 * where no information on a previous time or time step size is needed.
29 */
30 2 explicit TimeLevel(Scalar curTime)
31 : curTime_(curTime)
32 , prevTime_(curTime)
33 2 , timeStepFraction_(1.0)
34 {}
35
36 /*!
37 * \brief Construct a time level with information on an ongoing time step.
38 * \param curTime The current time level
39 * \param prevTime The previous time level
40 * \param dtFraction The fraction of a time step this level corresponds to.
41 * \note Within a time integration step, several time levels might occur
42 * when multi-stage methods are used. The argument dtFraction allows
43 * for determining the time that will be reached at the end of the
44 * time integration step.
45 */
46 TimeLevel(Scalar curTime, Scalar prevTime, Scalar dtFraction)
47 : curTime_(curTime)
48 , prevTime_(prevTime)
49 , timeStepFraction_(dtFraction)
50 {}
51
52 //! Return the current time
53 Scalar current() const { return curTime_; }
54 //! Return the time at the beginning of time integration
55 Scalar previous() const { return prevTime_; }
56 //! Return the fraction of the time step this level corresponds to
57 Scalar timeStepFraction() const { return timeStepFraction_; }
58
59 private:
60 Scalar curTime_;
61 Scalar prevTime_;
62 Scalar timeStepFraction_;
63 };
64
65 } // end namespace Dumux::Experimental
66
67 #endif
68