]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Now the transfer from distributed to localized vector seems to work properly.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Sep 2008 14:30:24 +0000 (14:30 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Sep 2008 14:30:24 +0000 (14:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@16818 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/trilinos_sparse_matrix.h
deal.II/lac/include/lac/trilinos_vector.h
deal.II/lac/source/trilinos_vector.cc

index 18359e99c098fd0c5775fb422ce40fd58ea754db..da91f09ee92c26fbee074bef3c26b9596e4f3fc3 100755 (executable)
@@ -453,7 +453,7 @@ namespace TrilinosWrappers
                                        * reference to <tt>*this</tt>.
                                        */
       SparseMatrix &
-      copy_from (const SparseMatrix &source);
+       copy_from (const SparseMatrix &source);
 
                                        /**
                                         * This function initializes
@@ -657,7 +657,7 @@ namespace TrilinosWrappers
                                         * pattern previously used.
                                         */
       SparseMatrix &
-      operator = (const double d);
+       operator = (const double d);
 
                                        /**
                                         * Set the element (<i>i,j</i>)
@@ -876,13 +876,14 @@ namespace TrilinosWrappers
                                         * Return the
                                         * <i>l</i><sub>1</sub>-norm of
                                         * the matrix, that is
-                                        * $|M|_1=\max_{\mathrm{all
-                                        * columns} j}\sum_{\mathrm{all
-                                        * rows} i} |M_{ij}|$, (max. sum
+                                        * $|M|_1=
+                                       * \max_{\mathrm{all columns } j}
+                                       * \sum_{\mathrm{all rows } i} 
+                                       * |M_{ij}|$, (max. sum
                                         * of columns).  This is the
                                         * natural matrix norm that is
                                         * compatible to the l1-norm for
-                                        * vectors, i.e.  $|Mv|_1\leq
+                                        * vectors, i.e.  $|Mv|_1 \leq
                                         * |M|_1 |v|_1$.
                                         * (cf. Haemmerlin-Hoffmann:
                                         * Numerische Mathematik)
index a3f9c2c1de95c107921693a2892a320ca1b43bb8..0dc2a135559bcf88033423facae3292d00fbcb1e 100755 (executable)
@@ -454,7 +454,23 @@ namespace TrilinosWrappers
                                         * necessary.
                                         */
       Vector &
-       operator = (const Vector &v);
+       operator = (const Vector &V);
+
+                                       /**
+                                       * Copy operator from a given
+                                       * localized vector (present on
+                                       * all processes) in
+                                       * TrilinosWrappers format to the
+                                       * current distributed
+                                       * vector. This function assumes
+                                       * that the calling vector (left
+                                       * hand object) already is of the
+                                       * same size as the right hand
+                                       * side vector. Otherwise, an
+                                       * exception will be thrown.
+                                       */
+      Vector &
+       operator = (const LocalizedVector &V);
 
                                        /**
                                        * Another copy function. This
@@ -991,6 +1007,7 @@ namespace TrilinosWrappers
                                         * friend.
                                         */
       friend class internal::VectorReference;
+      friend class LocalizedVector;
 
   };
 
@@ -1005,7 +1022,7 @@ namespace TrilinosWrappers
  * @see @ref SoftwareTrilinos
  * @author Martin Kronbichler, 2008
  */
-  class LocalizedVector : Vector
+  class LocalizedVector : public Vector
   {
     public:
                                        /**
@@ -1089,6 +1106,8 @@ namespace TrilinosWrappers
 
     public:
       std::auto_ptr<Epetra_MultiVector> vector;
+
+      friend class Vector;
   };
 
 
index d59d0235c3eeb20accdfdb20b925326c98ad7840..cfc62b919fea35a71e78dbae6b7379725a53f9dd 100755 (executable)
@@ -18,6 +18,9 @@
 
 #ifdef DEAL_II_USE_TRILINOS
 
+#include <Epetra_Import.h>
+
+
 DEAL_II_NAMESPACE_OPEN
 
 namespace TrilinosWrappers
@@ -161,6 +164,22 @@ namespace TrilinosWrappers
   }
 
 
+
+  Vector &
+  Vector::operator = (const LocalizedVector &v)
+  {
+    Assert (size() == v.size(), ExcDimensionMismatch(size(), v.size()));
+
+    Epetra_Import import_information (map, v.map);
+    const int ierr = vector->Import(*v.vector, import_information, Insert);
+
+    Assert (ierr == 0, ExcTrilinosError(ierr));
+
+    return *this;
+  }
+
+
+
   Vector &
   Vector::operator = (const ::dealii::Vector<double> &v)
   {
@@ -954,9 +973,14 @@ namespace TrilinosWrappers
   LocalizedVector::reinit (const Vector &v)
   {
     map = Epetra_LocalMap (v.size(),0,v.vector->Comm());
+
+    Epetra_Import import_information (map, v.map);
+
     vector = std::auto_ptr<Epetra_MultiVector> 
                       (new Epetra_MultiVector (map,1,false));
-    *vector = *v.vector;
+
+    int ierr = vector->Import(*v.vector, import_information, Insert);
+    Assert (ierr == 0, ExcTrilinosError(ierr));
   }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.