GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/pq1bubble/subcontrolvolumeface.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 12 21 57.1%
Functions: 0 33 0.0%
Branches: 31 52 59.6%

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 PQ1BubbleDiscretization
10 * \brief Base class for a sub control volume face
11 */
12 #ifndef DUMUX_DISCRETIZATION_PQ1BUBBLE_SUBCONTROLVOLUMEFACE_HH
13 #define DUMUX_DISCRETIZATION_PQ1BUBBLE_SUBCONTROLVOLUMEFACE_HH
14
15 #include <utility>
16
17 #include <dune/geometry/type.hh>
18 #include <dune/geometry/multilineargeometry.hh>
19
20 #include <dumux/common/boundaryflag.hh>
21 #include <dumux/common/indextraits.hh>
22 #include <dumux/discretization/subcontrolvolumefacebase.hh>
23 #include <dumux/discretization/pq1bubble/geometryhelper.hh>
24
25 namespace Dumux {
26
27 /*!
28 * \ingroup PQ1BubbleDiscretization
29 * \brief Default traits class to be used for the sub-control volume faces
30 * for the cvfe scheme
31 * \tparam GV the type of the grid view
32 */
33 template<class GridView>
34 struct PQ1BubbleDefaultScvfGeometryTraits
35 {
36 using Grid = typename GridView::Grid;
37 static constexpr int dim = Grid::dimension;
38 static constexpr int dimWorld = Grid::dimensionworld;
39 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
40 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
41 using Scalar = typename Grid::ctype;
42 using GeometryTraits = PQ1BubbleMLGeometryTraits<Scalar>;
43 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, GeometryTraits>;
44 using CornerStorage = typename GeometryTraits::template CornerStorage<dim-1, dimWorld>::Type;
45 using GlobalPosition = typename CornerStorage::value_type;
46 using BoundaryFlag = Dumux::BoundaryFlag<Grid>;
47 };
48
49 /*!
50 * \ingroup PQ1BubbleDiscretization
51 * \brief Class for a sub control volume face in the cvfe method, i.e a part of the boundary
52 * of a sub control volume we compute fluxes on. We simply use the base class here.
53 * \tparam GV the type of the grid view
54 * \tparam T the scvf geometry traits
55 */
56 template<class GV,
57 class T = PQ1BubbleDefaultScvfGeometryTraits<GV> >
58 class PQ1BubbleSubControlVolumeFace
59 : public SubControlVolumeFaceBase<PQ1BubbleSubControlVolumeFace<GV, T>, T>
60 {
61 using ThisType = PQ1BubbleSubControlVolumeFace<GV, T>;
62 using ParentType = SubControlVolumeFaceBase<ThisType, T>;
63 using GridIndexType = typename T::GridIndexType;
64 using LocalIndexType = typename T::LocalIndexType;
65 using Scalar = typename T::Scalar;
66 using CornerStorage = typename T::CornerStorage;
67 using Geometry = typename T::Geometry;
68 using BoundaryFlag = typename T::BoundaryFlag;
69
70 public:
71 //! export the type used for global coordinates
72 using GlobalPosition = typename T::GlobalPosition;
73 //! state the traits public and thus export all types
74 using Traits = T;
75
76 //! The default constructor
77 2736976 PQ1BubbleSubControlVolumeFace() = default;
78
79 //! Constructor for inner scvfs
80 75200 PQ1BubbleSubControlVolumeFace(const GlobalPosition& center,
81 const Scalar area,
82 const GlobalPosition& normal,
83 const std::array<LocalIndexType, 2>& scvIndices,
84 const LocalIndexType localScvfIdx,
85 bool overlapping = false)
86 : center_(center)
87 , unitOuterNormal_(normal)
88 , area_(area)
89 , localScvfIdx_(localScvfIdx)
90 , scvIndices_(scvIndices)
91 , boundary_(false)
92 , overlapping_(overlapping)
93 1249168 , boundaryFlag_{}
94 { }
95
96 //! Constructor for boundary scvfs
97 16066 PQ1BubbleSubControlVolumeFace(const GlobalPosition& center,
98 const Scalar area,
99 const GlobalPosition& normal,
100 const std::array<LocalIndexType, 2>& scvIndices,
101 const LocalIndexType localScvfIdx,
102 const BoundaryFlag& bFlag,
103 bool overlapping = false)
104 : center_(center)
105 , unitOuterNormal_(normal)
106 , area_(area)
107 , localScvfIdx_(localScvfIdx)
108 , scvIndices_(scvIndices)
109 , boundary_(true)
110 , overlapping_(overlapping)
111 16066 , boundaryFlag_(bFlag)
112 {}
113
114 //! The center of the sub control volume face
115 const GlobalPosition& center() const
116 7440592 { return center_; }
117
118 //! The integration point for flux evaluations in global coordinates
119 const GlobalPosition& ipGlobal() const
120
7/8
✓ Branch 0 taken 14968 times.
✓ Branch 1 taken 4323596 times.
✓ Branch 2 taken 30734 times.
✓ Branch 3 taken 37994 times.
✓ Branch 4 taken 2340 times.
✓ Branch 5 taken 640 times.
✓ Branch 6 taken 45812 times.
✗ Branch 7 not taken.
40492804 { return center_; }
121
122 //! The area of the sub control volume face
123 Scalar area() const
124 { return area_; }
125
126 //! returns true if the sub control volume face is overlapping with another scv
127 bool isOverlapping() const
128 { return overlapping_; }
129
130 bool boundary() const
131 { return boundary_; }
132
133 //! The unit outer normal
134 const GlobalPosition unitOuterNormal() const
135
2/4
✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7542 times.
✗ Branch 4 not taken.
2225432 { return unitOuterNormal_; }
136
137 //! Index of the inside sub control volume
138 GridIndexType insideScvIdx() const
139
11/22
✓ Branch 0 taken 11436885 times.
✓ Branch 1 taken 13533799 times.
✓ Branch 2 taken 11436885 times.
✓ Branch 3 taken 13533755 times.
✓ Branch 4 taken 44 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 64230 times.
✓ Branch 7 taken 223914 times.
✓ Branch 8 taken 64230 times.
✓ Branch 9 taken 223914 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 14800 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 14800 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
256125624 { return scvIndices_[0]; }
140
141 //! index of the outside sub control volume
142 GridIndexType outsideScvIdx() const
143
10/16
✓ Branch 0 taken 11436885 times.
✓ Branch 1 taken 13533775 times.
✓ Branch 2 taken 11436885 times.
✓ Branch 3 taken 13533755 times.
✓ Branch 4 taken 7420 times.
✓ Branch 5 taken 7400 times.
✓ Branch 6 taken 7400 times.
✓ Branch 7 taken 7400 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 14800 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 14800 times.
✗ Branch 15 not taken.
117780920 { return scvIndices_[1]; }
144
145 //! The number of scvs on the outside of this face
146 std::size_t numOutsideScvs() const
147
1/2
✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
20 { return static_cast<std::size_t>(!boundary()); }
148
149 //! The local index of this sub control volume face
150 LocalIndexType index() const
151 { return localScvfIdx_; }
152
153 //! Return the boundary flag
154 typename BoundaryFlag::value_type boundaryFlag() const
155 53348 { return boundaryFlag_.get(); }
156
157 private:
158 GlobalPosition center_;
159 GlobalPosition unitOuterNormal_;
160 Scalar area_;
161 LocalIndexType localScvfIdx_;
162 std::array<LocalIndexType, 2> scvIndices_;
163 bool boundary_;
164 bool overlapping_;
165 BoundaryFlag boundaryFlag_;
166 };
167
168 } // end namespace Dumux
169
170 #endif
171