3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
method.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_DISCRETIZATION_METHOD_HH
25#define DUMUX_DISCRETIZATION_METHOD_HH
26
27#include <ostream>
28#include <string>
29
30#include <dumux/common/tag.hh>
31
32namespace Dumux {
33
42{
43 none, box, cctpfa, ccmpfa, staggered, fem, fcstaggered
44};
45
46
47namespace DiscretizationMethods {
48
49struct CCTpfa : public Utility::Tag<CCTpfa> {
50 static std::string name() { return "cctpfa"; }
51
52 //conversion operator
53 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
54 constexpr operator DiscretizationMethod() const
55 {
57 }
58};
59
60
61struct CCMpfa : public Utility::Tag<CCMpfa> {
62 static std::string name() { return "ccmpfa"; }
63
64 //conversion operator
65 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
66 constexpr operator DiscretizationMethod() const
67 {
69 }
70};
71
72
73struct Box : public Utility::Tag<Box> {
74 static std::string name() { return "box"; }
75
76 //conversion operator
77 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
78 constexpr operator DiscretizationMethod() const
79 {
81 }
82};
83
84
85
86struct Staggered : public Utility::Tag<Staggered> {
87 static std::string name() { return "staggered"; }
88
89 //conversion operator
90 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
91 constexpr operator DiscretizationMethod() const
92 {
94 }
95};
96
97
98
99struct FEM : public Utility::Tag<FEM> {
100 static std::string name() { return "fem"; }
101
102 //conversion operator
103 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
104 constexpr operator DiscretizationMethod() const
105 {
107 }
108};
109
110
111
112struct FCStaggered : public Utility::Tag<FCStaggered> {
113 static std::string name() { return "fcstaggered"; }
114
115 //conversion operator
116 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
117 constexpr operator DiscretizationMethod() const
118 {
120 }
121};
122
123
124
125struct None : public Utility::Tag<None> {
126 static std::string name() { return "none"; }
127
128 //conversion operator
129 [[deprecated("Conversion to enum is deprecated. Will be removed after 3.5. Use tags.")]]
130 constexpr operator DiscretizationMethod() const
131 {
133 }
134};
135
136
137inline constexpr CCTpfa cctpfa{};
138inline constexpr CCMpfa ccmpfa{};
139inline constexpr Box box{};
140inline constexpr Staggered staggered{};
141inline constexpr FEM fem{};
142inline constexpr FCStaggered fcstaggered{};
143inline constexpr None none{};
144
145} // end namespace DiscretizationMethods
146
151[[deprecated("Use discretization tags and their name attribute. Will be removed after 3.5")]]
152inline std::string toString(DiscretizationMethod m)
153{
154 switch (m)
155 {
156 case DiscretizationMethod::box: return "box";
157 case DiscretizationMethod::cctpfa: return "cctpfa";
158 case DiscretizationMethod::ccmpfa: return "ccmpfa";
159 case DiscretizationMethod::fcstaggered: return "fcstaggered";
160 case DiscretizationMethod::fem: return "fem";
161 case DiscretizationMethod::staggered: return "staggered";
162 default: return "none";
163 }
164}
165
170[[deprecated("Use discretization tags which also support operator <<. Will be removed after 3.5")]]
171inline std::ostream& operator<<(std::ostream& stream, DiscretizationMethod m)
172{
173 // get rid of deprecation warning in the transition period
174 const auto toStringImpl = [](DiscretizationMethod m){
175 switch (m)
176 {
177 case DiscretizationMethod::box: return "box";
178 case DiscretizationMethod::cctpfa: return "cctpfa";
179 case DiscretizationMethod::ccmpfa: return "ccmpfa";
180 case DiscretizationMethod::fcstaggered: return "fcstaggered";
181 case DiscretizationMethod::fem: return "fem";
182 case DiscretizationMethod::staggered: return "staggered";
183 default: return "none";
184 }
185 };
186 stream << toStringImpl(m); return stream;
187}
188
189} // end namespace Dumux
190
191#endif
Helper class to create (named and comparable) tagged types.
std::ostream & operator<<(std::ostream &stream, DiscretizationMethod m)
Write discretization method to stream.
Definition: method.hh:171
std::string toString(DiscretizationMethod m)
Convert discretization method to string.
Definition: method.hh:152
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:42
Definition: adapt.hh:29
constexpr CCMpfa ccmpfa
Definition: method.hh:138
constexpr CCTpfa cctpfa
Definition: method.hh:137
constexpr Box box
Definition: method.hh:139
constexpr Staggered staggered
Definition: method.hh:140
constexpr None none
Definition: method.hh:143
constexpr FEM fem
Definition: method.hh:141
constexpr FCStaggered fcstaggered
Definition: method.hh:142
Helper class to create (named and comparable) tagged types Tags any given type. The tagged type is eq...
Definition: tag.hh:42
Definition: method.hh:49
static std::string name()
Definition: method.hh:50
Definition: method.hh:61
static std::string name()
Definition: method.hh:62
Definition: method.hh:73
static std::string name()
Definition: method.hh:74
static std::string name()
Definition: method.hh:87
Definition: method.hh:99
static std::string name()
Definition: method.hh:100
static std::string name()
Definition: method.hh:113
Definition: method.hh:125
static std::string name()
Definition: method.hh:126