Loading...
Searching...
No Matches
ParameterCacheBase.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_PARAMETER_CACHE_BASE_HPP
#define OPM_PARAMETER_CACHE_BASE_HPP
namespace Opm {
template <class Implementation>
class ParameterCacheBase
{
public:
enum ExceptQuantities {
None = 0,
Temperature = 1,
Pressure = 2,
Composition = 4
};
ParameterCacheBase()
{}
template <class OtherCache>
void assignPersistentData(const OtherCache& /* other */)
{}
template <class FluidState>
void updateAll(const FluidState& fluidState, int /*exceptQuantities*/ = None)
{
for (unsigned phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
asImp_().updatePhase(fluidState, phaseIdx);
}
template <class FluidState>
void updateAllPressures(const FluidState& fluidState)
{ asImp_().updateAll(fluidState, Temperature | Composition); }
template <class FluidState>
void updateAllTemperatures(const FluidState& fluidState)
{
for (unsigned phaseIdx = 0; phaseIdx < FluidState::numPhases; ++phaseIdx)
asImp_().updatePhase(fluidState, phaseIdx);
}
template <class FluidState>
void updatePhase(const FluidState& /*fluidState*/, unsigned /*phaseIdx*/, int /*exceptQuantities*/ = None)
{}
template <class FluidState>
void updateTemperature(const FluidState& fluidState, unsigned phaseIdx)
{
asImp_().updatePhase(fluidState, phaseIdx);
}
template <class FluidState>
void updatePressure(const FluidState& fluidState, unsigned phaseIdx)
{
asImp_().updatePhase(fluidState, phaseIdx);
}
template <class FluidState>
void updateComposition(const FluidState& fluidState, unsigned phaseIdx)
{
asImp_().updatePhase(fluidState, phaseIdx, /*except=*/Temperature | Pressure);
}
template <class FluidState>
void updateSingleMoleFraction(const FluidState& fluidState,
unsigned phaseIdx,
unsigned /*compIdx*/)
{
asImp_().updateComposition(fluidState, phaseIdx);
}
private:
Implementation& asImp_()
{ return *static_cast<Implementation*>(this); }
};
} // namespace Opm
#endif
Opm::ParameterCacheBase
The base class of the parameter caches of fluid systems.
Definition ParameterCacheBase.hpp:38
Opm::ParameterCacheBase::updateTemperature
void updateTemperature(const FluidState &fluidState, unsigned phaseIdx)
Update all cached parameters of a specific fluid phase which depend on temperature.
Definition ParameterCacheBase.hpp:134
Opm::ParameterCacheBase::assignPersistentData
void assignPersistentData(const OtherCache &)
Copy the data which is not dependent on the type of the Scalars from another parameter cache.
Definition ParameterCacheBase.hpp:65
Opm::ParameterCacheBase::updateAllPressures
void updateAllPressures(const FluidState &fluidState)
Update pressure dependent quantities of the parameter cache for all phases.
Definition ParameterCacheBase.hpp:91
Opm::ParameterCacheBase::updateAllTemperatures
void updateAllTemperatures(const FluidState &fluidState)
Update temperature dependent quantities of the parameter cache for all phases.
Definition ParameterCacheBase.hpp:104
Opm::ParameterCacheBase::updateAll
void updateAll(const FluidState &fluidState, int=None)
Update the quantities of the parameter cache for all phases.
Definition ParameterCacheBase.hpp:75
Opm::ParameterCacheBase::updateSingleMoleFraction
void updateSingleMoleFraction(const FluidState &fluidState, unsigned phaseIdx, unsigned)
Update all cached parameters of a specific fluid phase which depend on the mole fraction of a single ...
Definition ParameterCacheBase.hpp:187
Opm::ParameterCacheBase::updateComposition
void updateComposition(const FluidState &fluidState, unsigned phaseIdx)
Update all cached parameters of a specific fluid phase which depend on composition.
Definition ParameterCacheBase.hpp:168
Opm::ParameterCacheBase::updatePressure
void updatePressure(const FluidState &fluidState, unsigned phaseIdx)
Update all cached parameters of a specific fluid phase which depend on pressure.
Definition ParameterCacheBase.hpp:151
Opm::ParameterCacheBase::ExceptQuantities
ExceptQuantities
Constants for ORing the quantities of the fluid state that have not changed since the last update.
Definition ParameterCacheBase.hpp:43
Opm::ParameterCacheBase< ThisType >::Temperature
@ Temperature
Definition ParameterCacheBase.hpp:48
Opm::ParameterCacheBase< ThisType >::None
@ None
Definition ParameterCacheBase.hpp:45
Opm::ParameterCacheBase< ThisType >::Pressure
@ Pressure
Definition ParameterCacheBase.hpp:51
Opm::ParameterCacheBase< ThisType >::Composition
@ Composition
Definition ParameterCacheBase.hpp:54
Opm::ParameterCacheBase::updatePhase
void updatePhase(const FluidState &, unsigned, int=None)
Update all cached parameters of a specific fluid phase.
Definition ParameterCacheBase.hpp:119
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30