From eedf0011f530e217d52dbea9d85988112d6ceff2 Mon Sep 17 00:00:00 2001
From: Timo Koch <timokoch@math.uio.no>
Date: Sun, 19 Mar 2023 15:52:38 +0100
Subject: [PATCH] [disc] Deprecate scv/scvf.geometry/corner

The implementation in the fvgeometry is still using the scv/scvf interface for now
but all other users will get a deprecation warning. This should be enough to then
be able to replace the implementation in the fvGeometry and remove the interface
of the scv/scvf at the same time sometime after release 3.7.
---
 .../cellcentered/mpfa/fvelementgeometry.hh    | 30 +++++++
 .../cellcentered/mpfa/subcontrolvolumeface.hh |  4 +-
 .../cellcentered/subcontrolvolume.hh          |  9 +-
 .../cellcentered/tpfa/fvelementgeometry.hh    | 83 ++++++++++++-------
 .../cellcentered/tpfa/subcontrolvolumeface.hh |  2 +
 .../staggered/fvelementgeometry.hh            | 23 +++++
 .../staggered/subcontrolvolume.hh             |  2 +
 .../staggered/subcontrolvolumeface.hh         |  2 +
 .../porenetwork/fvelementgeometry.hh          | 30 +++++++
 .../porenetwork/subcontrolvolume.hh           |  2 +
 .../porenetwork/subcontrolvolumeface.hh       |  3 +
 .../freeflow/subcontrolvolumeface.hh          |  8 +-
 .../staggered/subcontrolvolumeface.hh         |  2 +
 .../facet/box/fvelementgeometry.hh            | 30 +++++++
 .../facet/box/subcontrolvolumeface.hh         |  2 +
 .../boxdfm/fvelementgeometry.hh               | 30 +++++++
 .../boxdfm/subcontrolvolume.hh                |  2 +
 .../boxdfm/subcontrolvolumeface.hh            |  2 +
 18 files changed, 230 insertions(+), 36 deletions(-)

diff --git a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
index 367f22ae95..fea9e36359 100644
--- a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
+++ b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
@@ -192,6 +192,21 @@ public:
     bool hasBoundaryScvf() const
     { return gridGeometry().hasBoundaryScvf(scvIndices_[0]); }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
 
     std::optional<Element> element_;
@@ -342,6 +357,21 @@ public:
     bool hasBoundaryScvf() const
     { return hasBoundaryScvf_; }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
 
     //! Binding of an element preparing the geometries of the whole stencil
diff --git a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh
index f49e5f75c1..448615ea3b 100644
--- a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh
+++ b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh
@@ -198,6 +198,7 @@ public:
     { return corners_.size(); }
 
     //! Returns the corner for a given local index
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -210,7 +211,7 @@ public:
 
     //! Returns the global position of the center of the element facet this scvf is embedded in
     const GlobalPosition& facetCorner() const
-    { return corner(0); }
+    { return corners_[0]; }
 
     //! The center of the sub control volume face
     const GlobalPosition& center() const
@@ -225,6 +226,7 @@ public:
     { return unitOuterNormal_; }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     Geometry geometry() const
     { return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_); }
 
