From 75ac7e76c03de27e90bde33719779074095fa0e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de>
Date: Fri, 30 Nov 2018 14:03:09 +0100
Subject: [PATCH] [facet][tpfa][mapper] obtain geometry only once

---
 dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh b/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh
index 56058d653c..18e8c35cb6 100644
--- a/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh
+++ b/dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh
@@ -77,6 +77,7 @@ public:
             using LowDimIndexType = typename IndexTraits<typename LowDimFVG::GridView>::GridIndex;
             using BulkIndexType = typename IndexTraits<typename BulkFVG::GridView>::GridIndex;
 
+            const auto lowDimGeometry = lowDimElement.geometry();
             const auto lowDimElemIdx = lowDimFvGridGeometry.elementMapper().index(lowDimElement);
             auto& lowDimData = this->couplingMap_(facetGridId, bulkGridId)[lowDimElemIdx];
 
@@ -109,9 +110,8 @@ public:
                     // otherwise, do float comparison of element and scvf center
                     else
                     {
-                        const auto lowDimGeom = lowDimElement.geometry();
-                        const auto eps = lowDimGeom.volume()*1e-8;
-                        const auto diffVec = lowDimGeom.center()-scvf.center();
+                        const auto eps = lowDimGeometry.volume()*1e-8;
+                        const auto diffVec = lowDimGeometry.center()-scvf.center();
 
                         using std::abs;
                         if ( std::all_of(diffVec.begin(), diffVec.end(), [eps] (auto coord) { return abs(coord) < eps; }) )
-- 
GitLab