From 7cd85c223c32888c670755455b12acd09f47da8f Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Mon, 31 Jan 2011 07:49:39 +0000
Subject: [PATCH] use the boundary patch iterator to implement a loop over a
 boundary patch

[[Imported from SVN: r6898]]
---
 .../rodcontinuumsteklovpoincarestep.hh        | 21 ++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh
index f8814cdb..72902e61 100644
--- a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh
+++ b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh
@@ -708,14 +708,21 @@ linearizedRodNeumannToDirichletMap(const std::string& rodName,
             continue;
         
         const LeafBoundaryPatch<RodGridType>& interfaceBoundary = complex_.coupling(couplingName).rodInterfaceBoundary_;
+        
+        const typename RodGridType::LeafGridView::IndexSet& indexSet = interfaceBoundary.gridView().indexSet();
+        
+        for (typename LeafBoundaryPatch<RodGridType>::iterator bIt = interfaceBoundary.begin();
+             bIt != interfaceBoundary.end();
+             ++bIt) {
+            
+            // vertex index corresponding to the current boundary segment
+            size_t idx = indexSet.subIndex(*bIt->inside(), bIt->indexInInside(), 1);
+            
+            /** \todo We assume here that a coupling boundary consists of a single point only (not two)
+            */
+            interfaceCorrection[couplingName] = x[idx];
+        }
 
-        /** \todo Use the BoundaryPatch iterator, which will be a lot faster
-         * once we use EntitySeed for its implementation
-         * \todo We assume here that a coupling boundary consists of a single point only (not two)
-         */
-        for (size_t i=0; i<rhs.size(); i++)
-            if (interfaceBoundary.containsVertex(i))
-                interfaceCorrection[couplingName] = x[i];
     }
     
     return interfaceCorrection;
-- 
GitLab