GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/discretization/checkoverlapsize.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 31 31 100.0%
Branches: 23 39 59.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-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 Discretization
10 * \brief Check the overlap size for different discretization methods
11 */
12 #ifndef DUMUX_DISCRETIZATION_CHECK_OVERLAP_SIZE_HH
13 #define DUMUX_DISCRETIZATION_CHECK_OVERLAP_SIZE_HH
14
15 #include <dumux/discretization/method.hh>
16
17 namespace Dumux {
18
19 /*!
20 * \ingroup Discretization
21 * \brief Check if the overlap size is valid for a given discretization method
22 * \note the default checks if the grid has at least an overlap of one if there are no ghosts
23 * \note for sequential grids every overlap is fine
24 * \note specialize this for your discretization method if the default doesn't apply
25 */
26 template<class DiscretizationMethod>
27 struct CheckOverlapSize
28 {
29 template<class GridView>
30
7/9
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 387 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 7 times.
✓ Branch 2 taken 38 times.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
608 static bool isValid(const GridView& gridView) noexcept
31
7/11
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 439 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
✓ Branch 6 taken 40 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
632 { return gridView.comm().size() <= 1 || gridView.overlapSize(0) + gridView.ghostSize(0) > 0; }
32 };
33
34 //! specialization for the box method which requires an overlap size of 0
35 template<>
36 struct CheckOverlapSize<DiscretizationMethods::Box>
37 {
38 template<class GridView>
39 static bool isValid(const GridView& gridView) noexcept
40 { return gridView.comm().size() <= 1 || gridView.overlapSize(0) == 0; }
41 };
42
43 //! specialization for the finite element method which requires an overlap size of 0
44 //! \note Overloads for bases that require overlap regions can be defined in the future
45 template<>
46 struct CheckOverlapSize<DiscretizationMethods::FEM>
47 {
48 template<class FEBasis>
49
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
2 static bool isValid(const FEBasis& feBasis) noexcept
50
3/8
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 { return feBasis.gridView().comm().size() <= 1 || feBasis.gridView().overlapSize(0) == 0; }
51 };
52
53 // fc staggered requires an overlap of exactly 1
54 template<>
55 struct CheckOverlapSize<DiscretizationMethods::FCStaggered>
56 {
57 template<class GridView>
58
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
✗ Branch 2 not taken.
74 static bool isValid(const GridView& gridView) noexcept
59
3/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
78 { return gridView.comm().size() <= 1 || gridView.overlapSize(0) == 1; }
60 };
61
62 } // end namespace Dumux
63
64 #endif
65