version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_MD_FREEFLOW_POROUSMEDIUM_INDEX_HELPER_HH
14#define DUMUX_MD_FREEFLOW_POROUSMEDIUM_INDEX_HELPER_HH
15
16#include <dune/common/indices.hh>
17
19
29template<std::size_t freeFlowIdx, std::size_t porousMediumIndex, class FFFS, bool hasAdapter>
31
40template<std::size_t freeFlowIdx, std::size_t porousMediumIndex, class FFFS>
41struct IndexHelper<freeFlowIdx, porousMediumIndex, FFFS, false>
42{
46 template<std::size_t i>
47 static constexpr auto couplingPhaseIdx(Dune::index_constant<i>, int coupledPhaseIdx = 0)
48 { return coupledPhaseIdx; }
49
53 template<std::size_t i>
54 static constexpr auto couplingCompIdx(Dune::index_constant<i>, int coupledCompdIdx)
55 { return coupledCompdIdx; }
56};
57
66template<std::size_t freeFlowIdx, std::size_t porousMediumIndex, class FFFS>
67struct IndexHelper<freeFlowIdx, porousMediumIndex, FFFS, true>
68{
72 static constexpr int couplingPhaseIdx(Dune::index_constant<freeFlowIdx>, int coupledPhaseIdx = 0)
73 { return 0; }
74
78 static constexpr auto couplingPhaseIdx(Dune::index_constant<porousMediumIndex>, int coupledPhaseIdx = 0)
79 { return FFFS::multiphaseFluidsystemPhaseIdx; }
80
84 static constexpr auto couplingCompIdx(Dune::index_constant<freeFlowIdx>, int coupledCompIdx)
85 { return coupledCompIdx; }
86
90 static constexpr auto couplingCompIdx(Dune::index_constant<porousMediumIndex>, int coupledCompIdx)
91 { return FFFS::compIdx(coupledCompIdx); }
92};
93
94} // end namespace Dumux::FreeFlowPorousMediumCoupling
95
96#endif
Definition: indexhelper.hh:18
static constexpr auto couplingPhaseIdx(Dune::index_constant< i >, int coupledPhaseIdx=0)
No adapter is used, just return the input index.
Definition: indexhelper.hh:47
static constexpr auto couplingCompIdx(Dune::index_constant< i >, int coupledCompdIdx)
No adapter is used, just return the input index.
Definition: indexhelper.hh:54
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:84
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:78
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:90
static constexpr int couplingPhaseIdx(Dune::index_constant< freeFlowIdx >, int coupledPhaseIdx=0)
The free-flow model always uses phase index 0.
Definition: indexhelper.hh:72
Helper struct to choose the correct index for phases and components. This is need if the porous-mediu...
Definition: indexhelper.hh:30