3.4
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>
30
31namespace Dumux::PoreNetwork {
32
37template<class GFVC, bool cachingEnabled>
39
44template<class GFVC>
46{
48public:
49 using ParentType::ParentType;
50};
51
56template<class GFVC>
58{
59public:
62
64 using FluxVariablesCache = typename GFVC::FluxVariablesCache;
65
67 : gridFluxVarsCachePtr_(&global) {}
68
69 // Function is called by the BoxLocalJacobian prior to flux calculations on the element.
70 // We assume the FVGeometries to be bound at this point
71 template<class FVElementGeometry, class ElementVolumeVariables>
72 void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
73 const FVElementGeometry& fvGeometry,
74 const ElementVolumeVariables& elemVolVars)
75 {
76 bindElement(element, fvGeometry, elemVolVars);
77 }
78
79 template<class FVElementGeometry, class ElementVolumeVariables>
80 void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
81 const FVElementGeometry& fvGeometry,
82 const ElementVolumeVariables& elemVolVars)
83 {
84 for (auto&& scvf : scvfs(fvGeometry))
85 fluxVarsCache_.update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf, gridFluxVarsCache().invasionState().invaded(element));
86 }
87
88 template<class FVElementGeometry, class ElementVolumeVariables>
89 void bindScvf(const typename FVElementGeometry::GridGeometry::GridView::template Codim<0>::Entity& element,
90 const FVElementGeometry& fvGeometry,
91 const ElementVolumeVariables& elemVolVars,
92 const typename FVElementGeometry::SubControlVolumeFace& scvf)
93 {
94 fluxVarsCache_.update(gridFluxVarsCache().problem(), element, fvGeometry, elemVolVars, scvf, gridFluxVarsCache().invasionState().invaded(element));
95 }
96
98 template<class SubControlVolumeFace>
99 const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const
100 { return fluxVarsCache_; }
101
103 template<class SubControlVolumeFace>
104 FluxVariablesCache& operator [](const SubControlVolumeFace& scvf)
105 { return fluxVarsCache_; }
106
109 { return *gridFluxVarsCachePtr_; }
110
111private:
112 const GridFluxVariablesCache* gridFluxVarsCachePtr_;
113 FluxVariablesCache fluxVarsCache_;
114};
115
116} // end namespace Dumux::PoreNetwork
117
118#endif
Definition: discretization/porenetwork/fvelementgeometry.hh:33
The flux variables caches for an element.
Definition: discretization/box/elementfluxvariablescache.hh:42
The flux variables caches for an element with caching enabled.
Definition: discretization/box/elementfluxvariablescache.hh:50
The flux variables caches for an element.
Definition: porenetwork/2p/elementfluxvariablescache.hh:38
typename GFVC::FluxVariablesCache FluxVariablesCache
export the type of the flux variables cache
Definition: porenetwork/2p/elementfluxvariablescache.hh:64
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:89
GFVC GridFluxVariablesCache
export the type of the grid flux variables cache
Definition: porenetwork/2p/elementfluxvariablescache.hh:61
void bind(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars)
Definition: porenetwork/2p/elementfluxvariablescache.hh:72
void bindElement(const typename FVElementGeometry::GridGeometry::GridView::template Codim< 0 >::Entity &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars)
Definition: porenetwork/2p/elementfluxvariablescache.hh:80
PNMTwoPElementFluxVariablesCache(const GridFluxVariablesCache &global)
Definition: porenetwork/2p/elementfluxvariablescache.hh:66
const GridFluxVariablesCache & gridFluxVarsCache() const
The global object we are a restriction of.
Definition: porenetwork/2p/elementfluxvariablescache.hh:108
Global flux variable cache.