From f157ef50a9008d0d826f12477f1c0a5783ddb93e Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Mon, 7 Oct 2019 21:50:41 +0200 Subject: [PATCH] Remove various binary operators when using dune-common 2.7 The dune-common 2.7 release finally adds all those standard binary addition, multiplication, etc operators for FieldVector and FieldMatrix. Hence we do not have to have our own implementation anymore. We still keep it for backward- compatibility with dune-common 2.6, but guard it behind cpp conditionals. --- dune/gfe/linearalgebra.hh | 10 ++++++++++ dune/gfe/localprojectedfefunction.hh | 2 ++ 2 files changed, 12 insertions(+) diff --git a/dune/gfe/linearalgebra.hh b/dune/gfe/linearalgebra.hh index ca4f1eb4..6f23b7b7 100644 --- a/dune/gfe/linearalgebra.hh +++ b/dune/gfe/linearalgebra.hh @@ -4,6 +4,7 @@ #include <dune/common/fmatrix.hh> #if ADOLC_ADOUBLE_H +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) template< int m, int n, int p > auto operator* ( const Dune::FieldMatrix< adouble, m, n > &A, const Dune::FieldMatrix< adouble, n, p > &B) -> Dune::FieldMatrix<adouble, m, p> @@ -58,7 +59,9 @@ auto operator* ( const Dune::FieldMatrix< double, m, n > &A, const Dune::FieldMa return ret; } #endif +#endif +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) //! calculates ret = A + B template< class K, int m, int n> Dune::FieldMatrix<K,m,n> operator+ ( const Dune::FieldMatrix<K, m, n> &A, const Dune::FieldMatrix<K,m,n> &B) @@ -87,8 +90,10 @@ auto operator- ( const Dune::FieldMatrix< T, m, n > &A, const Dune::FieldMatrix< return result; } +#endif #if ADOLC_ADOUBLE_H +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) //! calculates ret = A - B template <int m, int n> auto operator- ( const Dune::FieldMatrix< adouble, m, n > &A, const Dune::FieldMatrix< double, m, n > &B) @@ -103,6 +108,7 @@ auto operator- ( const Dune::FieldMatrix< adouble, m, n > &A, const Dune::FieldM return result; } +#endif //! calculates ret = s*A template< int m, int n> @@ -120,6 +126,7 @@ auto operator* ( const double& s, const Dune::FieldMatrix<adouble, m, n> &A) } #endif +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) //! calculates ret = s*A template< int m, int n> auto operator* ( const double& s, const Dune::FieldMatrix<double, m, n> &A) @@ -134,6 +141,7 @@ auto operator* ( const double& s, const Dune::FieldMatrix<double, m, n> &A) return ret; } +#endif //! calculates ret = A/s template< class K, int m, int n> @@ -149,6 +157,7 @@ Dune::FieldMatrix<K,m,n> operator/ ( const Dune::FieldMatrix<K, m, n> &A, const return ret; } +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) //! calculates ret = A/s template< class K, int m> Dune::FieldVector<K,m> operator/ ( const Dune::FieldVector<K, m> &A, const K& s) @@ -161,5 +170,6 @@ Dune::FieldVector<K,m> operator/ ( const Dune::FieldVector<K, m> &A, const K& s) return result; } +#endif #endif diff --git a/dune/gfe/localprojectedfefunction.hh b/dune/gfe/localprojectedfefunction.hh index 583eee2e..259270cc 100644 --- a/dune/gfe/localprojectedfefunction.hh +++ b/dune/gfe/localprojectedfefunction.hh @@ -13,6 +13,7 @@ namespace Dune { +#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7) template< class K, int m, int n, int p > Dune::FieldMatrix< K, m, p > operator* ( const Dune::FieldMatrix< K, m, n > &A, const Dune::FieldMatrix< K, n, p > &B) { @@ -29,6 +30,7 @@ Dune::FieldMatrix< K, m, p > operator* ( const Dune::FieldMatrix< K, m, n > &A, } return ret; } +#endif namespace GFE { /** \brief Interpolate in an embedding Euclidean space, and project back onto the Riemannian manifold -- GitLab