GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/fluidsystems/parametercachebase.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 8 22 36.4%
Functions: 0 388 0.0%
Branches: 19 46 41.3%

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 FluidSystems
10 * \brief @copybrief Dumux::ParameterCacheBase
11 */
12 #ifndef DUMUX_PARAMETER_CACHE_BASE_HH
13 #define DUMUX_PARAMETER_CACHE_BASE_HH
14
15 namespace Dumux {
16
17 /*!
18 * \ingroup FluidSystems
19 * \brief The base class of the parameter cache classes for fluid systems
20 */
21 template <class Implementation>
22 class ParameterCacheBase
23 {
24 public:
25 enum ExceptQuantities {
26 None = 0,
27 Temperature = 1,
28 Pressure = 2,
29 Composition = 4
30 };
31
32 /*!
33 * \brief Update all cached quantities for all phases.
34 *
35 * The <tt>except</tt> argument contains a bit field of the quantities
36 * which have not been modified since the last call to an <tt>update()</tt>
37 * method.
38 */
39 template <class FluidState>
40 void updateAll(const FluidState &fs, int exceptQuantities = None)
41 {
42
8/28
✓ Branch 0 taken 6969 times.
✓ Branch 1 taken 2323 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 156 times.
✓ Branch 5 taken 52 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 3 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
353452388 for (int phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
43
3/6
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
7131 asImp_().updatePhase(fs, phaseIdx);
44 }
45
46 /*!
47 * \brief Update all cached quantities which depend on the pressure of any
48 * fluid phase.
49 */
50 template <class FluidState>
51 void updateAllPressures(const FluidState &fs)
52 {
53
4/4
✓ Branch 0 taken 4989 times.
✓ Branch 1 taken 1663 times.
✓ Branch 2 taken 9972 times.
✓ Branch 3 taken 3324 times.
19986 for (int phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
54
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
14961 asImp_().updatePhase(fs, phaseIdx);
55 }
56
57 /*!
58 * \brief Update all cached quantities which depend on the temperature of any
59 * fluid phase.
60 */
61 template <class FluidState>
62 void updateAllTemperatures(const FluidState &fs)
63 {
64 for (int phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
65 asImp_().updatePhase(fs, phaseIdx);
66 }
67
68 /*!
69 * \brief Update all cached parameters of a specific fluid phase
70 *
71 * The quantities specified by the <tt>except</tt> bit field have not been
72 * modified since since the last call to an <tt>update()</tt> method.
73 */
74 template <class FluidState>
75 void updatePhase(const FluidState &fs, int phaseIdx, int exceptQuantities = None)
76 {}
77
78 /*!
79 * \brief Update all cached parameters of a specific fluid phase
80 * which depend on temperature
81 *
82 * \b Only use this method if only the temperature of a phase
83 * changed between two update*() calls. If more changed, call
84 * updatePhase()!
85 */
86 template <class FluidState>
87 void updateTemperature(const FluidState &fs, int phaseIdx)
88 {
89
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
67 asImp_().updatePhase(fs, phaseIdx);
90 }
91
92 /*!
93 * \brief Update all cached parameters of a specific fluid phase
94 * which depend on pressure
95 *
96 * \b Only use this method if only the pressure of a phase changed
97 * between two update*() calls. If more changed, call
98 * updatePhase()!
99 */
100 template <class FluidState>
101 void updatePressure(const FluidState &fs, int phaseIdx)
102 {
103
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
67 asImp_().updatePhase(fs, phaseIdx);
104 }
105
106 /*!
107 * \brief Update all cached parameters of a specific fluid phase
108 * which depend on composition
109 *
110 * \b Only use this method if neither the pressure nor the
111 * temperature of the phase changed between two update*()
112 * calls. If more changed, call updatePhase()!
113 */
114 template <class FluidState>
115 void updateComposition(const FluidState &fs, int phaseIdx)
116 {
117
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
171084625 asImp_().updatePhase(fs, phaseIdx, /*except=*/Temperature | Pressure);
118 }
119
120 /*!
121 * \brief Update all cached parameters of a specific fluid phase
122 * which depend on the mole fraction of a single component
123 *
124 * \b Only use this method if just a single component's
125 * concentration changed between two update*() calls. If more than
126 * one concentration changed, call updatePhaseComposition() of
127 * updatePhase()!
128 */
129 template <class FluidState>
130 void updateSingleMoleFraction(const FluidState &fs,
131 int phaseIdx,
132 int compIdx)
133 {
134 392 asImp_().updateComposition(fs, phaseIdx);
135 }
136
137 private:
138 Implementation &asImp_()
139 { return *static_cast<Implementation*>(this); }
140 };
141
142 } // end namespace
143
144 #endif
145