version 3.10-dev
gridcapabilities.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_COMMON_GRID_CAPABILITIES_HH
13#define DUMUX_COMMON_GRID_CAPABILITIES_HH
14
15#include <dune/grid/common/capabilities.hh>
16
17// TODO: The following is a temporary solution to make canCommunicate work.
18// Once it is resolved upstream
19// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
20// it should be guarded by a DUNE_VERSION macro and removed later.
21
22#if HAVE_DUNE_UGGRID
23namespace Dune {
24template<int dim>
25class UGGrid;
26} // end namespace Dumux
27#endif // HAVE_DUNE_UGGRID
28
30
31template<class Grid, int codim>
33{
34 static const bool v = false;
35};
36
37#if HAVE_DUNE_UGGRID
38template<int dim, int codim>
39struct canCommunicate<Dune::UGGrid<dim>, codim>
40{
41 static const bool v = true;
42};
43#endif // HAVE_DUNE_UGGRID
44
45} // namespace Dumux::Temp::Capabilities
46// end workaround
47
48namespace Dumux::Detail {
49
50template<class Grid, int dofCodim>
51static constexpr bool canCommunicate =
52 Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
54
55} // namespace Dumux
56
58
59// Default implementation
60// The grid capability gives an absolute guarantee
61// however this does not mean that multithreading is not
62// supported at all. It might still work for some special cases.
63// This knowledge is encoded in specializations for the different
64// grid managers, see dumux/grid/io/gridmanager_*.hh
65template<class Grid>
67{
68 template<class GV>
69 static bool eval(const GV&) // default is independent of the grid view
70 { return Dune::Capabilities::viewThreadSafe<Grid>::v; }
71};
72
73template<class GridView>
74inline bool supportsMultithreading(const GridView& gridView)
76
77} // namespace Dumux::Grid::Capabilities
78
79#endif
Distance implementation details.
Definition: cvfelocalresidual.hh:25
static constexpr bool canCommunicate
Definition: gridcapabilities.hh:51
Definition: gridcapabilities.hh:57
bool supportsMultithreading(const GridView &gridView)
Definition: gridcapabilities.hh:74
Definition: gridcapabilities.hh:29
Definition: common/pdesolver.hh:24
Definition: gridcapabilities.hh:67
static bool eval(const GV &)
Definition: gridcapabilities.hh:69
Definition: gridcapabilities.hh:33
static const bool v
Definition: gridcapabilities.hh:34