Commit 086db074 authored by Bernd Flemisch's avatar Bernd Flemisch Committed by Katharina Heck
Browse files

[discretization] replace the property EnableFVGridGeometryCache

Follow the strategy outlined in !1647.
parent 008b8832
......@@ -123,6 +123,10 @@ DONT_EMIT_CLANG_GRIDGEOMETRY_WARNING."
template<class TypeTag, class MyTypeTag>
struct [[deprecated("Use GridGeometry instead.")]] FVGridGeometry { using type = UndefinedProperty; }; //!< The type of the global finite volume geometry
// TODO: Remove deprecated property EnableFVGridGeometryCache after 3.1
template<class TypeTag, class MyTypeTag>
struct [[deprecated("Use EnableGridGeometryCache instead.")]] EnableFVGridGeometryCache { using type = UndefinedProperty; }; //!< specifies if geometric data is saved (faster, but more memory consuming)
// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`.
// For ensuring backward compatibility, it is necessary to set the default value
// of the new property to the old one, see the discussion in MR 1647.
......@@ -146,10 +150,24 @@ struct GridGeometry
using type = typename GridGeometryHelper<TypeTag, typename FVGridGeometry<TypeTag, MyTypeTag>::type>::type;
};
#pragma GCC diagnostic pop
template<class TypeTag, bool hasParentTypeTag>
struct EnableGridGeometryCacheHelper
{ using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableFVGridGeometryCache { using type = UndefinedProperty; }; //!< specifies if geometric data is saved (faster, but more memory consuming)
template<class TypeTag>
struct EnableGridGeometryCacheHelper<TypeTag, false>
{
// fallback
static constexpr bool value = getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>();
};
// only use the fallback (EnableFVGridGeometryCache) if none
// of the TypeTags define EnableGridGeometryCache
template <class TypeTag, class MyTypeTag>
struct EnableGridGeometryCache : public EnableGridGeometryCacheHelper<TypeTag, Detail::hasParentTypeTag<MyTypeTag>(int{})>
{};
#pragma GCC diagnostic pop
template<class TypeTag, class MyTypeTag>
struct VolumeVariables { using type = UndefinedProperty; }; //!< The secondary variables within a sub-control volume
......
......@@ -63,7 +63,7 @@ template<class TypeTag>
struct FVGridGeometry<TypeTag, TTag::BoxModel>
{
private:
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
......
......@@ -114,7 +114,7 @@ private:
using NodalIndexSet = GetPropType<TypeTag, Properties::DualGridNodalIndexSet>;
using Traits = CCMpfaFVGridGeometryTraits<GridView, NodalIndexSet, PrimaryIV, SecondaryIV>;
public:
using type = CCMpfaFVGridGeometry<GridView, Traits, getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>()>;
using type = CCMpfaFVGridGeometry<GridView, Traits, getPropValue<TypeTag, Properties::EnableGridGeometryCache>()>;
};
#pragma GCC diagnostic pop
......
......@@ -62,7 +62,7 @@ template<class TypeTag>
struct FVGridGeometry<TypeTag, TTag::CCTpfaModel>
{
private:
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
using GridView = GetPropType<TypeTag, Properties::GridView>;
public:
using type = CCTpfaFVGridGeometry<GridView, enableCache>;
......
......@@ -42,10 +42,10 @@ namespace Dumux {
* This builds up the sub control volumes and sub control volume faces
* for each element in the local scope we are restricting to, e.g. stencil or element.
* \tparam GG the finite volume grid geometry type
* \tparam enableFVGridGeometryCache if the grid geometry is cached or not
* \tparam enableGridGeometryCache if the grid geometry is cached or not
* \note This class is specialized for versions with and without caching the fv geometries on the grid view
*/
template<class GG, bool EnableFVGridGeometryCache>
template<class GG, bool enableGridGeometryCache>
class CCMpfaFVElementGeometry;
/*!
......
......@@ -55,9 +55,17 @@ public:
using type = FVGridVariables<GG, GVV, GFVC>;
};
// Dumux 3.1 changes the property `EnableFVGridGeometryCache` to `EnableGridGeometryCache`.
// For ensuring backward compatibility on the user side, it is necessary to
// stick to the old name for the specializations, see the discussion in MR 1647.
// Use diagnostic pragmas to prevent the emission of a warning message.
// TODO after 3.1: Rename to EnableGridGeometryCache, remove the pragmas and this comment.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
//! We do not store the FVGeometry by default
template<class TypeTag>
struct EnableFVGridGeometryCache<TypeTag, TTag::FiniteVolumeModel> { static constexpr bool value = false; };
#pragma GCC diagnostic pop
//! We do not store the volume variables by default
template<class TypeTag>
......
......@@ -89,7 +89,7 @@ struct FVGridGeometry<TypeTag, TTag::StaggeredFreeFlowModel>
{
private:
static constexpr auto upwindSchemeOrder = getPropValue<TypeTag, Properties::UpwindSchemeOrder>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Traits = StaggeredFreeFlowDefaultFVGridGeometryTraits<GridView, upwindSchemeOrder>;
public:
......
......@@ -88,7 +88,7 @@ template<class TypeTag>
struct FVGridGeometry<TypeTag, TTag::BoxFacetCouplingModel>
{
private:
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
......
......@@ -52,7 +52,7 @@ template<class TypeTag>
struct FVGridGeometry<TypeTag, TTag::BoxDfmModel>
{
private:
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
......
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