version 3.10-dev
solvercategory.hh
Go to the documentation of this file.
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//
12#ifndef DUMUX_LINEAR_SOLVERCATEGORY_HH
13#define DUMUX_LINEAR_SOLVERCATEGORY_HH
14
15#include <dune/istl/solvers.hh>
16
17namespace Dumux::Detail {
18
19template<class LinearSolverTraits, class GridView>
20Dune::SolverCategory::Category solverCategory(const GridView& gridView)
21{
23 {
24 if (gridView.comm().size() <= 1)
25 return Dune::SolverCategory::sequential;
26
27 if (LinearSolverTraits::isNonOverlapping(gridView))
28 return Dune::SolverCategory::nonoverlapping;
29 else
30 return Dune::SolverCategory::overlapping;
31 }
32 else
33 {
34 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
Distance implementation details.
Definition: cvfelocalresidual.hh:25
static constexpr bool canCommunicate
Definition: gridcapabilities.hh:51
Dune::SolverCategory::Category solverCategory(const GridView &gridView)
Definition: solvercategory.hh:20