From 329b919b38e939a0bc272d6dc9f5e9bd12c82c4a Mon Sep 17 00:00:00 2001
From: Markus Blatt <mblatt@dune-project.org>
Date: Fri, 9 Dec 2005 11:38:16 +0000
Subject: [PATCH] Fixed flyspray bug:

http://hal.iwr.uni-heidelberg.de/flyspray/index.php?do=details&id=62

[[Imported from SVN: r3578]]
---
 istl/bvector.hh | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/istl/bvector.hh b/istl/bvector.hh
index 57f83fb4c..56c463a1d 100644
--- a/istl/bvector.hh
+++ b/istl/bvector.hh
@@ -745,7 +745,7 @@ namespace Dune {
 #ifdef DUNE_ISTL_WITH_CHECKING
       if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
 #endif
-      for (size_type i=0; i<this->n; ++i) (this->p)[i] += y[(this->j)[i]];
+      for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) += y.p[i];
       return *this;
     }
 
@@ -756,7 +756,7 @@ namespace Dune {
 #ifdef DUNE_ISTL_WITH_CHECKING
       if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
 #endif
-      for (size_type i=0; i<this->n; ++i) (this->p)[i] -= y[(this->j)[i]];
+      for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) -= y.p[i];
       return *this;
     }
 
@@ -767,7 +767,7 @@ namespace Dune {
 #ifdef DUNE_ISTL_WITH_CHECKING
       if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
 #endif
-      for (size_type i=0; i<this->n; ++i) (this->p)[i].axpy(a,y[(this->j)[i]]);
+      for (size_type i=0; i<y.n; ++i) (this->operator[](y.j[i])).axpy(a,y.p[i]);
       return *this;
     }
 
@@ -792,7 +792,8 @@ namespace Dune {
     field_type operator* (const compressed_block_vector_unmanaged& y) const
     {
 #ifdef DUNE_ISTL_WITH_CHECKING
-      if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
+      if (!includesindexset(y) || !y.includesindexset(*this) )
+        DUNE_THROW(ISTLError,"index set mismatch");
 #endif
       field_type sum=0;
       for (size_type i=0; i<this->n; ++i)
@@ -878,9 +879,9 @@ namespace Dune {
     template<class V>
     bool includesindexset (const V& y)
     {
-      typename V::ConstIterator e=y.end();
-      for (size_type i=0; i<this->n; i++)
-        if (y.find((this->j)[i])==e)
+      typename V::ConstIterator e=this->end();
+      for (size_type i=0; i<y.n; i++)
+        if (find(y.j[i])==e)
           return false;
       return true;
     }
-- 
GitLab