From 6c189ae2fe4f083bcd8e97ad4f234e7a465e872c Mon Sep 17 00:00:00 2001
From: Patrick <patrick.jaap@tu-dresden.de>
Date: Mon, 11 May 2020 11:36:13 +0200
Subject: [PATCH] Move deprecated warnings to member variables

Otherwise they get triggert even if the deprecated classes are not used.
Maybe not the best solution, but it will be removed soon anyway.
---
 dune/elasticity/assemblers/feassembler.hh         | 5 +++--
 dune/elasticity/assemblers/localadolcstiffness.hh | 4 ++--
 dune/elasticity/assemblers/localenergy.hh         | 4 +++-
 dune/elasticity/assemblers/localfestiffness.hh    | 5 +++--
 dune/elasticity/materials/localintegralenergy.hh  | 5 +++--
 dune/elasticity/materials/neumannenergy.hh        | 5 +++--
 dune/elasticity/materials/sumenergy.hh            | 5 +++--
 7 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/dune/elasticity/assemblers/feassembler.hh b/dune/elasticity/assemblers/feassembler.hh
index 62d1751..35cea42 100644
--- a/dune/elasticity/assemblers/feassembler.hh
+++ b/dune/elasticity/assemblers/feassembler.hh
@@ -179,7 +179,7 @@ namespace Dune
 /** \brief A global FE assembler for variational problems (old fufem bases version)
  */
 template <class Basis, class VectorType >
