GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/multidomain/facet/cellcentered/mpfa/localsubcontrolentities.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 3 3 100.0%
Branches: 40 74 54.1%

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 FacetCoupling
10 * \brief Classes for sub control entities of the
11 * mpfa-o method in the context of facet coupling
12 */
13 #ifndef DUMUX_MULTDOMAIN_FACET_CC_MPFA_O_LOCAL_SUBCONTROLENTITIES_HH
14 #define DUMUX_MULTDOMAIN_FACET_CC_MPFA_O_LOCAL_SUBCONTROLENTITIES_HH
15
16 #include <array>
17
18 #include <dune/common/fvector.hh>
19 #include <dumux/discretization/cellcentered/mpfa/omethod/localsubcontrolentities.hh>
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup FacetCoupling
25 * \brief Class for the interaction volume-local sub-control volume used
26 * in the mpfa-o scheme in the context of facet coupling.
27 *
28 * \tparam IvIndexSet The type used for index sets within interaction volumes
29 * \tparam dim The dimensionality of the grid
30 * \tparam dimWorld The dimension of the world the grid is embedded in
31 */
32 template< class IvIndexSet, class Scalar, int dim, int dimWorld>
33 class CCMpfaOFacetCouplingInteractionVolumeLocalScv
34 : public CCMpfaOInteractionVolumeLocalScv<IvIndexSet, Scalar, dim, dimWorld>
35 {
36 using ParentType = CCMpfaOInteractionVolumeLocalScv<IvIndexSet, Scalar, dim, dimWorld>;
37
38 public:
39 // export some types
40 using typename ParentType::LocalIndexType;
41
42 // export dimension
43 static constexpr int myDimension = dim;
44
45 //! The default constructor
46 CCMpfaOFacetCouplingInteractionVolumeLocalScv() = default;
47
48 /*!
49 * \brief The constructor
50 *
51 * \param helper Helper class for mpfa schemes
52 * \param fvGeometry The element finite volume geometry
53 * \param scv The grid sub-control volume
54 * \param localIndex The iv-local index of this scvIdx
55 * \param indexSet The interaction volume index set
56 * \param scvfGridToLocalIndexMap maps to grid scvf indices the iv-local scvf index
57 */
58 template<class MpfaHelper, class FVElementGeometry, class SubControlVolume, class IndexMap>
59 22084999 CCMpfaOFacetCouplingInteractionVolumeLocalScv(const MpfaHelper& helper,
60 const FVElementGeometry& fvGeometry,
61 const SubControlVolume& scv,
62 const LocalIndexType localIndex,
63 const IvIndexSet& indexSet,
64 const IndexMap& scvfGridToLocalIndexMap)
65 22084999 : ParentType(helper, fvGeometry, scv, localIndex, indexSet)
66 {
67 // set up local scvf indices
68 22084999 const auto& nis = indexSet.nodalIndexSet();
69
2/2
✓ Branch 0 taken 44169998 times.
✓ Branch 1 taken 22084999 times.
66254997 for (unsigned int dir = 0; dir < myDimension; ++dir)
70 44169998 localScvfIndices_[dir] = scvfGridToLocalIndexMap.at(nis.gridScvfIndex(this->localDofIndex(), dir));
71 22084999 }
72
73 //! iv-local index of the coordir's scvf in this scv
74 264903660 LocalIndexType localScvfIndex(unsigned int coordDir) const
75 {
76 assert(coordDir < myDimension);
77
18/20
✓ Branch 0 taken 30533235 times.
✓ Branch 1 taken 9578231 times.
✓ Branch 2 taken 20509701 times.
✓ Branch 3 taken 22532557 times.
✓ Branch 4 taken 17174354 times.
✓ Branch 5 taken 19924650 times.
✓ Branch 6 taken 25333900 times.
✓ Branch 7 taken 7286540 times.
✓ Branch 8 taken 15531204 times.
✓ Branch 9 taken 15531204 times.
✓ Branch 10 taken 13275860 times.
✓ Branch 11 taken 16952964 times.
✓ Branch 12 taken 15258616 times.
✓ Branch 13 taken 61020 times.
✓ Branch 14 taken 8974686 times.
✓ Branch 15 taken 8974686 times.
✓ Branch 16 taken 7659818 times.
✓ Branch 17 taken 9810434 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
264903660 return localScvfIndices_[coordDir];
78 }
79
80 private:
81 std::array<LocalIndexType, dim> localScvfIndices_;
82 };
83
84 /*!
85 * \ingroup FacetCoupling
86 * \brief Class for the interaction volume-local sub-control volume face
87 * used in the mpfa-o scheme in the context of facet coupling.
88 *
89 * \tparam IvIndexSet The type used for index sets within interaction volumes
90 */
91 template< class IvIndexSet >
92
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
2077890 struct CCMpfaOFacetCouplingInteractionVolumeLocalScvf
93 : public CCMpfaOInteractionVolumeLocalScvf< IvIndexSet >
94 {
95 using ParentType = CCMpfaOInteractionVolumeLocalScvf< IvIndexSet >;
96 using ScvfNeighborLocalIndexSet = typename IvIndexSet::ScvfNeighborLocalIndexSet;
97
98 public:
99 // pull up index types
100 using typename ParentType::LocalIndexType;
101 using typename ParentType::GridIndexType;
102
103 //! pull up parent's constructors
104 40727820 using ParentType::ParentType;
105
106 /*!
107 * \brief The constructor for interior boundary faces.
108 *
109 * \param scvf The grid sub-control volume face
110 * \param localScvIndices The iv-local neighboring scv indices
111 * \param localDofIdx This scvf's interaction volume-local dof index
112 * \param isDirichlet Specifies if this scv is on a Dirichlet boundary
113 * \param coupledFacetLocalDof The local index of the coupled facet element
114 * in the set of cell&Dirichlet values.
115 */
116 template< class SubControlVolumeFace >
117 1764616 CCMpfaOFacetCouplingInteractionVolumeLocalScvf(const SubControlVolumeFace& scvf,
118 const ScvfNeighborLocalIndexSet& localScvIndices,
119 const LocalIndexType localDofIdx,
120 const bool isDirichlet,
121 const LocalIndexType coupledFacetLocalDof)
122 1764616 : ParentType(scvf, neighborLocalScvIndices_, localDofIdx, isDirichlet)
123 1764616 , isInteriorBoundary_(true)
124
0/8
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
1764616 , coupledFacetLocalDofIndex_(coupledFacetLocalDof)
125
0/8
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
1764616 , neighborLocalScvIndices_(localScvIndices)
126 {}
127
128 //! Returns the iv-local dof index of the coupled facet element
129 6070420 LocalIndexType coupledFacetLocalDofIndex() const
130
6/12
✗ Branch 0 not taken.
✓ Branch 1 taken 2386576 times.
✓ Branch 3 taken 2386576 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 2094672 times.
✓ Branch 8 taken 2094672 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1589172 times.
✓ Branch 13 taken 1589172 times.
✗ Branch 14 not taken.
6070420 { assert(isInteriorBoundary_); return coupledFacetLocalDofIndex_; }
131
132 //! Returns the local indices of the scvs neighboring this scvf
133 53709911 const ScvfNeighborLocalIndexSet& neighboringLocalScvIndices() const
134
6/8
✓ Branch 0 taken 2393380 times.
✓ Branch 1 taken 19357453 times.
✓ Branch 2 taken 2144568 times.
✓ Branch 3 taken 16551036 times.
✓ Branch 4 taken 1589172 times.
✓ Branch 5 taken 11674302 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
53709911 { return isOnInteriorBoundary() ? neighborLocalScvIndices_ : ParentType::neighboringLocalScvIndices(); }
135
136 //! Returns true if this face is on an interior boundary
137
8/14
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 2393380 times.
✓ Branch 3 taken 19357453 times.
✓ Branch 4 taken 49896 times.
✓ Branch 5 taken 785484 times.
✓ Branch 6 taken 2094672 times.
✓ Branch 7 taken 15765552 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1589172 times.
✓ Branch 11 taken 11674302 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
53709911 bool isOnInteriorBoundary() const { return isInteriorBoundary_; }
138
139 private:
140 bool isInteriorBoundary_{false};
141 LocalIndexType coupledFacetLocalDofIndex_{0};
142 ScvfNeighborLocalIndexSet neighborLocalScvIndices_;
143 };
144
145 } // end namespace Dumux
146
147 #endif
148