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 Linear | ||
10 | * \brief Solver category | ||
11 | */ | ||
12 | #ifndef DUMUX_LINEAR_SOLVERCATEGORY_HH | ||
13 | #define DUMUX_LINEAR_SOLVERCATEGORY_HH | ||
14 | |||
15 | #include <dune/istl/solvers.hh> | ||
16 | |||
17 | namespace Dumux::Detail { | ||
18 | |||
19 | template<class LinearSolverTraits, class GridView> | ||
20 | 252 | Dune::SolverCategory::Category solverCategory(const GridView& gridView) | |
21 | { | ||
22 | if constexpr (LinearSolverTraits::canCommunicate) | ||
23 | { | ||
24 |
6/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 250 times.
✓ Branch 2 taken 49 times.
✓ Branch 3 taken 222 times.
✓ Branch 4 taken 49 times.
✓ Branch 5 taken 202 times.
|
281 | if (gridView.comm().size() <= 1) |
25 | return Dune::SolverCategory::sequential; | ||
26 | |||
27 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 4 times.
|
50 | if (LinearSolverTraits::isNonOverlapping(gridView)) |
28 | 2 | return Dune::SolverCategory::nonoverlapping; | |
29 | else | ||
30 | 22 | return Dune::SolverCategory::overlapping; | |
31 | } | ||
32 | else | ||
33 | { | ||
34 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
✓ Branch 3 taken 23 times.
✗ Branch 4 not taken.
|
23 | if (gridView.comm().size() > 1) |
35 | DUNE_THROW(Dune::InvalidStateException, | ||
36 | "Attempt to construct parallel solver but LinearSolverTraits::canCommunicate is false. " << | ||
37 | "Maybe the grid implementation does not support distributed parallelism." | ||
38 | ); | ||
39 | } | ||
40 | |||
41 | return Dune::SolverCategory::sequential; | ||
42 | } | ||
43 | |||
44 | } // end namespace Dumux::Detail | ||
45 | |||
46 | #endif | ||
47 |