3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
indexhelper.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 *****************************************************************************/
25#ifndef DUMUX_MD_FREEFLOW_POROUSMEDIUM_INDEX_HELPER_HH
26#define DUMUX_MD_FREEFLOW_POROUSMEDIUM_INDEX_HELPER_HH
27
28#include <dune/common/indices.hh>
29
31
41template<std::size_t freeFlowIdx, std::size_t porousMediumIndex, class FFFS, bool hasAdapter>
43
52template<std::size_t freeFlowIdx, std::size_t porousMediumIndex, class FFFS>
53struct IndexHelper<freeFlowIdx, porousMediumIndex, FFFS, false>
54{
58 template<std::size_t i>
59 static constexpr auto couplingPhaseIdx(Dune::index_constant<i>, int coupledPhaseIdx = 0)
60 { return coupledPhaseIdx; }
61
65 template<std::size_t i>
66 static constexpr auto couplingCompIdx(Dune::index_constant<i>, int coupledCompdIdx)
67 { return coupledCompdIdx; }
68};
69
78template<std::size_t freeFlowIdx, std::size_t porousMediumIndex, class FFFS>
79struct IndexHelper<freeFlowIdx, porousMediumIndex, FFFS, true>
80{
84 static constexpr int couplingPhaseIdx(Dune::index_constant<freeFlowIdx>, int coupledPhaseIdx = 0)
85 { return 0; }
86
90 static constexpr auto couplingPhaseIdx(Dune::index_constant<porousMediumIndex>, int coupledPhaseIdx = 0)
91 { return FFFS::multiphaseFluidsystemPhaseIdx; }
92
96 static constexpr auto couplingCompIdx(Dune::index_constant<freeFlowIdx>, int coupledCompIdx)
97 { return coupledCompIdx; }
98
102 static constexpr auto couplingCompIdx(Dune::index_constant<porousMediumIndex>, int coupledCompIdx)
103 { return FFFS::compIdx(coupledCompIdx); }
104};
105
106} // end namespace Dumux::FreeFlowPorousMediumCoupling
107
108#endif
static constexpr auto porousMediumIndex
Definition: multidomain/boundary/freeflowporousmedium/couplingmanager.hh:47
Definition: indexhelper.hh:30
Helper struct to choose the correct index for phases and components. This is need if the porous-mediu...
Definition: indexhelper.hh:42
static constexpr auto couplingPhaseIdx(Dune::index_constant< i >, int coupledPhaseIdx=0)
No adapter is used, just return the input index.
Definition: indexhelper.hh:59
static constexpr auto couplingCompIdx(Dune::index_constant< i >, int coupledCompdIdx)
No adapter is used, just return the input index.
Definition: indexhelper.hh:66
static constexpr auto couplingCompIdx(Dune::index_constant< freeFlowIdx >, int coupledCompIdx)
The free-flow model does not need any change of the component index.
Definition: indexhelper.hh:96
static constexpr auto couplingPhaseIdx(Dune::index_constant< porousMediumIndex >, int coupledPhaseIdx=0)
The phase index of the porous-medium-flow model is given by the adapter fluidsystem (i....
Definition: indexhelper.hh:90
static constexpr auto couplingCompIdx(Dune::index_constant< porousMediumIndex >, int coupledCompIdx)
The component index of the porous-medium-flow model is mapped by the adapter fluidsystem.
Definition: indexhelper.hh:102
static constexpr int couplingPhaseIdx(Dune::index_constant< freeFlowIdx >, int coupledPhaseIdx=0)
The free-flow model always uses phase index 0.
Definition: indexhelper.hh:84