version 3.8
parametercachebase.hh
Go to the documentation of this file.
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//
12#ifndef DUMUX_PARAMETER_CACHE_BASE_HH
13#define DUMUX_PARAMETER_CACHE_BASE_HH
14
15namespace Dumux {
16
21template <class Implementation>
23{
24public:
26 None = 0,
29 Composition = 4
30 };
31
39 template <class FluidState>
40 void updateAll(const FluidState &fs, int exceptQuantities = None)
41 {
42 for (int phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
43 asImp_().updatePhase(fs, phaseIdx);
44 }
45
50 template <class FluidState>
51 void updateAllPressures(const FluidState &fs)
52 {
53 for (int phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
54 asImp_().updatePhase(fs, phaseIdx);
55 }
56
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
74 template <class FluidState>
75 void updatePhase(const FluidState &fs, int phaseIdx, int exceptQuantities = None)
76 {}
77
86 template <class FluidState>
87 void updateTemperature(const FluidState &fs, int phaseIdx)
88 {
89 asImp_().updatePhase(fs, phaseIdx);
90 }
91
100 template <class FluidState>
101 void updatePressure(const FluidState &fs, int phaseIdx)
102 {
103 asImp_().updatePhase(fs, phaseIdx);
104 }
105
114 template <class FluidState>
115 void updateComposition(const FluidState &fs, int phaseIdx)
116 {
117 asImp_().updatePhase(fs, phaseIdx, /*except=*/Temperature | Pressure);
118 }
119
129 template <class FluidState>
130 void updateSingleMoleFraction(const FluidState &fs,
131 int phaseIdx,
132 int compIdx)
133 {
134 asImp_().updateComposition(fs, phaseIdx);
135 }
136
137private:
138 Implementation &asImp_()
139 { return *static_cast<Implementation*>(this); }
140};
141
142} // end namespace
143
144#endif
The base class of the parameter cache classes for fluid systems.
Definition: parametercachebase.hh:23
void updateSingleMoleFraction(const FluidState &fs, int phaseIdx, int compIdx)
Update all cached parameters of a specific fluid phase which depend on the mole fraction of a single ...
Definition: parametercachebase.hh:130
void updatePhase(const FluidState &fs, int phaseIdx, int exceptQuantities=None)
Update all cached parameters of a specific fluid phase.
Definition: parametercachebase.hh:75
void updateAll(const FluidState &fs, int exceptQuantities=None)
Update all cached quantities for all phases.
Definition: parametercachebase.hh:40
void updateAllPressures(const FluidState &fs)
Update all cached quantities which depend on the pressure of any fluid phase.
Definition: parametercachebase.hh:51
void updateComposition(const FluidState &fs, int phaseIdx)
Update all cached parameters of a specific fluid phase which depend on composition.
Definition: parametercachebase.hh:115
void updateTemperature(const FluidState &fs, int phaseIdx)
Update all cached parameters of a specific fluid phase which depend on temperature.
Definition: parametercachebase.hh:87
void updateAllTemperatures(const FluidState &fs)
Update all cached quantities which depend on the temperature of any fluid phase.
Definition: parametercachebase.hh:62
ExceptQuantities
Definition: parametercachebase.hh:25
@ Composition
Definition: parametercachebase.hh:29
@ Pressure
Definition: parametercachebase.hh:28
@ Temperature
Definition: parametercachebase.hh:27
@ None
Definition: parametercachebase.hh:26
void updatePressure(const FluidState &fs, int phaseIdx)
Update all cached parameters of a specific fluid phase which depend on pressure.
Definition: parametercachebase.hh:101
Definition: adapt.hh:17