From e0beecb3683d0ee22be60676ed63954de97cc72c Mon Sep 17 00:00:00 2001 From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> Date: Thu, 12 Sep 2019 15:49:35 +0200 Subject: [PATCH] [discretization][properties] add pragmas around usages of FVGridGeometry Prevent the emission of compiler warnings once the property is deprecated. See the discussion of !1647 for more details. --- dumux/common/properties.hh | 10 ++++++++++ dumux/common/properties/propertysystem.hh | 14 ++++++++++++++ dumux/discretization/box.hh | 8 ++++++++ dumux/discretization/ccmpfa.hh | 8 ++++++++ dumux/discretization/cctpfa.hh | 8 ++++++++ .../staggered/freeflow/properties.hh | 8 ++++++++ dumux/multidomain/facet/box/properties.hh | 8 ++++++++ dumux/porousmediumflow/boxdfm/model.hh | 8 ++++++++ dumux/porousmediumflow/sequential/properties.hh | 8 ++++++++ .../1p/implicit/network1d3d/problem.hh | 8 ++++++++ 10 files changed, 88 insertions(+) diff --git a/dumux/common/properties.hh b/dumux/common/properties.hh index 72478c8bf0..fc72e9cc04 100644 --- a/dumux/common/properties.hh +++ b/dumux/common/properties.hh @@ -114,8 +114,18 @@ struct ElementBoundaryTypes { using type = UndefinedProperty; }; // TODO: Remove deprecated property FVGridGeometry after 3.1 template<class TypeTag, class MyTypeTag> struct FVGridGeometry { using type = UndefinedProperty; }; //!< The type of the global finite volume geometry + +// 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. +// Use diagnostic pragmas to prevent the emission of a warning message. +// TODO after 3.1: change default vale to `UndefinedProperty`, remove pragmas +// and comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template<class TypeTag, class MyTypeTag> struct GridGeometry { using type = GetPropType<TypeTag, Properties::FVGridGeometry>; }; //!< The type of the global finite volume geometry +#pragma GCC diagnostic pop template<class TypeTag, class MyTypeTag> struct EnableFVGridGeometryCache { using type = UndefinedProperty; }; //!< specifies if geometric data is saved (faster, but more memory consuming) diff --git a/dumux/common/properties/propertysystem.hh b/dumux/common/properties/propertysystem.hh index 5819af0ed7..c58b032f1f 100644 --- a/dumux/common/properties/propertysystem.hh +++ b/dumux/common/properties/propertysystem.hh @@ -91,7 +91,17 @@ struct GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, std: template<class TypeTag, template<class,class> class Property, class LastTypeTag> struct GetDefined<TypeTag, Property, std::tuple<LastTypeTag>> { +// As of clang 8, the following alias triggers compiler warnings if instantiated +// from something like `GetPropType<..., DeprecatedProperty>`, even if that is +// contained in a diagnostic pragma construct that should prevent these warnings. +// As a workaround, also add the pragmas around this line. The desired warnings +// from instantiating `GetPropType<..., DeprecatedProperty>` without pragmas are +// still issued both by gcc and clang. +// See the discussion in MR 1647 for more details. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" using LastType = Property<TypeTag, LastTypeTag>; +#pragma GCC diagnostic pop using type = std::conditional_t<isDefinedProperty<LastType>(int{}), LastType, typename GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>, void>::type>; }; @@ -99,7 +109,11 @@ struct GetDefined<TypeTag, Property, std::tuple<LastTypeTag>> template<class TypeTag, template<class,class> class Property, class FirstTypeTag, class ...Args> struct GetDefined<TypeTag, Property, std::tuple<FirstTypeTag, Args...>> { +// See the comment above. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" using FirstType = Property<TypeTag, FirstTypeTag>; +#pragma GCC diagnostic pop using type = std::conditional_t<isDefinedProperty<FirstType>(int{}), FirstType, typename GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, void>::type>; }; diff --git a/dumux/discretization/box.hh b/dumux/discretization/box.hh index a7811a21b0..3ac7189877 100644 --- a/dumux/discretization/box.hh +++ b/dumux/discretization/box.hh @@ -51,6 +51,13 @@ namespace TTag { struct BoxModel { using InheritsFrom = std::tuple<FiniteVolumeModel>; }; } // end namespace TTag +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! Set the default for the global finite volume geometry template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::BoxModel> @@ -62,6 +69,7 @@ private: public: using type = BoxFVGridGeometry<Scalar, GridView, enableCache>; }; +#pragma GCC diagnostic pop //! The grid volume variables vector class template<class TypeTag> diff --git a/dumux/discretization/ccmpfa.hh b/dumux/discretization/ccmpfa.hh index c59c73a4e1..8268d077ff 100644 --- a/dumux/discretization/ccmpfa.hh +++ b/dumux/discretization/ccmpfa.hh @@ -96,6 +96,13 @@ public: using type = CCMpfaOInteractionVolume< Traits >; }; +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! Set the default for the global finite volume geometry template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::CCMpfaModel> @@ -109,6 +116,7 @@ private: public: using type = CCMpfaFVGridGeometry<GridView, Traits, getPropValue<TypeTag, Properties::EnableFVGridGeometryCache>()>; }; +#pragma GCC diagnostic pop //! The grid volume variables vector class template<class TypeTag> diff --git a/dumux/discretization/cctpfa.hh b/dumux/discretization/cctpfa.hh index 66f2230181..b81a077910 100644 --- a/dumux/discretization/cctpfa.hh +++ b/dumux/discretization/cctpfa.hh @@ -50,6 +50,13 @@ namespace TTag { struct CCTpfaModel { using InheritsFrom = std::tuple<FiniteVolumeModel>; }; } // end namespace TTag +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! Set the default for the global finite volume geometry template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::CCTpfaModel> @@ -60,6 +67,7 @@ private: public: using type = CCTpfaFVGridGeometry<GridView, enableCache>; }; +#pragma GCC diagnostic pop //! The grid volume variables vector class template<class TypeTag> diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index 1588ca21e4..78e5e4ebd3 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -76,6 +76,13 @@ public: static constexpr int value = numEq - dim; }; +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! The default fv grid geometry template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::StaggeredFreeFlowModel> @@ -88,6 +95,7 @@ private: public: using type = StaggeredFVGridGeometry<GridView, enableCache, Traits>; }; +#pragma GCC diagnostic pop //! The variables living on the faces template<class TypeTag> diff --git a/dumux/multidomain/facet/box/properties.hh b/dumux/multidomain/facet/box/properties.hh index 72303e00bb..1256506c54 100644 --- a/dumux/multidomain/facet/box/properties.hh +++ b/dumux/multidomain/facet/box/properties.hh @@ -76,6 +76,13 @@ template<class TypeTag> struct ElementBoundaryTypes<TypeTag, TTag::BoxFacetCouplingModel> { using type = BoxFacetCouplingElementBoundaryTypes<GetPropType<TypeTag, Properties::BoundaryTypes>>; }; +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! Set the default for the grid finite volume geometry template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::BoxFacetCouplingModel> @@ -87,6 +94,7 @@ private: public: using type = BoxFacetCouplingFVGridGeometry<Scalar, GridView, enableCache>; }; +#pragma GCC diagnostic pop } // namespace Properties } // namespace Dumux diff --git a/dumux/porousmediumflow/boxdfm/model.hh b/dumux/porousmediumflow/boxdfm/model.hh index b3b217eb7f..84388e5961 100644 --- a/dumux/porousmediumflow/boxdfm/model.hh +++ b/dumux/porousmediumflow/boxdfm/model.hh @@ -40,6 +40,13 @@ namespace TTag { struct BoxDfmModel { using InheritsFrom = std::tuple<BoxModel>; }; } // end namespace TTag +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! Set the default for the global finite volume geometry template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::BoxDfmModel> @@ -51,6 +58,7 @@ private: public: using type = BoxDfmFVGridGeometry<Scalar, GridView, enableCache>; }; +#pragma GCC diagnostic pop //! The flux variables cache class specific to box-dfm porous medium flow models template<class TypeTag> diff --git a/dumux/porousmediumflow/sequential/properties.hh b/dumux/porousmediumflow/sequential/properties.hh index cd36ab9111..de283bb580 100644 --- a/dumux/porousmediumflow/sequential/properties.hh +++ b/dumux/porousmediumflow/sequential/properties.hh @@ -139,6 +139,13 @@ public: static const int value = 2*dim; }; +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" //! A simplified grid geometry for compatibility with new style models template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::SequentialModel> @@ -153,6 +160,7 @@ struct FVGridGeometry<TypeTag, TTag::SequentialModel> public: using type = MockFVGridGeometry; }; +#pragma GCC diagnostic pop //! For compatibility with new style models we need a solution vector type template<class TypeTag> diff --git a/test/porousmediumflow/1p/implicit/network1d3d/problem.hh b/test/porousmediumflow/1p/implicit/network1d3d/problem.hh index 6d8fd5ec8f..9c5a4ce6ee 100644 --- a/test/porousmediumflow/1p/implicit/network1d3d/problem.hh +++ b/test/porousmediumflow/1p/implicit/network1d3d/problem.hh @@ -65,6 +65,13 @@ template<class TypeTag> struct Grid<TypeTag, TTag::TubesTest> { using type = Dune::FoamGrid<1, 3>; }; #endif +// Dumux 3.1 changes the property `FVGridGeometry` to `GridGeometry`. +// 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 GridGeometry, remove the pragmas and this comment. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // if we have pt scotch use the reordering dof mapper to optimally sort the dofs (cc) template<class TypeTag> struct FVGridGeometry<TypeTag, TTag::TubesTestCCTpfa> @@ -95,6 +102,7 @@ private: public: using type = BoxFVGridGeometry<Scalar, GridView, enableCache, BoxDefaultGridGeometryTraits<GridView, MapperTraits>>; }; +#pragma GCC diagnostic pop // Set the problem property template<class TypeTag> -- GitLab