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-FileCopyrightText: 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 | 547813 | 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 | 547813 | : center_(center) | |
77 | 547813 | , 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 | 406409 | const GlobalPosition& center() const | |
87 |
1/3✓ Branch 1 taken 9609 times.
✗ Branch 2 not taken.
✗ Branch 0 not taken.
|
31386481 | { return center_; } |
88 | |||
89 | //! The position of the degree of freedom | ||
90 | 2096825 | const GlobalPosition& dofPosition() const | |
91 |
5/5✓ Branch 0 taken 4696 times.
✓ Branch 1 taken 3590 times.
✓ Branch 2 taken 28171 times.
✓ Branch 3 taken 214169 times.
✓ Branch 4 taken 368 times.
|
5010255 | { return dofPosition_; } |
92 | |||
93 | 23653141 | Scalar volume() const | |
94 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
23643541 | { return volume_; } |
95 | |||
96 | //! returns true if the sub control volume is overlapping with another scv | ||
97 | 125826 | bool isOverlapping() const | |
98 |
5/6✓ Branch 0 taken 100000 times.
✓ Branch 1 taken 25808 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 1 times.
|
125826 | { return overlapping_; } |
99 | |||
100 | 130782494 | GridIndexType dofIndex() const | |
101 |
19/22✓ Branch 6 taken 44008 times.
✓ Branch 7 taken 2233956 times.
✓ Branch 8 taken 6120708 times.
✓ Branch 9 taken 25844 times.
✓ Branch 11 taken 20949432 times.
✗ Branch 12 not taken.
✓ Branch 15 taken 1334192 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1732836 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 30847 times.
✓ Branch 22 taken 113745 times.
✓ Branch 3 taken 64546 times.
✓ Branch 4 taken 466098 times.
✓ Branch 10 taken 22060 times.
✓ Branch 13 taken 995071 times.
✓ Branch 14 taken 197629 times.
✓ Branch 17 taken 88240 times.
✓ Branch 20 taken 110300 times.
✓ Branch 5 taken 251600 times.
✓ Branch 1 taken 570 times.
✓ Branch 2 taken 3330 times.
|
130710158 | { return dofIdx_; } |
102 | |||
103 | 317963946 | LocalIndexType indexInElement() const | |
104 |
6/8✗ Branch 1 not taken.
✓ Branch 2 taken 4000 times.
✓ Branch 5 taken 6400 times.
✓ Branch 6 taken 8400 times.
✓ Branch 7 taken 32000 times.
✓ Branch 8 taken 33600 times.
✓ Branch 3 taken 5600 times.
✗ Branch 9 not taken.
|
315653938 | { return indexInElement_; } |
105 | |||
106 | 7062080 | GridIndexType elementIndex() const | |
107 | 7062080 | { return eIdx_; } | |
108 | |||
109 | 31805195 | LocalIndexType localDofIndex() const | |
110 |
7/10✗ Branch 2 not taken.
✓ Branch 3 taken 1113590 times.
✓ Branch 6 taken 21325932 times.
✗ Branch 7 not taken.
✓ Branch 1 taken 105895 times.
✓ Branch 0 taken 7400 times.
✓ Branch 4 taken 4930170 times.
✓ Branch 5 taken 3330 times.
✓ Branch 8 taken 5700 times.
✗ Branch 9 not taken.
|
207070899 | { 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 |