Merge pull request #10 from blattms/dunify_aquifers

Use old style traits class approach to check for face tag support.
This commit is contained in:
Tor Harald Sandve 2020-12-11 17:53:51 +01:00 committed by GitHub
commit d31bce43ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 8 deletions

View File

@ -44,10 +44,36 @@
#include <opm/material/densead/Math.hpp> #include <opm/material/densead/Math.hpp>
#include <vector> #include <vector>
#include <type_traits>
namespace Opm 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. /// Class for handling the blackoil well model.
template <typename TypeTag> template <typename TypeTag>
class BlackoilAquiferModel class BlackoilAquiferModel
@ -55,13 +81,6 @@ class BlackoilAquiferModel
using Simulator = GetPropType<TypeTag, Properties::Simulator>; using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using RateVector = GetPropType<TypeTag, Properties::RateVector>; 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: public:
explicit BlackoilAquiferModel(Simulator& simulator); explicit BlackoilAquiferModel(Simulator& simulator);

View File

@ -26,7 +26,8 @@ BlackoilAquiferModel<TypeTag>::BlackoilAquiferModel(Simulator& simulator)
: simulator_(simulator) : simulator_(simulator)
{ {
// Grid needs to support Facetag // 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(); init();
} }