GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/method.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 4 7 57.1%
Functions: 0 0 -%
Branches: 13 40 32.5%

Line Branch Exec Source
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 //
7 /*!
8 * \file
9 * \ingroup Discretization
10 * \brief The available discretization methods in Dumux
11 */
12 #ifndef DUMUX_DISCRETIZATION_METHOD_HH
13 #define DUMUX_DISCRETIZATION_METHOD_HH
14
15 #include <ostream>
16 #include <string>
17
18 #include <dumux/common/tag.hh>
19
20 namespace Dumux::DiscretizationMethods {
21
22 /*
23 * \brief Cell-centered finite volume scheme with two-point flux approximation
24 */
25 struct CCTpfa : public Utility::Tag<CCTpfa> {
26 static std::string name() { return "cctpfa"; }
27 };
28
29
30 /*
31 * \brief Cell-centered finite volume scheme with multi-point flux approximation
32 */
33 struct CCMpfa : public Utility::Tag<CCMpfa> {
34 static std::string name() { return "ccmpfa"; }
35 };
36
37
38 /*
39 * \brief Control-volume finite element methods
40 * This is a group of discretization methods that share certain properties.
41 * Therefore there is a single meta-tag parametrized in terms of the actual
42 * discretization method in the group. Having a common tag allows to specialize
43 * template agnostic of the underlying discretization type
44 */
45 template<class DM>
46 struct CVFE : public Utility::Tag<CVFE<DM>> {
47 12 static std::string name() { return DM::name(); }
48 };
49
50
51 #ifndef DOXYGEN
52 namespace Detail {
53
54 template<class DM>
55 struct IsCVFE : public std::false_type {};
56
57 template<class DM>
58 struct IsCVFE<CVFE<DM>> : public std::true_type {};
59
60 } // end namespace Detail
61 #endif
62
63 /*
64 * \brief Template variable that is true when the discretization method DM is a CVFE schemes
65 */
66 template<class DM>
67 inline constexpr bool isCVFE = Detail::IsCVFE<DM>::value;
68
69
70 /*
71 * \brief Various control volume finite element discretization methods
72 */
73 namespace CVFEMethods {
74
75 struct PQ1 {
76 static std::string name() { return "box"; }
77 };
78
79 struct CR_RT {
80
4/8
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 10 times.
✗ Branch 11 not taken.
20 static std::string name() { return "fcdiamond"; }
81 };
82
83 struct PQ1Bubble {
84
4/10
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
4 static std::string name() { return "pq1bubble"; }
85 };
86
87 } // end namespace CVFEMethods
88
89
90 /*
91 * \brief Vertex-centered finite volume scheme
92 * or control-volume finite element scheme based on a P1 (simplices) or Q1 (quads) basis
93 */
94 using Box = CVFE<CVFEMethods::PQ1>;
95
96 /*
97 * \brief Face-centered finite volume scheme
98 * or control-volume finite element scheme based on
99 * Crouzeix-Raviart (simplices) or Rannacher-Turek (quads) basis
100 */
101 using FCDiamond = CVFE<CVFEMethods::CR_RT>;
102
103 /*
104 * \brief Vertex- and cell-centered finite volume scheme
105 * or control-volume finite element scheme based on
106 * linear Lagrangian elements with bubble function
107 */
108 using PQ1Bubble = CVFE<CVFEMethods::PQ1Bubble>;
109
110
111 /*
112 * \brief Staggered-grid finite volume scheme (old)
113 */
114 struct Staggered : public Utility::Tag<Staggered> {
115 static std::string name() { return "staggered"; }
116 };
117
118
119 /*
120 * \brief Finite element method
121 */
122 struct FEM : public Utility::Tag<FEM> {
123 static std::string name() { return "fem"; }
124 };
125
126
127 /*
128 * \brief Staggered-grid finite volume scheme
129 */
130 struct FCStaggered : public Utility::Tag<FCStaggered> {
131
5/10
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
15 static std::string name() { return "fcstaggered"; }
132 };
133
134
135 /*
136 * \brief Tag used for defaults not depending on the discretization
137 * or in situations where a discretization tag is needed but none
138 * can be provided (the implementation has to support this of course)
139 */
140 struct None : public Utility::Tag<None> {
141 static std::string name() { return "none"; }
142 };
143
144
145 inline constexpr CCTpfa cctpfa{};
146 inline constexpr CCMpfa ccmpfa{};
147 inline constexpr Box box{};
148 inline constexpr PQ1Bubble pq1bubble{};
149 inline constexpr Staggered staggered{};
150 inline constexpr FEM fem{};
151 inline constexpr FCStaggered fcstaggered{};
152 inline constexpr FCDiamond fcdiamond{};
153 inline constexpr None none{};
154
155 } // end namespace Dumux::DiscretizationMethods
156
157 #endif
158