-class DUNE_DEPRECATED_MSG("dune-elasticity with dune-fufem bases is now deprecated. Use Elasticity::FEAssembler with dune-functions bases.")
+class
 FEAssembler
 {
 
@@ -195,7 +195,8 @@ FEAssembler
     typedef Dune::FieldMatrix<double, blocksize, blocksize> MatrixBlock;
 
 public:
-    const Basis basis_;
+    const Basis
+      DUNE_DEPRECATED_MSG("dune-elasticity with dune-fufem bases is now deprecated. Use Elasticity::FEAssembler with dune-functions bases.") basis_;
 
     /** \brief Partition type on which to assemble
      *
diff --git a/dune/elasticity/assemblers/localadolcstiffness.hh b/dune/elasticity/assemblers/localadolcstiffness.hh
index 59fe3ea..fa308f5 100644
--- a/dune/elasticity/assemblers/localadolcstiffness.hh
+++ b/dune/elasticity/assemblers/localadolcstiffness.hh
@@ -136,7 +136,7 @@ assembleGradientAndHessian(const LocalView& localView,
 /** \brief Assembles energy gradient and Hessian with ADOL-C (automatic differentiation)
  */
 template<class GridView, class LocalFiniteElement, class VectorType>
-class DUNE_DEPRECATED_MSG("dune-elasticity with dune-fufem bases is now deprecated. Use Elasticity::LocalADOLCStiffness with LocalView concept!")
+class
 LocalADOLCStiffness
     : public LocalFEStiffness<GridView,LocalFiniteElement,VectorType>
 {
@@ -158,7 +158,7 @@ public:
 
     LocalADOLCStiffness(const Dune::LocalEnergy<GridView, LocalFiniteElement, AVectorType>* energy)
     : localEnergy_(energy)
-    {}
+    {} DUNE_DEPRECATED_MSG("dune-elasticity with dune-fufem bases is now deprecated. Use Elasticity::LocalADOLCStiffness with LocalView concept!")
 
     /** \brief Compute the energy at the current configuration */
     virtual RT energy (const Entity& e,
diff --git a/dune/elasticity/assemblers/localenergy.hh b/dune/elasticity/assemblers/localenergy.hh
index f4c56f3..1852cb2 100644
--- a/dune/elasticity/assemblers/localenergy.hh
+++ b/dune/elasticity/assemblers/localenergy.hh
@@ -26,9 +26,11 @@ public:
 
 namespace Dune {
 
+// WARNING: This interface is deprecated and will be removed!
+
 /** \brief Base class for energies defined by integrating over one grid element */
 template<class GridView, class LocalFiniteElement, class VectorType>
-class DUNE_DEPRECATED_MSG("dune-elasticity with dune-fufem bases is now deprecated. Use Elasticity::LocalEnergy with LocalView concept!")
+class
 LocalEnergy
 {
     typedef typename VectorType::value_type::field_type RT;
diff --git a/dune/elasticity/assemblers/localfestiffness.hh b/dune/elasticity/assemblers/localfestiffness.hh
index 5aa1f98..ecb66f0 100644
--- a/dune/elasticity/assemblers/localfestiffness.hh
+++ b/dune/elasticity/assemblers/localfestiffness.hh
@@ -30,7 +30,7 @@ public:
 
 
 template<class GridView, class LocalFiniteElement, class VectorType>
-class DUNE_DEPRECATED_MSG("dune-elasticity with dune-fufem bases is now deprecated. Use Elasticity::LocalFEStiffness with LocalView concept!")
+class
 LocalFEStiffness
 : public Dune::LocalEnergy<GridView, LocalFiniteElement, VectorType>
 {
@@ -55,7 +55,8 @@ public:
                                  VectorType& localGradient) = 0;
 
     // assembled data
-    Dune::Matrix<Dune::FieldMatrix<RT,blocksize,blocksize> > A_;
+    Dune::Matrix<Dune::FieldMatrix<RT,blocksize,blocksize> >
+      DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Dune::Elasticity::LocalFEStiffness") A_;
 
 };
 
diff --git a/dune/elasticity/materials/localintegralenergy.hh b/dune/elasticity/materials/localintegralenergy.hh
index 5b5df9b..97db261 100644
--- a/dune/elasticity/materials/localintegralenergy.hh
+++ b/dune/elasticity/materials/localintegralenergy.hh
@@ -97,7 +97,7 @@ energy(const LocalView& localView,
 namespace Dune {
 
 template<class GridView, class LocalFiniteElement, class field_type=double>
-class DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Elasticity::LocalIntegralEnergy")
+class
 LocalIntegralEnergy
   : public LocalEnergy<GridView,LocalFiniteElement,std::vector<FieldVector<field_type,GridView::dimension>>>
 {
@@ -125,7 +125,8 @@ public:
                      const std::vector<Dune::FieldVector<field_type,gridDim> >& localConfiguration) const;
 
 protected:
-  const std::shared_ptr<Elasticity::LocalDensity<gridDim,field_type,DT>> localDensity_ = nullptr;
+  const std::shared_ptr<Elasticity::LocalDensity<gridDim,field_type,DT>>
+    DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Elasticity::LocalIntegralEnergy") localDensity_ = nullptr;
 
 };
 
diff --git a/dune/elasticity/materials/neumannenergy.hh b/dune/elasticity/materials/neumannenergy.hh
index 2bb416e..ea62bdc 100644
--- a/dune/elasticity/materials/neumannenergy.hh
+++ b/dune/elasticity/materials/neumannenergy.hh
@@ -98,7 +98,7 @@ private:
 namespace Dune {
 
 template<class GridView, class LocalFiniteElement, class field_type=double>
-class DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Elasticity::NeumannEnergy")
+class
 NeumannEnergy
 : public LocalEnergy<GridView,LocalFiniteElement,std::vector<FieldVector<field_type,GridView::dimension> > >
 {
@@ -174,7 +174,8 @@ public:
 
 private:
   /** \brief The Neumann boundary */
-  const BoundaryPatch<GridView>* neumannBoundary_;
+  const BoundaryPatch<GridView>*
+    DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Elasticity::NeumannEnergy") neumannBoundary_;
 
   /** \brief The function implementing the Neumann data */
   const Dune::VirtualFunction<Dune::FieldVector<double,dim>, Dune::FieldVector<double,dim> >* neumannFunction_;
diff --git a/dune/elasticity/materials/sumenergy.hh b/dune/elasticity/materials/sumenergy.hh
index 2099246..ae0fd22 100644
--- a/dune/elasticity/materials/sumenergy.hh
+++ b/dune/elasticity/materials/sumenergy.hh
@@ -52,7 +52,7 @@ private:
 namespace Dune {
 
 template<class GridView, class LocalFiniteElement, class field_type=double>
-class DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Elasticity::SumEnergy")
+class
 SumEnergy
 : public LocalEnergy<GridView,LocalFiniteElement,std::vector<Dune::FieldVector<field_type,GridView::dimension> > >
 {
@@ -85,7 +85,8 @@ public:
 
 private:
 
-  std::shared_ptr<LocalEnergy<GridView,LocalFiniteElement,std::vector<FieldVector<field_type,dim> > > > a_;
+  std::shared_ptr<LocalEnergy<GridView,LocalFiniteElement,std::vector<FieldVector<field_type,dim> > > >
+    DUNE_DEPRECATED_MSG("Use dune-functions powerBases with LocalView concept. See Elasticity::SumEnergy") a_;
 
   std::shared_ptr<LocalEnergy<GridView,LocalFiniteElement,std::vector<FieldVector<field_type,dim> > > > b_;
 
-- 
GitLab