Skip to content
Snippets Groups Projects
Commit 7c4b51c2 authored by Oliver Sander's avatar Oliver Sander
Browse files

Merge branch 'issue/dune-typetree-python-dependency' into 'master'

Cleanup implementation of DimRange in python for grid-functions

See merge request !1352
parents 9b924939 89d26517
No related branches found
No related tags found
1 merge request!1352Cleanup implementation of DimRange in python for grid-functions
Pipeline #68902 passed
Pipeline: Dune Nightly Test

#68907

    ......@@ -155,7 +155,8 @@ In order to build the DUNE core modules you need at least the following software
    `DUNE_GENERALIZED_CONSTEXPR` and `DUNE_INLINE_VARIABLE`. Use the key words directly.
    - Remove deprecated header `dune/python/common/numpycommdatahandle.hh`. Use
    `dune/python/grid/numpycommdatahandle.hh` instead.
    - Remove in `dune/python/common/dimrange.hh` the `DimRange` specializations for
    dune-typetree and dune-functions types. Those are moved to dune-functions.
    # Release 2.9
    ......
    ......@@ -9,11 +9,6 @@
    #include <type_traits>
    #include <utility>
    #if HAVE_DUNE_TYPETREE
    #include <dune/typetree/compositenode.hh>
    #include <dune/typetree/powernode.hh>
    #endif // #if HAVE_DUNE_TYPETREE
    #include <dune/python/common/fmatrix.hh>
    #include <dune/python/common/fvector.hh>
    ......@@ -26,36 +21,17 @@ namespace Dune
    namespace detail
    {
    template< class T >
    inline static constexpr T sum () noexcept
    {
    return static_cast< T >( 0 );
    }
    template< class T >
    inline static constexpr T sum ( T a ) noexcept
    {
    return a;
    }
    template< class T, class... U >
    inline static constexpr T sum ( T a, T b, U... c ) noexcept
    {
    return sum( a+b, c... );
    }
    template< class T, class Enable = void >
    struct DimRange;
    template< class T >
    struct DimRange< T, std::enable_if_t< std::is_arithmetic< T >::value > >
    struct DimRange< T, std::enable_if_t< std::is_arithmetic_v< T > > >
    : public std::integral_constant< std::size_t, 1 >
    {};
    template< class... T >
    struct DimRange< std::tuple< T... >, void >
    : public std::integral_constant< std::size_t, sum< std::size_t >( DimRange< T >::value... ) >
    : public std::integral_constant< std::size_t, (DimRange< T >::value + ...) >
    {};
    template< class K, int n >
    ......@@ -68,28 +44,6 @@ namespace Dune
    : public std::integral_constant< std::size_t, m*n >
    {};
    #if HAVE_DUNE_TYPETREE
    template< class T >
    struct DimRange< T, std::enable_if_t< std::is_same< typename T::NodeTag, Dune::TypeTree::CompositeNodeTag >::value > >
    : public DimRange< typename T::ChildTypes >
    {};
    template< class T >
    struct DimRange< T, std::enable_if_t< std::is_same< typename T::NodeTag, Dune::TypeTree::PowerNodeTag >::value > >
    : public std::integral_constant< std::size_t, sum< int >( T::degree() * DimRange< typename T::ChildType >::value ) >
    {};
    #endif // #if HAVE_DUNE_TYPETREE
    template< class T >
    struct DimRange< T, std::enable_if_t< std::is_class< typename T::FiniteElement >::value > >
    : public DimRange< std::decay_t< decltype( std::declval< typename T::FiniteElement >().localBasis() ) > >
    {};
    template< class T >
    struct DimRange< T, std::enable_if_t< std::is_same< std::size_t, decltype( static_cast< std::size_t >( T::Traits::dimRange ) ) >::value > >
    : public std::integral_constant< std::size_t, static_cast< std::size_t >( T::Traits::dimRange ) >
    {};
    } // namespace detail
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment