Commit f1d9d7a3 authored by Timo Koch's avatar Timo Koch
Browse files

[linear] Factor out grid capabilities compatibilty layer into own header

parent bd080ff0
......@@ -21,6 +21,7 @@ enumerate.hh
exceptions.hh
fixedlengthspline_.hh
fvproblem.hh
gridcapabilities.hh
indextraits.hh
integrate.hh
intersectionmapper.hh
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup Common
* \brief dune-grid capabilities compatibility layer
*/
#ifndef DUMUX_COMMON_GRID_CAPABILITIES_HH
#define DUMUX_COMMON_GRID_CAPABILITIES_HH
// TODO: The following is a temporary solution to make canCommunicate work.
// Once it is resolved upstream
// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
// it should be guarded by a DUNE_VERSION macro and removed later.
#if HAVE_UG
namespace Dune {
template<int dim>
class UGGrid;
} // end namespace Dumux
#endif // HAVE_UG
namespace Dumux::Temp::Capabilities {
template<class Grid, int codim>
struct canCommunicate
{
static const bool v = false;
};
#if HAVE_UG
template<int dim, int codim>
struct canCommunicate<Dune::UGGrid<dim>, codim>
{
static const bool v = true;
};
#endif // HAVE_UG
} // namespace Dumux::Temp::Capabilities
// end workaround
namespace Dumux::Detail {
template<class Grid, int dofCodim>
static constexpr bool canCommunicate =
Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
|| Dumux::Temp::Capabilities::canCommunicate<Grid, dofCodim>::v;
} // namespace Dumux
#endif
......@@ -31,36 +31,9 @@
#include <dune/istl/preconditioners.hh>
#include <dune/grid/common/capabilities.hh>
#include <dumux/common/gridcapabilities.hh>
#include <dumux/discretization/method.hh>
// TODO: The following is a temporary solution to make the parallel AMG work
// for UGGrid. Once it is resolved upstream
// (https://gitlab.dune-project.org/core/dune-grid/issues/78),
// it should be guarded by a DUNE_VERSION macro and removed later.
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif // HAVE_UG
namespace Dumux::Temp::Capabilities {
template<class Grid, int codim>
struct canCommunicate
{
static const bool v = false;
};
#if HAVE_UG
template<int dim, int codim>
struct canCommunicate<Dune::UGGrid<dim>, codim>
{
static const bool v = true;
};
#endif // HAVE_UG
} // namespace Dumux::Temp::Capabilities
// end workaround
namespace Dumux {
//! The implementation is specialized for the different discretizations
......@@ -142,11 +115,7 @@ struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::box>
using DofMapper = typename GridGeometry::VertexMapper;
using Grid = typename GridGeometry::GridView::Traits::Grid;
static constexpr int dofCodim = Grid::dimension;
// TODO: see above for description of this workaround, remove second line if fixed upstream
static constexpr bool canCommunicate =
Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
|| Dumux::Temp::Capabilities::canCommunicate<Grid, dofCodim>::v;
static constexpr bool canCommunicate = Dumux::Detail::canCommunicate<Grid, dofCodim>;
template<class GridView>
static bool isNonOverlapping(const GridView& gridView)
......@@ -161,11 +130,7 @@ struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa>
using DofMapper = typename GridGeometry::ElementMapper;
using Grid = typename GridGeometry::GridView::Traits::Grid;
static constexpr int dofCodim = 0;
// TODO: see above for description of this workaround, remove second line if fixed upstream
static constexpr bool canCommunicate =
Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
|| Dumux::Temp::Capabilities::canCommunicate<Grid, dofCodim>::v;
static constexpr bool canCommunicate = Dumux::Detail::canCommunicate<Grid, dofCodim>;
template<class GridView>
static bool isNonOverlapping(const GridView& gridView)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment