From 16be6dcb2a62b6ed2334793d1603ba90cfbf65be Mon Sep 17 00:00:00 2001
From: Simon Praetorius <simon.praetorius@tu-dresden.de>
Date: Fri, 31 May 2024 07:44:18 +0000
Subject: [PATCH] Revert "Merge branch 'issue/block-traits-field-traits' into
 'master'"

This reverts merge request !564
---
 dune/istl/bcrsmatrix.hh   |  2 +-
 dune/istl/bdmatrix.hh     |  3 +--
 dune/istl/btdmatrix.hh    |  3 +--
 dune/istl/bvector.hh      | 39 ++++++++++++++++++++++++++++++---------
 dune/istl/matrix.hh       |  4 ++--
 dune/istl/matrixmarket.hh |  5 ++---
 dune/istl/vbvector.hh     |  2 +-
 7 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/dune/istl/bcrsmatrix.hh b/dune/istl/bcrsmatrix.hh
index 7cecddb39..3806a813b 100644
--- a/dune/istl/bcrsmatrix.hh
+++ b/dune/istl/bcrsmatrix.hh
@@ -485,7 +485,7 @@ namespace Dune {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
diff --git a/dune/istl/bdmatrix.hh b/dune/istl/bdmatrix.hh
index ce268ddb3..19ed0f36c 100644
--- a/dune/istl/bdmatrix.hh
+++ b/dune/istl/bdmatrix.hh
@@ -7,7 +7,6 @@
 
 #include <memory>
 
-#include <dune/common/ftraits.hh>
 #include <dune/common/rangeutilities.hh>
 #include <dune/common/scalarmatrixview.hh>
 
@@ -37,7 +36,7 @@ namespace Dune {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
diff --git a/dune/istl/btdmatrix.hh b/dune/istl/btdmatrix.hh
index f4dc981a8..2bd2a6ea1 100644
--- a/dune/istl/btdmatrix.hh
+++ b/dune/istl/btdmatrix.hh
@@ -6,7 +6,6 @@
 #define DUNE_ISTL_BTDMATRIX_HH
 
 #include <dune/common/fmatrix.hh>
-#include <dune/common/ftraits.hh>
 #include <dune/common/scalarvectorview.hh>
 #include <dune/common/scalarmatrixview.hh>
 #include <dune/istl/bcrsmatrix.hh>
@@ -35,7 +34,7 @@ namespace Dune {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
diff --git a/dune/istl/bvector.hh b/dune/istl/bvector.hh
index 6aa358273..28597e59f 100644
--- a/dune/istl/bvector.hh
+++ b/dune/istl/bvector.hh
@@ -40,11 +40,32 @@ namespace Dune {
 /** \brief Everything in this namespace is internal to dune-istl, and may change without warning */
 namespace Imp {
 
+  /** \brief Define some derived types transparently for number types and dune-istl vector types
+   *
+   * This is the actual implementation.  Calling code should use BlockTraits instead.
+   * \tparam isNumber Whether B is a number type (true) or a dune-istl matrix or vector type (false)
+   */
+  template <class B, bool isNumber>
+  class BlockTraitsImp;
+
+  template <class B>
+  class BlockTraitsImp<B,true>
+  {
+  public:
+    using field_type = B;
+  };
+
+  template <class B>
+  class BlockTraitsImp<B,false>
+  {
+  public:
+    using field_type = typename B::field_type;
+  };
+
   /** \brief Define some derived types transparently for number types and dune-istl matrix/vector types
-   * \deprecated
    */
   template <class B>
-  using BlockTraits [[deprecated("Use FieldTraits instead.")]] = FieldTraits<B>;
+  using BlockTraits = BlockTraitsImp<B,IsNumber<B>::value>;
 
   /**
       \brief An unmanaged vector of blocks.
@@ -65,7 +86,7 @@ namespace Imp {
   public:
 
     //===== type definitions and constants
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
@@ -156,7 +177,7 @@ namespace Imp {
     template<class OtherB, class OtherST>
     auto operator* (const block_vector_unmanaged<OtherB,OtherST>& y) const
     {
-      typedef typename PromotionTraits<field_type,typename FieldTraits<OtherB>::field_type>::PromotedType PromotedType;
+      typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
       PromotedType sum(0);
 #ifdef DUNE_ISTL_WITH_CHECKING
       if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
@@ -177,7 +198,7 @@ namespace Imp {
     template<class OtherB, class OtherST>
     auto dot(const block_vector_unmanaged<OtherB,OtherST>& y) const
     {
-      typedef typename PromotionTraits<field_type,typename FieldTraits<OtherB>::field_type>::PromotedType PromotedType;
+      typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
       PromotedType sum(0);
 #ifdef DUNE_ISTL_WITH_CHECKING
       if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
@@ -374,7 +395,7 @@ namespace Imp {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
@@ -602,7 +623,7 @@ namespace Imp {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
@@ -725,7 +746,7 @@ namespace Imp {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
@@ -976,7 +997,7 @@ namespace Imp {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the type representing the components
     typedef B block_type;
diff --git a/dune/istl/matrix.hh b/dune/istl/matrix.hh
index dc86fb100..2aff17648 100644
--- a/dune/istl/matrix.hh
+++ b/dune/istl/matrix.hh
@@ -47,7 +47,7 @@ namespace MatrixImp
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the allocator type
     typedef A allocator_type;
@@ -562,7 +562,7 @@ namespace MatrixImp
   public:
 
     /** \brief Export the type representing the underlying field */
-    using field_type = typename FieldTraits<T>::field_type;
+    using field_type = typename Imp::BlockTraits<T>::field_type;
 
     /** \brief Export the type representing the components */
     typedef T block_type;
diff --git a/dune/istl/matrixmarket.hh b/dune/istl/matrixmarket.hh
index 05289d58c..5c2d78255 100644
--- a/dune/istl/matrixmarket.hh
+++ b/dune/istl/matrixmarket.hh
@@ -23,7 +23,6 @@
 
 #include <dune/common/exceptions.hh>
 #include <dune/common/fmatrix.hh>
-#include <dune/common/ftraits.hh>
 #include <dune/common/fvector.hh>
 #include <dune/common/hybridutilities.hh>
 #include <dune/common/stdstreams.hh>
@@ -180,7 +179,7 @@ namespace Dune
       static void print(std::ostream& os)
       {
         os<<"%%MatrixMarket matrix coordinate ";
-        os<<mm_numeric_type<Simd::Scalar<typename FieldTraits<T>::field_type>>::str()<<" general"<<std::endl;
+        os<<mm_numeric_type<Simd::Scalar<typename Imp::BlockTraits<T>::field_type>>::str()<<" general"<<std::endl;
       }
     };
 
@@ -190,7 +189,7 @@ namespace Dune
       static void print(std::ostream& os)
       {
         os<<"%%MatrixMarket matrix array ";
-        os<<mm_numeric_type<Simd::Scalar<typename FieldTraits<B>::field_type>>::str()<<" general"<<std::endl;
+        os<<mm_numeric_type<Simd::Scalar<typename Imp::BlockTraits<B>::field_type>>::str()<<" general"<<std::endl;
       }
     };
 
diff --git a/dune/istl/vbvector.hh b/dune/istl/vbvector.hh
index 89dd0962e..681df8c85 100644
--- a/dune/istl/vbvector.hh
+++ b/dune/istl/vbvector.hh
@@ -53,7 +53,7 @@ namespace Dune {
     //===== type definitions and constants
 
     //! export the type representing the field
-    using field_type = typename FieldTraits<B>::field_type;
+    using field_type = typename Imp::BlockTraits<B>::field_type;
 
     //! export the allocator type
     typedef A allocator_type;
-- 
GitLab