3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_COMMON_GRID_CAPABILITIES_HH
25#define DUMUX_COMMON_GRID_CAPABILITIES_HH
26
27#include <dune/grid/common/capabilities.hh>
28
29// TODO: The following is a temporary solution to make canCommunicate work.
30// Once it is resolved upstream
31// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
32// it should be guarded by a DUNE_VERSION macro and removed later.
33
34#if HAVE_DUNE_UGGRID
35namespace Dune {
36template<int dim>
37class UGGrid;
38} // end namespace Dumux
39#endif // HAVE_DUNE_UGGRID
40
42
43template<class Grid, int codim>
45{
46 static const bool v = false;
47};
48
49#if HAVE_DUNE_UGGRID
50template<int dim, int codim>
51struct canCommunicate<Dune::UGGrid<dim>, codim>
52{
53 static const bool v = true;
54};
55#endif // HAVE_DUNE_UGGRID
56
57} // namespace Dumux::Temp::Capabilities
58// end workaround
59
60namespace Dumux::Detail {
61
62template<class Grid, int dofCodim>
63static constexpr bool canCommunicate =
64 Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
66
67} // namespace Dumux
68
70
71// Default implementation
72// The grid capability gives an absolute guarantee
73// however this does not mean that multithreading is not
74// supported at all. It might still work for some special cases.
75// This knowledge is encoded in specializations for the different
76// grid managers, see dumux/grid/io/gridmanager_*.hh
77template<class Grid>
79{
80 template<class GV>
81 static bool eval(const GV&) // default is independent of the grid view
82 { return Dune::Capabilities::viewThreadSafe<Grid>::v; }
83};
84
85template<class GridView>
86inline bool supportsMultithreading(const GridView& gridView)
88
89} // namespace Dumux::Grid::Capabilities
90
91#endif
Distance implementation details.
Definition: cvfelocalresidual.hh:37
static constexpr bool canCommunicate
Definition: gridcapabilities.hh:63
Definition: deprecated.hh:149
Definition: gridcapabilities.hh:41
Definition: gridcapabilities.hh:69
bool supportsMultithreading(const GridView &gridView)
Definition: gridcapabilities.hh:86
Definition: gridcapabilities.hh:45
static const bool v
Definition: gridcapabilities.hh:46
Definition: gridcapabilities.hh:79
static bool eval(const GV &)
Definition: gridcapabilities.hh:81