From cf8611d680418325380255e2c80c243b9fb66a68 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Wed, 17 Jan 2018 16:48:24 +0100
Subject: [PATCH] [localView] Make localView a non-member, non-friend function

---
 dumux/discretization/basefvgridgeometry.hh | 12 ++----
 dumux/discretization/localview.hh          | 43 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 9 deletions(-)
 create mode 100644 dumux/discretization/localview.hh

diff --git a/dumux/discretization/basefvgridgeometry.hh b/dumux/discretization/basefvgridgeometry.hh
index e303d97b65..b7fd9c2e00 100644
--- a/dumux/discretization/basefvgridgeometry.hh
+++ b/dumux/discretization/basefvgridgeometry.hh
@@ -32,6 +32,9 @@
 #include <dumux/common/geometry/boundingboxtree.hh>
 #include <dumux/common/geometry/geometricentityset.hh>
 
+//! make the local view function available whenever we use the grid geometry
+#include <dumux/discretization/localview.hh>
+
 namespace Dumux {
 
 /*!
@@ -77,15 +80,6 @@ public:
         computeGlobalBoundingBox_();
     }
 
-    /*!
-     * \brief Return a local restriction of this global object.
-     *        The local object is only functional after calling its bind/bindElement method.
-     *        This is a free function that will be found by means of ADL
-     */
-    template<class GridGeometry>
-    friend inline typename GridGeometry::LocalView localView(const GridGeometry& fvGridGeometry)
-    { return typename GridGeometry::LocalView(fvGridGeometry); }
-
     /*!
      * \brief Update all fvElementGeometries (do this again after grid adaption)
      */
diff --git a/dumux/discretization/localview.hh b/dumux/discretization/localview.hh
new file mode 100644
index 0000000000..a41760a08c
--- /dev/null
+++ b/dumux/discretization/localview.hh
@@ -0,0 +1,43 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ * \ingroup Discretization
+ * \brief Free function to get the local view of a grid cache object
+ */
+
+#ifndef DUMUX_LOCAL_VIEW_HH
+#define DUMUX_LOCAL_VIEW_HH
+
+namespace Dumux {
+
+/*!
+ * \ingroup Discretization
+ * \brief Free function to get the local view of a grid cache object
+ * \note A local object is only functional after calling its bind/bindElement method.
+ * \tparam GridCache the grid caching type (such as FVGridGeometry)
+ * \param gridCache the grid caching object we want to localView from
+ */
+template<class GridCache>
+inline typename GridCache::LocalView localView(const GridCache& gridCache)
+{ return typename GridCache::LocalView(gridCache); }
+
+} // end namespace Dumux
+
+#endif
-- 
GitLab