Use old style traits class approach to check for face tag support.

Old version failed due to a gcc compiler
bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77446 with error:
"non-constant condition for static assertion"
This commit is contained in:
Markus Blatt 2020-12-11 17:38:00 +01:00
parent 7a42a82c55
commit 924bf5ed19
2 changed files with 28 additions and 8 deletions

View File

@ -44,10 +44,36 @@
#include <opm/material/densead/Math.hpp>
#include <vector>
#include <type_traits>
namespace Opm
{
template<class Grid>
class SupportsFaceTag
: public std::bool_constant<false>
{};
template<>
class SupportsFaceTag<Dune::CpGrid>
: public std::bool_constant<true>
{};
template<>
class SupportsFaceTag<Dune::PolyhedralGrid<3, 3>>
: public std::bool_constant<true>
{};
#if HAVE_DUNE_ALUGRID
template<>
class SupportsFaceTag<Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>>
: public std::bool_constant<true>
{};
#endif
/// Class for handling the blackoil well model.
template <typename TypeTag>
class BlackoilAquiferModel
@ -55,13 +81,6 @@ class BlackoilAquiferModel
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using RateVector = GetPropType<TypeTag, Properties::RateVector>;
constexpr bool supportsFaceTag(const Dune::CpGrid&){ return true;}
constexpr bool supportsFaceTag(const Dune::PolyhedralGrid<3, 3>&){ return true;}
#if HAVE_DUNE_ALUGRID
constexpr bool supportsFaceTag(const Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>&){ return true;}
#endif
template<class G>
constexpr bool supportsFaceTag(const G&){ return false;}
public:
explicit BlackoilAquiferModel(Simulator& simulator);

View File

@ -26,7 +26,8 @@ BlackoilAquiferModel<TypeTag>::BlackoilAquiferModel(Simulator& simulator)
: simulator_(simulator)
{
// Grid needs to support Facetag
assert(supportsFaceTag(simulator.vanguard().grid()));
using Grid = std::remove_const_t<std::remove_reference_t<decltype(simulator.vanguard().grid())>>;
static_assert(SupportsFaceTag<Grid>::value, "Grid has to support assumptions about face tag.");
init();
}