3.6-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 <utility>
29
30#include <dune/common/ftraits.hh>
31#include <dune/common/exceptions.hh>
32#include <dune/common/std/type_traits.hh>
34
35namespace Dumux {
36
37#ifndef DOXYGEN // hide from doxygen
38// Helper classes/functions for deprecation
39// Each implementation has to state after which release
40// it will be removed. Implementations in the Deprecated
41// namespace will be removed without
42// deprecation after their usage in the code expired,
43// so most likely you don't want to use this in your code
44namespace Deprecated {
45
46#ifdef __clang__
47#pragma clang diagnostic push
48#pragma clang diagnostic ignored "-Wdeprecated-declarations"
49#endif // __clang__
50
51template<class G>
52using DetectFVGeometryHasSCVGeometry = decltype(std::declval<G>().geometry(std::declval<typename G::SubControlVolume>()));
53
54template<class G>
55using DetectFVGeometryHasSCVFGeometry = decltype(std::declval<G>().geometry(std::declval<typename G::SubControlVolumeFace>()));
56
57template<class G>
58constexpr inline bool hasSCVGeometryInterface()
59{ return Dune::Std::is_detected<DetectFVGeometryHasSCVGeometry, G>::value; }
60
61template<class G>
62constexpr inline bool hasSCVFGeometryInterface()
63{ return Dune::Std::is_detected<DetectFVGeometryHasSCVFGeometry, G>::value; }
64
65#ifdef __clang__
66#pragma clang diagnostic pop
67#endif // __clang__
68
69template<bool enableWaterDiffusionInAir>
70struct ExtendedRichardsHelper
71{
72 template<bool b>
73 [[deprecated("Enabling the extended Richards model through a template parameter/properties is deprecated and will be removed after release (3.6). Use the new model ExtendedRichards instead.")]]
74 static constexpr void extendedRichardsWithTemplateParameter() {}
75
76 static constexpr bool isExtendedRichards()
77 {
78 if constexpr(enableWaterDiffusionInAir)
79 extendedRichardsWithTemplateParameter<enableWaterDiffusionInAir>();
80 return enableWaterDiffusionInAir;
81 }
82};
83
88template<class PrimaryVariables, class StateType>
89class RichardsSwitchablePrimaryVariables : public PrimaryVariables
90{
91 using ParentType = PrimaryVariables;
92public:
94 using ParentType::ParentType;
96 using ParentType::operator=;
97
98 [[deprecated("Will be removed after release (3.6). Normal Richards does not require setting a state. Use ExtendedRichards for extended model. "
99 "After removing all .setState()/.state() calls in the user files the remaining deprecation warnings can be removed by changing the PrimaryVariables property to Dune::FieldVector. "
100 "template<class TypeTag> "
101 "struct PrimaryVariables<TypeTag, TTag::Richards> "
102 "{ using type = Dune::FieldVector<GetPropType<TypeTag, Properties::Scalar>, GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; }")]]
103 StateType state() const
104 {
105 return state_;
106 }
107
109 [[deprecated("Will be removed after release (3.6). Normal Richards does not require setting a state. Use ExtendedRichards for extended model."
110 "After removing all .setState()/.state() calls in the user files the remaining deprecation warnings can be removed by changing the PrimaryVariables property to Dune::FieldVector. "
111 "template<class TypeTag> "
112 "struct PrimaryVariables<TypeTag, TTag::Richards> "
113 "{ using type = Dune::FieldVector<GetPropType<TypeTag, Properties::Scalar>, GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; }")]]
114 void setState(StateType state)
115 {
116 state_ = std::move(state);
117 stateIsSet_ = true;
118 }
119
121 void invalidateState()
122 {
123 stateIsSet_ = false;
124 }
125
126private:
127 StateType state_;
128 bool stateIsSet_{false};
129};
130
131
132} // end namespace Deprecated
133#endif
134
139template<class PrimaryVariables, class StateType>
140struct NumEqVectorTraits<Deprecated::RichardsSwitchablePrimaryVariables<PrimaryVariables, StateType>>
141{
142 static constexpr std::size_t numEq = PrimaryVariables::size();
143 using type = PrimaryVariables;
144};
145
146} // end namespace Dumux
147
148// specialize field traits for this type
149namespace Dune {
150
151template <class PrimaryVariables, class StateType>
152struct FieldTraits<Dumux::Deprecated::RichardsSwitchablePrimaryVariables<PrimaryVariables, StateType>>
153: public FieldTraits<PrimaryVariables>
154{};
155
156} // end namespace Dune
157#endif
A helper to deduce a vector with the same size as numbers of equations.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: deprecated.hh:149
Definition: numeqvector.hh:33
static constexpr std::size_t numEq
Definition: numeqvector.hh:34