GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/pq1bubble/subcontrolvolume.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 5 17 29.4%
Functions: 0 35 0.0%
Branches: 3 6 50.0%

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 the sub control volume for the cvfe scheme
11 */
12 #ifndef DUMUX_DISCRETIZATION_PQ1BUBBLE_SUBCONTROLVOLUME_HH
13 #define DUMUX_DISCRETIZATION_PQ1BUBBLE_SUBCONTROLVOLUME_HH
14
15 #include <dune/geometry/type.hh>
16 #include <dune/geometry/multilineargeometry.hh>
17
18 #include <dumux/common/math.hh>
19 #include <dumux/common/indextraits.hh>
20 #include <dumux/discretization/subcontrolvolumebase.hh>
21 #include <dumux/discretization/pq1bubble/geometryhelper.hh>
22
23 namespace Dumux {
24
25 /*!
26 * \ingroup PQ1BubbleDiscretization
27 * \brief Default traits class to be used for the sub-control volumes
28 * for the pq1bubble scheme
29 * \tparam GV the type of the grid view
30 */
31 template<class GridView>
32 struct PQ1BubbleDefaultScvGeometryTraits
33 {
34 using Grid = typename GridView::Grid;
35
36 static const int dim = Grid::dimension;
37 static const int dimWorld = Grid::dimensionworld;
38
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, dimWorld, GeometryTraits>;
44 using CornerStorage = typename GeometryTraits::template CornerStorage<dim, dimWorld>::Type;
45 using GlobalPosition = typename CornerStorage::value_type;
46 };
47
48 /*!
49 * \ingroup PQ1BubbleDiscretization
50 * \brief the sub control volume for the pq1bubble scheme
51 * \tparam GV the type of the grid view
52 * \tparam T the scvf geometry traits
53 */
54 template<class GridView, class T = PQ1BubbleDefaultScvGeometryTraits<GridView>>
55 class PQ1BubbleSubControlVolume
56 {
57 using GlobalPosition = typename T::GlobalPosition;
58 using Scalar = typename T::Scalar;
59 using GridIndexType = typename T::GridIndexType;
60 using LocalIndexType = typename T::LocalIndexType;
61
62 public:
63 //! state the traits public and thus export all types
64 using Traits = T;
65
66 1643439 PQ1BubbleSubControlVolume() = default;
67
68 547813 PQ1BubbleSubControlVolume(const Scalar& volume,
69 const GlobalPosition& dofPosition,
70 const GlobalPosition& center,
71 const LocalIndexType indexInElement,
72 const GridIndexType eIdx,
73 const GridIndexType dofIdx,
74 bool overlapping = false)
75
76 : center_(center)
77 , dofPosition_(dofPosition)
78 , volume_(volume)
79 , indexInElement_(indexInElement)
80 , eIdx_(eIdx)
81 , dofIdx_(dofIdx)
82 547813 , overlapping_(overlapping)
83 {}
84
85 //! The center of the sub control volume
86 const GlobalPosition& center() const
87
1/2
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
31562281 { return center_; }
88
89 //! The position of the degree of freedom
90 const GlobalPosition& dofPosition() const
91
2/4
✓ Branch 0 taken 420 times.
✓ Branch 1 taken 150 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
5002455 { return dofPosition_; }
92
93 Scalar volume() const
94 { return volume_; }
95
96 //! returns true if the sub control volume is overlapping with another scv
97 bool isOverlapping() const
98 { return overlapping_; }
99
100 GridIndexType dofIndex() const
101 { return dofIdx_; }
102
103 LocalIndexType indexInElement() const
104 { return indexInElement_; }
105
106 GridIndexType elementIndex() const
107 { return eIdx_; }
108
109 LocalIndexType localDofIndex() const
110 { return indexInElement_; }
111
112 private:
113 GlobalPosition center_;
114 GlobalPosition dofPosition_;
115 Scalar volume_;
116 LocalIndexType indexInElement_;
117 GridIndexType eIdx_;
118 GridIndexType dofIdx_;
119 bool overlapping_;
120 };
121
122 } // end namespace Dumux
123
124 #endif
125