GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/facecentered/staggered/elementboundarytypes.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 14 18 77.8%
Functions: 23 30 76.7%
Branches: 30 33 90.9%

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 FaceCenteredStaggeredDiscretization
10 * \brief Boundary types gathered on an element
11 */
12 #ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_ELEMENT_BOUNDARY_TYPES_HH
13 #define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_ELEMENT_BOUNDARY_TYPES_HH
14
15 #include <vector>
16
17 namespace Dumux {
18
19 /*!
20 * \ingroup FaceCenteredStaggeredDiscretization
21 * \brief This class stores an array of BoundaryTypes objects
22 */
23 template<class BTypes>
24 5211676 class FaceCenteredStaggeredElementBoundaryTypes
25 {
26 public:
27 using BoundaryTypes = BTypes;
28
29 /*!
30 * \brief Update the boundary types for all vertices of an element.
31 *
32 * \param problem The problem object which needs to be simulated
33 * \param element The DUNE Codim<0> entity for which the boundary
34 * types should be collected
35 * \param fvGeometry The element's finite volume geometry
36 */
37 template<class Problem, class FVElementGeometry>
38 2605838 void update(const Problem& problem,
39 const typename FVElementGeometry::Element& element,
40 const FVElementGeometry& fvGeometry)
41 {
42
2/2
✓ Branch 1 taken 145458 times.
✓ Branch 2 taken 2460380 times.
2605838 if (!fvGeometry.hasBoundaryScvf())
43 return;
44
45 145458 bcTypes_.resize(fvGeometry.numScvf());
46
47 145458 hasDirichlet_ = false;
48 145458 hasNeumann_ = false;
49
50
5/5
✓ Branch 0 taken 47828 times.
✓ Branch 1 taken 1913082 times.
✓ Branch 2 taken 141790 times.
✓ Branch 3 taken 1909414 times.
✓ Branch 4 taken 141790 times.
2106368 for (const auto& scvf : scvfs(fvGeometry))
51 {
52
2/2
✓ Branch 0 taken 459814 times.
✓ Branch 1 taken 1497428 times.
1957242 if (scvf.boundary())
53 {
54
3/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 177655 times.
✓ Branch 2 taken 282159 times.
✗ Branch 3 not taken.
459824 bcTypes_[scvf.localIndex()] = problem.boundaryTypes(element, scvf);
55
8/8
✓ Branch 0 taken 177665 times.
✓ Branch 1 taken 282149 times.
✓ Branch 2 taken 131379 times.
✓ Branch 3 taken 46286 times.
✓ Branch 4 taken 131379 times.
✓ Branch 5 taken 46286 times.
✓ Branch 6 taken 131379 times.
✓ Branch 7 taken 46286 times.
459814 hasDirichlet_ = hasDirichlet_ || bcTypes_[scvf.localIndex()].hasDirichlet();
56
8/8
✓ Branch 0 taken 412580 times.
✓ Branch 1 taken 47234 times.
✓ Branch 2 taken 18046 times.
✓ Branch 3 taken 394534 times.
✓ Branch 4 taken 18046 times.
✓ Branch 5 taken 394534 times.
✓ Branch 6 taken 18046 times.
✓ Branch 7 taken 394534 times.
477860 hasNeumann_ = hasNeumann_ || bcTypes_[scvf.localIndex()].hasNeumann();
57 }
58 }
59 }
60
61 /*!
62 * \brief Returns whether the element has a vertex which contains
63 * a Dirichlet value.
64 */
65 bool hasDirichlet() const
66 { return hasDirichlet_; }
67
68 /*!
69 * \brief Returns whether the element potentially features a
70 * Neumann boundary segment.
71 */
72 bool hasNeumann() const
73 { return hasNeumann_; }
74
75 /*
76 * \brief Access operator
77 * \return BoundaryTypes
78 */
79 8458345 const BoundaryTypes& operator[] (std::size_t i) const
80 {
81
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8458345 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8458345 times.
16916690 assert(i < bcTypes_.size());
82 16916690 return bcTypes_[i];
83 }
84
85 protected:
86 std::vector<BoundaryTypes> bcTypes_;
87 bool hasDirichlet_ = false;
88 bool hasNeumann_ = false;
89 };
90
91 } // end namespace Dumux
92
93 #endif
94