3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
deprecated.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_COMMON_DEPRECATED_HH
26#define DUMUX_COMMON_DEPRECATED_HH
27
28#include <type_traits>
29
30#include <dune/common/deprecated.hh>
31
33
34namespace Dumux {
35
36#ifndef DOXYGEN // hide from doxygen
37// Helper classes/functions for deprecation
38// Each implementation has to state after which release
39// it will be removed. Implementations in the Deprecated
40// namespace will be removed without
41// deprecation after their usage in the code exprired,
42// so most likely you don't want to use this in your code
43namespace Deprecated {
44
48
49
50// support old interface of the effective thermal conductivity laws
51template<class VV>
52struct HasNewEffThermCondIF
53{
54 template<class ETC>
55 auto operator()(ETC&& e) -> decltype(e.effectiveThermalConductivity(std::declval<const VV&>())) {}
56};
57
58template<class ETC, class VV, class SpatialParams, class Element, class FVGeometry,
59 typename std::enable_if_t<!decltype(isValid(HasNewEffThermCondIF<VV>()).template check<ETC>())::value, int> = 0>
60auto effectiveThermalConductivity(const VV& volVars,
61 const SpatialParams& spatialParams,
62 const Element& element,
63 const FVGeometry& fvGeometry,
64 const typename FVGeometry::SubControlVolume& scv)
65{
66 return ETC::effectiveThermalConductivity(volVars, spatialParams, element, fvGeometry, scv);
67}
68
69template<class ETC, class VV, class SpatialParams, class Element, class FVGeometry,
70 typename std::enable_if_t<decltype(isValid(HasNewEffThermCondIF<VV>()).template check<ETC>())::value, int> = 0>
71auto effectiveThermalConductivity(const VV& volVars,
72 const SpatialParams& spatialParams,
73 const Element& element,
74 const FVGeometry& fvGeometry,
75 const typename FVGeometry::SubControlVolume& scv)
76{
77 return ETC::effectiveThermalConductivity(volVars);
78}
79
80// support old interface of the neumann() function on problems
81template<class E, class FVEG, class EVV, class EFVC>
82class HasNewNeumannIF
83{
84 using SCVF = typename FVEG::SubControlVolumeFace;
85
86public:
87 template<class P>
88 auto operator()(P&& p) -> decltype(p.neumann(std::declval<const E&>(),
89 std::declval<const FVEG&>(),
90 std::declval<const EVV&>(),
91 std::declval<const EFVC&>(),
92 std::declval<const SCVF&>()))
93 {}
94};
95
96template<class P, class E, class FVEG, class EVV, class EFVC,
97 typename std::enable_if_t<!decltype(isValid(HasNewNeumannIF<E, FVEG, EVV, EFVC>()).template check<P>())::value, int> = 0>
98auto DUNE_DEPRECATED_MSG("Use new neumann() interface (see common/fvproblem.hh) that additionally receives the element flux variables cache in your problem!. Will be removed after 3.1 release")
99neumann(const P& problem,
100 const E& element,
101 const FVEG& fvGeometry,
102 const EVV& elemVolVars,
103 const EFVC& elemFluxVarsCache,
104 const typename FVEG::SubControlVolumeFace& scvf)
105{
106 return problem.neumann(element, fvGeometry, elemVolVars, scvf);
107}
108
109template<class P, class E, class FVEG, class EVV, class EFVC,
110 typename std::enable_if_t<decltype(isValid(HasNewNeumannIF<E, FVEG, EVV, EFVC>()).template check<P>())::value, int> = 0>
111auto neumann(const P& problem,
112 const E& element,
113 const FVEG& fvGeometry,
114 const EVV& elemVolVars,
115 const EFVC& elemFluxVarsCache,
116 const typename FVEG::SubControlVolumeFace& scvf)
117{
118 return problem.neumann(element, fvGeometry, elemVolVars, elemFluxVarsCache, scvf);
119}
120
121
124
125} // end namespace Deprecated
126#endif
127
128} // end namespace Dumux
129
130#endif
A helper function for class member function introspection.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29