3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porenetwork/2p/elementfluxvariablescache.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_PNM_2P_ELEMNT_FLUXVARSCACHE_HH
25#define DUMUX_PNM_2P_ELEMNT_FLUXVARSCACHE_HH
26
27#include <cstddef>
28#include <vector>
29#include <utility>
30
32
33namespace Dumux::PoreNetwork {
34
39template<class GFVC, bool cachingEnabled>
41
46template<class GFVC>
48{
50public:
51 using ParentType::ParentType;
52};
53
58template<class GFVC>
60{
61public:
64
66 using FluxVariablesCache = typename GFVC::FluxVariablesCache;
67
69 : gridFluxVarsCachePtr_(&global) {}
70
71 // Function is called by the BoxLocalJacobian prior to flux calculations on the element.
72 // We assume the FVGeometries to be bound at this point
73 template<class FVElementGeometry, class ElementVolumeVariables>
74 void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
75 const FVElementGeometry& fvGeometry,
76 const ElementVolumeVariables& elemVolVars) &
77 { bindElement(element, fvGeometry, elemVolVars); }
78
84 template<class FVElementGeometry, class ElementVolumeVariables>
85 PNMTwoPElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
86 const FVElementGeometry& fvGeometry,
87 const ElementVolumeVariables& elemVolVars) &&
88 {
89 this->bind(element, fvGeometry, elemVolVars);
90 return std::move(*this);
91 }
92
93 template<class FVElementGeometry, class ElementVolumeVariables>
94 void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
95 const FVElementGeometry& fvGeometry,
96 const ElementVolumeVariables& elemVolVars) &
97 {
98 for (auto&& scvf : scvfs(fvGeometry))
99 fluxVarsCache_.update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf, gridFluxVarsCache().invasionState().invaded(element));
100 }
101
107 template<class FVElementGeometry, class ElementVolumeVariables>
108 PNMTwoPElementFluxVariablesCache bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
109 const FVElementGeometry& fvGeometry,
110 const ElementVolumeVariables& elemVolVars) &&
111 {
112 this->bindElement(element, fvGeometry, elemVolVars);
113 return std::move(*this);
114 }
115
116 template<class FVElementGeometry, class ElementVolumeVariables>
117 void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
118 const FVElementGeometry& fvGeometry,
119 const ElementVolumeVariables& elemVolVars,
120 const typename FVElementGeometry::SubControlVolumeFace& scvf) &
121 {
122 fluxVarsCache_.update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf, gridFluxVarsCache().invasionState().invaded(element));
123 }
124
130 template<class FVElementGeometry, class ElementVolumeVariables>
131 PNMTwoPElementFluxVariablesCache bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
132 const FVElementGeometry& fvGeometry,
133 const ElementVolumeVariables& elemVolVars,
134 const typename FVElementGeometry::SubControlVolumeFace& scvf) &&
135 {
136 this->bindScvf(element, fvGeometry, elemVolVars, scvf);
137 return std::move(*this);
138 }
139
141 template<class SubControlVolumeFace>
142 const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const
143 { return fluxVarsCache_; }
144
146 template<class SubControlVolumeFace>
147 FluxVariablesCache& operator [](const SubControlVolumeFace& scvf)
148 { return fluxVarsCache_; }
149
152 { return *gridFluxVarsCachePtr_; }
153
154private:
155 const GridFluxVariablesCache* gridFluxVarsCachePtr_;
156 FluxVariablesCache fluxVarsCache_;
157};
158
159} // end namespace Dumux::PoreNetwork
160
161#endif
Definition: discretization/porenetwork/fvelementgeometry.hh:34
The flux variables caches for an element.
Definition: discretization/cvfe/elementfluxvariablescache.hh:43
The flux variables caches for an element with caching enabled.
Definition: discretization/cvfe/elementfluxvariablescache.hh:51
The flux variables caches for an element.
Definition: porenetwork/2p/elementfluxvariablescache.hh:40
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: porenetwork/2p/elementfluxvariablescache.hh:94
typename GFVC::FluxVariablesCache FluxVariablesCache
export the type of the flux variables cache
Definition: porenetwork/2p/elementfluxvariablescache.hh:66
PNMTwoPElementFluxVariablesCache bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: porenetwork/2p/elementfluxvariablescache.hh:85
GFVC GridFluxVariablesCache
export the type of the grid flux variables cache
Definition: porenetwork/2p/elementfluxvariablescache.hh:63
void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &
Definition: porenetwork/2p/elementfluxvariablescache.hh:117
PNMTwoPElementFluxVariablesCache bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const typename FVElementGeometry::SubControlVolumeFace &scvf) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: porenetwork/2p/elementfluxvariablescache.hh:131
PNMTwoPElementFluxVariablesCache(const GridFluxVariablesCache &global)
Definition: porenetwork/2p/elementfluxvariablescache.hh:68
PNMTwoPElementFluxVariablesCache bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &&
bind the local view (r-value overload) This overload is called when an instance of this class is a te...
Definition: porenetwork/2p/elementfluxvariablescache.hh:108
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars) &
Definition: porenetwork/2p/elementfluxvariablescache.hh:74
const GridFluxVariablesCache & gridFluxVarsCache() const
The global object we are a restriction of.
Definition: porenetwork/2p/elementfluxvariablescache.hh:151
Global flux variable cache.