From 3aa5ad53bf02a81963c8c368eba68861c4204d71 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Mon, 31 Jan 2011 08:55:08 +0000
Subject: [PATCH] use the BoundaryPatch iterator to iterate over boundary
 patches

[[Imported from SVN: r6902]]
---
 .../rodcontinuumsteklovpoincarestep.hh        | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh
index 152d592f..eb70e08e 100644
--- a/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh
+++ b/dune/gfe/coupling/rodcontinuumsteklovpoincarestep.hh
@@ -674,12 +674,19 @@ linearizedRodNeumannToDirichletMap(const std::string& rodName,
         // Use 'forceTorque' as a Neumann value for the rod
         const LeafBoundaryPatch<RodGridType>& interfaceBoundary = complex_.coupling(couplingName).rodInterfaceBoundary_;
 
-        /** \todo Use the BoundaryPatch iterator, which will be a lot faster
-         * once we use EntitySeed for its implementation
-         */
-        for (size_t i=0; i<rhs.size(); i++)
-            if (interfaceBoundary.containsVertex(i))
-                rhs[i] += localForceTorque;
+        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);
+
+            rhs[idx] += localForceTorque;
+
+        }
+
     }
         
     ///////////////////////////////////////////////////////////
-- 
GitLab