From fd82625e710cf42186bfec39515165db793cf614 Mon Sep 17 00:00:00 2001
From: Daniel Arndt <d.arndt@math.uni-goettingen.de>
Date: Wed, 12 Mar 2014 13:29:25 +0000
Subject: [PATCH] Fixed some problems regarding Trilinos vectors with different
 maps

git-svn-id: https://svn.dealii.org/trunk@32642 0785d39b-7218-0410-832d-ea1e28bc413d
---
 .../deal.II/lac/trilinos_vector_base.h        | 46 +++++++++++--------
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git a/deal.II/include/deal.II/lac/trilinos_vector_base.h b/deal.II/include/deal.II/lac/trilinos_vector_base.h
index 84845480eb..9d5a7e3cfc 100644
--- a/deal.II/include/deal.II/lac/trilinos_vector_base.h
+++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h
@@ -1781,12 +1781,16 @@ namespace TrilinosWrappers
     else
     {
       (*this)*=s;
-      VectorBase tmp = v;
-      tmp *= a;
-      this->add(tmp, true);
-      tmp = w;
-      tmp *= b;
-      this->add(tmp, true);
+      {
+        VectorBase tmp = v;
+        tmp *= a;
+        this->add(tmp, true);
+      }
+      {
+        VectorBase tmp = w;
+        tmp *= b;
+        this->add(tmp, true);
+      }
     }
   }
 
@@ -1833,15 +1837,21 @@ namespace TrilinosWrappers
     else
     {
       (*this)*=s;
-      VectorBase tmp = v;
-      tmp *= a;
-      this->add(tmp, true);
-      tmp = w;
-      tmp *= b;
-      this->add(tmp, true);
-      tmp = x;
-      tmp *= c;
-      this->add(tmp, true);
+      {
+        VectorBase tmp = v;
+        tmp *= a;
+        this->add(tmp, true);
+      }
+      {
+        VectorBase tmp = w;
+        tmp *= b;
+        this->add(tmp, true);
+      }
+      {
+        VectorBase tmp = x;
+        tmp *= c;
+        this->add(tmp, true);
+      }
     }
   }
 
@@ -1876,8 +1886,7 @@ namespace TrilinosWrappers
     // If we don't have the same map, copy.
     if (vector->Map().SameAs(v.vector->Map())==false)
       {
-        *vector = *v.vector;
-        *this *= a;
+        this->sadd(0., a, v);
       }
     else
       {
@@ -1911,8 +1920,7 @@ namespace TrilinosWrappers
     // If we don't have the same map, copy.
     if (vector->Map().SameAs(v.vector->Map())==false)
       {
-        *vector = *v.vector;
-        sadd(a, b, w);
+        sadd(0., a, v, b, w);
       }
     else
       {
-- 
2.39.5