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 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 | 424 | static bool isValid(const GridView& gridView) noexcept | |
31 |
16/19✓ Branch 0 taken 2 times.
✓ Branch 1 taken 357 times.
✓ Branch 2 taken 72 times.
✓ Branch 3 taken 342 times.
✓ Branch 4 taken 75 times.
✓ Branch 5 taken 274 times.
✓ Branch 6 taken 13 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 27 times.
✓ Branch 9 taken 12 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 40 times.
✓ Branch 12 taken 21 times.
✓ Branch 13 taken 40 times.
✓ Branch 14 taken 21 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 3 times.
✓ Branch 18 taken 3 times.
✗ Branch 19 not taken.
|
574 | { 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 | 1 | static bool isValid(const FEBasis& feBasis) noexcept | |
50 |
6/14✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
|
4 | { 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 | 58 | static bool isValid(const GridView& gridView) noexcept | |
59 |
6/9✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
|
70 | { return gridView.comm().size() <= 1 || gridView.overlapSize(0) == 1; } |
60 | }; | ||
61 | |||
62 | } // end namespace Dumux | ||
63 | |||
64 | #endif | ||
65 |