Skip to content
Snippets Groups Projects
Commit dca7f68b authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Merge branch 'cleanup/remove-power' into 'master'

[cleanup] Remove header power.hh

See merge request !1304
parents 6b70be95 d674c59c
No related branches found
No related tags found
1 merge request!1304[cleanup] Remove header power.hh
Pipeline #65836 passed with warnings
Pipeline: Dune Nightly Test

#65839

    ......@@ -114,6 +114,8 @@ In order to build the DUNE core modules you need at least the following software
    - Remove deprecated `dune/common/std/apply.hh`, use `std::apply` instead.
    - Deprecated the file `dune/common/assertandreturn.hh` and the contained utility
    `DUNE_ASSERT_AND_RETURN`. Use `assert()` macro directly in `constexpr` functions.
    - Remove deprecated header `power.hh`. Use `Dune::power` from `math.hh` instead.
    # Release 2.9
    ......
    ......@@ -79,7 +79,6 @@ install(FILES
    parametertreeparser.hh
    path.hh
    poolallocator.hh
    power.hh
    precision.hh
    propertymap.hh
    promotiontraits.hh
    ......
    // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    // vi: set et ts=4 sw=2 sts=2:
    // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
    // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
    #ifndef DUNE_COMMON_POWER_HH
    #define DUNE_COMMON_POWER_HH
    #warning The header power.hh is deprecated. Use power from math.hh instead.
    /** \file
    \brief Various implementations of the power function for run-time and static arguments
    */
    #include <dune/common/math.hh>
    namespace Dune {
    /** @addtogroup Common
    @{
    */
    /** \brief Calculates b^p at compile time
    * \deprecated Please use the method `power` from `math.hh` instead!
    */
    template <int b, int p>
    struct StaticPower
    {
    /** \brief power stores b^p */
    static constexpr int power = Dune::power(b,p);
    };
    /** \brief Compute power for a run-time base and a compile-time integer exponent
    *
    * \deprecated Please use the method `power` from `math.hh` instead!
    *
    * \tparam p The exponent
    */
    template <int p>
    struct Power
    {
    template <typename T>
    static constexpr auto eval(const T & a)
    {
    return power(a,p);
    }
    };
    }
    #endif
    ......@@ -10,7 +10,6 @@
    #include <dune/common/deprecated.hh>
    #include <dune/common/exceptions.hh>
    #include <dune/common/math.hh>
    #include <dune/common/power.hh>
    using namespace Dune;
    ......@@ -42,21 +41,6 @@ int main (int argc, char** argv) try
    // Test whether the result can be used in a compile-time expression
    [[maybe_unused]] constexpr static int dummy = power(2,2);
    // Test legacy power implementation
    DUNE_NO_DEPRECATED_BEGIN
    if (Power<0>::eval(4) != 1)
    DUNE_THROW(MathError, "Power implementation does not compute the correct result");
    if (Power<1>::eval(4) != 4)
    DUNE_THROW(MathError, "Power implementation does not compute the correct result");
    if (Power<2>::eval(4) != 16)
    DUNE_THROW(MathError, "Power implementation does not compute the correct result");
    if (Power<3>::eval(4) != 64)
    DUNE_THROW(MathError, "Power implementation does not compute the correct result");
    DUNE_NO_DEPRECATED_END
    return 0;
    }
    catch (Exception& e)
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment