3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
deprecated.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
25#ifndef DUMUX_COMMON_DEPRECATED_HH
26#define DUMUX_COMMON_DEPRECATED_HH
27
28#include <dune/common/version.hh>
29#include <dune/common/std/type_traits.hh>
30
31namespace Dumux {
32
33#ifndef DOXYGEN // hide from doxygen
34// Helper classes/functions for deprecation
35// Each implementation has to state after which release
36// it will be removed. Implementations in the Deprecated
37// namespace will be removed without
38// deprecation after their usage in the code expired,
39// so most likely you don't want to use this in your code
40namespace Deprecated {
41
42template <class Mapper, class GridView>
43using GridViewDetector = decltype(std::declval<Mapper>().update(std::declval<GridView>()));
44
45template<class Mapper, class GridView>
46static constexpr bool hasUpdateGridView()
47{ return Dune::Std::is_detected<GridViewDetector, Mapper, GridView>::value; }
48
49// helper class to print deprecated message
50template <class Mapper>
51#if DUNE_VERSION_GTE(DUNE_GRID,2,8)
52[[deprecated("The interface mapper.update() is deprecated. All mappers now have to implement `update(gridView)` instead (with a gridView as argument). Only mappers with the new interface will be support for dune-grid 2.7 is dropped.")]]
53#endif
54void update(Mapper& mapper)
55{ mapper.update(); };
56
57} // end namespace Deprecated
58#endif
59
60} // end namespace Dumux
61#endif
Definition: adapt.hh:29