From c7995750fdd077b7b6c9732267bc37a677f2800c Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Sat, 2 Apr 2011 18:28:43 +0000
Subject: [PATCH] damped update for more than a single coupling

[[Imported from SVN: r7065]]
---
 .../coupling/rodcontinuumfixedpointstep.hh    | 21 +++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/dune/gfe/coupling/rodcontinuumfixedpointstep.hh b/dune/gfe/coupling/rodcontinuumfixedpointstep.hh
index e09c5666..5ab435af 100644
--- a/dune/gfe/coupling/rodcontinuumfixedpointstep.hh
+++ b/dune/gfe/coupling/rodcontinuumfixedpointstep.hh
@@ -574,17 +574,26 @@ iterate(std::map<std::pair<std::string,std::string>, RigidBodyMotion<3> >& lambd
     //   Compute new damped interface value
     //////////////////////////////////////////////////////////////
     
-    std::pair<std::string,std::string> interfaceName = std::make_pair("rod","continuum");
-    
-    const RigidBodyMotion<dim>& referenceInterface = complex_.coupling(interfaceName).referenceInterface_;
+    typename std::map<std::pair<std::string,std::string>,RigidBodyMotion<3> >::iterator it = lambda.begin();
+    typename std::map<std::pair<std::string,std::string>, RigidBodyMotion<3> >::const_iterator aIIt = averageInterface.begin();
+
+    for (; it!=lambda.end(); ++it, ++aIIt) {
 
-    for (int j=0; j<dim; j++)
-        lambda[interfaceName].r[j] = (1-damping_) * lambda[interfaceName].r[j] 
-                                   + damping_ * (referenceInterface.r[j] + averageInterface[interfaceName].r[j]);
+        assert(it->first == aIIt->first);
+        
+        const std::pair<std::string,std::string>& interfaceName = it->first;
+        
+        const RigidBodyMotion<dim>& referenceInterface = complex_.coupling(interfaceName).referenceInterface_;
+
+        for (int j=0; j<dim; j++)
+            it->second.r[j] = (1-damping_) * it->second.r[j] 
+                                       + damping_ * (referenceInterface.r[j] + averageInterface[interfaceName].r[j]);
 
         lambda[interfaceName].q = Rotation<3,double>::interpolate(lambda[interfaceName].q, 
                                                        referenceInterface.q.mult(averageInterface[interfaceName].q), 
                                                        damping_);
+        
+    }
 
 }
 
-- 
GitLab