diff --git a/dumux/discretization/cellcentered/subcontrolvolume.hh b/dumux/discretization/cellcentered/subcontrolvolume.hh
index 5efbbf7666..506d790d1d 100644
--- a/dumux/discretization/cellcentered/subcontrolvolume.hh
+++ b/dumux/discretization/cellcentered/subcontrolvolume.hh
@@ -123,11 +123,12 @@ public:
     //! The volume of the sub control volume
     Scalar volume() const
     {
-        return geometry().volume();
+        return geometry_->volume();
     }
 
     //! The geometry of the sub control volume
     // e.g. for integration
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).")]]
     const Geometry& geometry() const
     {
         return *geometry_;
@@ -165,17 +166,17 @@ public:
     }
 
     //! Return the corner for the given local index
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).corner(i).")]]
     GlobalPosition corner(LocalIndexType localIdx) const
     {
-        assert(localIdx < geometry().corners() && "provided index exceeds the number of corners");
-        return geometry().corner(localIdx);
+        return geometry_->corner(localIdx);
     }
 
 private:
     void deepCopy_(const CCSubControlVolume& other)
     {
         if (other.geometry_)
-            geometry_ = std::make_unique<Geometry>(other.geometry());
+            geometry_ = std::make_unique<Geometry>(*other.geometry_);
         else
             geometry_.reset();
         center_ = other.center_;
diff --git a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh
index e36175f2f4..a47b706990 100644
--- a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh
+++ b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh
@@ -39,6 +39,19 @@
 
 namespace Dumux {
 
+namespace Detail::Tpfa {
+
+template<class GridIndexType>
+auto findLocalIndex(const GridIndexType idx,
+                    const std::vector<GridIndexType>& indices)
+{
+    auto it = std::find(indices.begin(), indices.end(), idx);
+    assert(it != indices.end() && "Could not find the scv/scvf! Make sure to properly bind this class!");
+    return std::distance(indices.begin(), it);
+}
+
+} // end namespace Detail::Tpfa
+
 /*!
  * \ingroup CCTpfaDiscretization
  * \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models
@@ -63,6 +76,7 @@ class CCTpfaFVElementGeometry<GG, true>
     using ThisType = CCTpfaFVElementGeometry<GG, true>;
     using GridView = typename GG::GridView;
     using GridIndexType = typename IndexTraits<GridView>::GridIndex;
+    using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
 
 public:
     //! export type of the element
@@ -194,16 +208,27 @@ public:
     bool hasBoundaryScvf() const
     { return gridGeometry().hasBoundaryScvf(scvIndices_[0]); }
 
-    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
-    {
-        assert(isBound());
-        return scv.geometry();
-    }
+    typename Element::Geometry geometry(const SubControlVolume& scv) const
+    { return gridGeometryPtr_->element(scv.dofIndex()).geometry(); }
 
-    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    typename GridView::Intersection::Geometry geometry(const SubControlVolumeFace& scvf) const
     {
-        assert(isBound());
-        return scvf.geometry();
+        const auto element = gridGeometryPtr_->element(scvf.insideScvIdx());
+        const auto& scvfIndices = gridGeometryPtr_->scvfIndicesOfScv(scvf.insideScvIdx());
+        const LocalIndexType localScvfIdx = Detail::Tpfa::findLocalIndex(scvf.index(), scvfIndices);
+        LocalIndexType localIdx = 0;
+        for (const auto& intersection : intersections(gridGeometryPtr_->gridView(), element))
+        {
+            if (intersection.neighbor() || intersection.boundary())
+            {
+                if (localIdx == localScvfIdx)
+                    return intersection.geometry();
+                else
+                    ++localIdx;
+            }
+        }
+
+        DUNE_THROW(Dune::InvalidStateException, "Could not find scvf geometry");
     }
 
 private:
@@ -254,7 +279,7 @@ public:
         if (scvIdx == scvIndices_[0])
             return scvs_[0];
         else
-            return neighborScvs_[findLocalIndex(scvIdx, neighborScvIndices_)];
+            return neighborScvs_[Detail::Tpfa::findLocalIndex(scvIdx, neighborScvIndices_)];
     }
 
     //! Get an element sub control volume face with a global scvf index
@@ -265,7 +290,7 @@ public:
         if (it != scvfIndices_.end())
             return scvfs_[std::distance(scvfIndices_.begin(), it)];
         else
-            return neighborScvfs_[findLocalIndex(scvfIdx, neighborScvfIndices_)];
+            return neighborScvfs_[Detail::Tpfa::findLocalIndex(scvfIdx, neighborScvfIndices_)];
     }
 
     //! Get the scvf on the same face but from the other side
@@ -280,7 +305,7 @@ public:
         }
         else
         {
-            const auto localScvfIdx = findLocalIndex(scvfIdx, neighborScvfIndices_);
+            const auto localScvfIdx = Detail::Tpfa::findLocalIndex(scvfIdx, neighborScvfIndices_);
             const auto localFlippedIndex = flippedNeighborScvfIndices_[localScvfIdx][outsideScvIdx];
             if (localFlippedIndex < scvfs_.size())
                 return scvfs_[localFlippedIndex];
@@ -369,16 +394,27 @@ public:
     bool hasBoundaryScvf() const
     { return hasBoundaryScvf_; }
 
-    typename SubControlVolume::Traits::Geometry geometry (const SubControlVolume& scv) const
-    {
-        assert(isBound());
-        return scv.geometry();
-    }
+    typename Element::Geometry geometry(const SubControlVolume& scv) const
+    { return gridGeometryPtr_->element(scv.dofIndex()).geometry(); }
 
-    typename SubControlVolumeFace::Traits::Geometry geometry (const SubControlVolumeFace& scvf) const
+    typename GridView::Intersection::Geometry geometry(const SubControlVolumeFace& scvf) const
     {
-        assert(isBound());
-        return scvf.geometry();
+        const auto element = gridGeometryPtr_->element(scvf.insideScvIdx());
+        const auto& scvfIndices = gridGeometryPtr_->scvfIndicesOfScv(scvf.insideScvIdx());
+        const LocalIndexType localScvfIdx = Detail::Tpfa::findLocalIndex(scvf.index(), scvfIndices);
+        LocalIndexType localIdx = 0;
+        for (const auto& intersection : intersections(gridGeometryPtr_->gridView(), element))
+        {
+            if (intersection.neighbor() || intersection.boundary())
+            {
+                if (localIdx == localScvfIdx)
+                    return intersection.geometry();
+                else
+                    ++localIdx;
+            }
+        }
+
+        DUNE_THROW(Dune::InvalidStateException, "Could not find scvf geometry");
     }
 
 private:
@@ -629,15 +665,6 @@ private:
         }
     }
 
-    const LocalIndexType findLocalIndex(const GridIndexType idx,
-                                        const std::vector<GridIndexType>& indices) const
-    {
-        auto it = std::find(indices.begin(), indices.end(), idx);
-        assert(it != indices.end() && "Could not find the scv/scvf! Make sure to properly bind this class!");
-        return std::distance(indices.begin(), it);
-
-    }
-
     //! Clear all local data
     void clear()
     {
diff --git a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh
index 282777dc21..8fc8682526 100644
--- a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh
+++ b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh
@@ -193,6 +193,7 @@ public:
     }
 
     //! return the i-th corner of this sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(int i) const
     {
         assert(i < corners_.size() && "provided index exceeds the number of corners");
@@ -200,6 +201,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     Geometry geometry() const
     {
         return Geometry(geomType_, corners_);
diff --git a/dumux/discretization/facecentered/staggered/fvelementgeometry.hh b/dumux/discretization/facecentered/staggered/fvelementgeometry.hh
index 2f62de3574..1219eafe0a 100644
--- a/dumux/discretization/facecentered/staggered/fvelementgeometry.hh
+++ b/dumux/discretization/facecentered/staggered/fvelementgeometry.hh
@@ -221,12 +221,20 @@ public:
         DUNE_THROW(Dune::InvalidStateException, "No outside scvf found");
     }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
     typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
     { return scv.geometry(); }
 
+    //! Create the geometry of a given sub control volume face
     typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
     { return scvf.geometry(); }
 
+    #pragma GCC diagnostic pop
 private:
 
     const auto& scvfIndices_() const
@@ -439,6 +447,21 @@ public:
         DUNE_THROW(Dune::InvalidStateException, "No outside scvf found");
     }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
     //! Binding of an element preparing the geometries of the whole stencil
     //! called by the local jacobian to prepare element assembly
diff --git a/dumux/discretization/facecentered/staggered/subcontrolvolume.hh b/dumux/discretization/facecentered/staggered/subcontrolvolume.hh
index 7299db33ef..30fe21225a 100644
--- a/dumux/discretization/facecentered/staggered/subcontrolvolume.hh
+++ b/dumux/discretization/facecentered/staggered/subcontrolvolume.hh
@@ -151,6 +151,7 @@ public:
     bool boundary() const
     { return boundary_; }
 
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -158,6 +159,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).")]]
     Geometry geometry() const
     {
         return Geometry(corners_.front(), corners_.back());
diff --git a/dumux/discretization/facecentered/staggered/subcontrolvolumeface.hh b/dumux/discretization/facecentered/staggered/subcontrolvolumeface.hh
index 16dab13ac8..38a129a16e 100644
--- a/dumux/discretization/facecentered/staggered/subcontrolvolumeface.hh
+++ b/dumux/discretization/facecentered/staggered/subcontrolvolumeface.hh
@@ -215,6 +215,7 @@ public:
     std::int_least8_t directionSign() const
     { return outerNormalSign_; }
 
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -222,6 +223,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     Geometry geometry() const
     {
         auto inPlaneAxes = std::move(std::bitset<T::dimWorld>{}.set());
diff --git a/dumux/discretization/porenetwork/fvelementgeometry.hh b/dumux/discretization/porenetwork/fvelementgeometry.hh
index 8e321517b1..58d081b65b 100644
--- a/dumux/discretization/porenetwork/fvelementgeometry.hh
+++ b/dumux/discretization/porenetwork/fvelementgeometry.hh
@@ -28,6 +28,8 @@
 #include <array>
 #include <utility>
 
+#include <dune/geometry/type.hh>
+
 #include <dumux/common/indextraits.hh>
 #include <dumux/discretization/scvandscvfiterators.hh>
 
@@ -176,6 +178,20 @@ public:
     bool hasBoundaryScvf() const
     { return gridGeometry().hasBoundaryScvf(eIdx_); }
 
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    {
+        const auto geo = element().geometry();
+        return {
+            Dune::GeometryTypes::simplex(dim),
+            std::array{{ geo.corner(scv.indexInElement()), geo.center() }}
+        };
+    }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return { scvf.center() }; }
+
 private:
     std::optional<Element> element_;
     const GridGeometry* gridGeometryPtr_;
@@ -317,6 +333,20 @@ public:
     bool hasBoundaryScvf() const
     { return hasBoundaryScvf_; }
 
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    {
+        const auto geo = element().geometry();
+        return {
+            Dune::GeometryTypes::simplex(dim),
+            std::array{{ geo.corner(scv.indexInElement()), geo.center() }}
+        };
+    }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return { scvf.center() }; }
+
 private:
 
     void makeElementGeometries(const Element& element)
diff --git a/dumux/discretization/porenetwork/subcontrolvolume.hh b/dumux/discretization/porenetwork/subcontrolvolume.hh
index 53e1c8b278..a55d53a7e4 100644
--- a/dumux/discretization/porenetwork/subcontrolvolume.hh
+++ b/dumux/discretization/porenetwork/subcontrolvolume.hh
@@ -125,6 +125,7 @@ public:
     { return elementIndex_; }
 
     //! Return the corner for the given local index
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).corner(i).")]]
     const GlobalPosition& corner(LocalIndexType localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -132,6 +133,7 @@ public:
     }
 
     //! The geometry of the sub control volume e.g. for integration
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).")]]
     Geometry geometry() const
     {
         return Geometry(Dune::GeometryTypes::simplex(1), corners_);
diff --git a/dumux/discretization/porenetwork/subcontrolvolumeface.hh b/dumux/discretization/porenetwork/subcontrolvolumeface.hh
index 83c5a882a5..e0d5caa145 100644
--- a/dumux/discretization/porenetwork/subcontrolvolumeface.hh
+++ b/dumux/discretization/porenetwork/subcontrolvolumeface.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUMEFACE_HH
 #define DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUMEFACE_HH
 
+#include <dune/geometry/axisalignedcubegeometry.hh>
 #include <dumux/common/indextraits.hh>
 #include <dumux/discretization/subcontrolvolumefacebase.hh>
 
@@ -47,6 +48,8 @@ struct PNMDefaultScvfGeometryTraits
     using Scalar = typename Grid::ctype;
     using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
     using CornerStorage = std::array<Dune::FieldVector<Scalar, dimWorld>, 1>;
+    using Geometry = Dune::AxisAlignedCubeGeometry<Scalar, dim-1, dimWorld>;
+
 };
 
 /*!
diff --git a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh
index 6d489cfdb1..36b5709eda 100644
--- a/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh
+++ b/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh
@@ -235,6 +235,7 @@ public:
     }
 
     //! The positions of the corners
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -242,6 +243,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     const Geometry geometry() const
     {
         return Geometry(geomType_, corners_);
@@ -301,12 +303,12 @@ public:
         if (dim == 3)
         {
             if (localSubFaceIdx < 2)
-                return (corner(1) - corner(0)).two_norm();
+                return (corners_[1] - corners_[0]).two_norm();
             else
-                return (corner(2) - corner(0)).two_norm();
+                return (corners_[2] - corners_[0]).two_norm();
         }
         else
-            return (corner(1) - corner(0)).two_norm();
+            return (corners_[1] - corners_[0]).two_norm();
     }
 
    /*!
diff --git a/dumux/discretization/staggered/subcontrolvolumeface.hh b/dumux/discretization/staggered/subcontrolvolumeface.hh
index 2db096a1c2..4b5d739582 100644
--- a/dumux/discretization/staggered/subcontrolvolumeface.hh
+++ b/dumux/discretization/staggered/subcontrolvolumeface.hh
@@ -213,6 +213,7 @@ public:
     }
 
     //! The positions of the corners
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -220,6 +221,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     const Geometry geometry() const
     {
         return Geometry(geomType_, corners_);
diff --git a/dumux/multidomain/facet/box/fvelementgeometry.hh b/dumux/multidomain/facet/box/fvelementgeometry.hh
index ffb3f4a61b..9aa00de1a0 100644
--- a/dumux/multidomain/facet/box/fvelementgeometry.hh
+++ b/dumux/multidomain/facet/box/fvelementgeometry.hh
@@ -170,6 +170,21 @@ public:
     const Element& element() const
     { return *element_; }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
     const GridGeometry* gridGeometryPtr_;
 
@@ -303,6 +318,21 @@ public:
     const Element& element() const
     { return *element_; }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
 
     void makeElementGeometries_()
diff --git a/dumux/multidomain/facet/box/subcontrolvolumeface.hh b/dumux/multidomain/facet/box/subcontrolvolumeface.hh
index cdbab75a42..5163305fe5 100644
--- a/dumux/multidomain/facet/box/subcontrolvolumeface.hh
+++ b/dumux/multidomain/facet/box/subcontrolvolumeface.hh
@@ -188,6 +188,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     Geometry geometry() const
     { return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_); }
 
@@ -196,6 +197,7 @@ public:
     { return boundaryFlag_.get(); }
 
     //! returns the position of a corner of the face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
diff --git a/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh b/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh
index 3879a989c7..15c0da9529 100644
--- a/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh
+++ b/dumux/porousmediumflow/boxdfm/fvelementgeometry.hh
@@ -183,6 +183,21 @@ public:
     const Element& element() const
     { return *element_; }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
     const GridGeometry* gridGeometryPtr_;
 
@@ -324,6 +339,21 @@ public:
     const Element& element() const
     { return *element_; }
 
+    // suppress warnings due to current implementation
+    // these interfaces should be used!
+    #pragma GCC diagnostic push
+    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+    //! Create the geometry of a given sub control volume
+    typename SubControlVolume::Traits::Geometry geometry(const SubControlVolume& scv) const
+    { return scv.geometry(); }
+
+    //! Create the geometry of a given sub control volume face
+    typename SubControlVolumeFace::Traits::Geometry geometry(const SubControlVolumeFace& scvf) const
+    { return scvf.geometry(); }
+
+    #pragma GCC diagnostic pop
+
 private:
 
     void makeElementGeometries_()
diff --git a/dumux/porousmediumflow/boxdfm/subcontrolvolume.hh b/dumux/porousmediumflow/boxdfm/subcontrolvolume.hh
index fb91e85fc4..ad90e5cf6c 100644
--- a/dumux/porousmediumflow/boxdfm/subcontrolvolume.hh
+++ b/dumux/porousmediumflow/boxdfm/subcontrolvolume.hh
@@ -202,6 +202,7 @@ public:
 
     //! The geometry of the sub control volume
     // e.g. for integration
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).")]]
     Geometry geometry() const
     {
         if (isFractureScv_)
@@ -214,6 +215,7 @@ public:
     }
 
     //! Return the corner for the given local index
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scv).corner(i).")]]
     const GlobalPosition& corner(LocalIndexType localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
diff --git a/dumux/porousmediumflow/boxdfm/subcontrolvolumeface.hh b/dumux/porousmediumflow/boxdfm/subcontrolvolumeface.hh
index 9a1a24a9fa..d9f96479d3 100644
--- a/dumux/porousmediumflow/boxdfm/subcontrolvolumeface.hh
+++ b/dumux/porousmediumflow/boxdfm/subcontrolvolumeface.hh
@@ -237,6 +237,7 @@ public:
     }
 
     //! Returns a corner of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).corner(i).")]]
     const GlobalPosition& corner(unsigned int localIdx) const
     {
         assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
@@ -244,6 +245,7 @@ public:
     }
 
     //! The geometry of the sub control volume face
+    [[deprecated("Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
     Geometry geometry() const
     {
         if (isFractureScvf_)
-- 
GitLab