]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Introduced copy operator = for basic Trilinos vectors.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Aug 2008 21:23:36 +0000 (21:23 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Aug 2008 21:23:36 +0000 (21:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@16645 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 611e1a766d69619153f943acd0505c80b197e2fc..a887ebc37dd6ebff1b29be6dccc7db71179d60d0 100755 (executable)
@@ -377,6 +377,13 @@ namespace TrilinosWrappers
                                        */
       void reinit (const Epetra_Map &input_map);
 
+                                      /** 
+                                       * Reinit functionality. This function
+                                       * copies the vector v to the current
+                                       * one.
+                                       */
+      void reinit (const Vector &v);
+
                                        /**
                                         * Release all memory and return
                                         * to a state just like after
@@ -417,6 +424,12 @@ namespace TrilinosWrappers
                                         */
       Vector & operator = (const TrilinosScalar s);
 
+                                       /**
+                                        * Copy the given vector. Resize the
+                                        * present vector if necessary.
+                                        */
+      Vector & operator = (const Vector &v);
+
                                        /**
                                         * Test for equality. This function
                                         * assumes that the present vector and
@@ -975,6 +988,19 @@ namespace TrilinosWrappers
 
 
 
+  inline
+  Vector &
+  Vector::operator = (const Vector &v)
+  {
+                                   // if the vectors have different sizes,
+                                   // then first resize the present one
+    reinit (v);
+    
+    return *this;
+  }
+
+
+
   inline
   internal::VectorReference
   Vector::operator () (const unsigned int index)
index d32be6fecddbfee1a1eae7f561d716d5ee007236..4cabc899b83fa51a8001db91b03f3c40123e3de4 100755 (executable)
@@ -100,6 +100,20 @@ namespace TrilinosWrappers
 
 
 
+  void
+  Vector::reinit (const Vector &v)
+  {
+    vector.reset();
+    
+    if (!map.SameAs(v.map))
+      map = v.map;
+    
+    vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(*v.vector));
+    last_action = Insert;
+  }
+
+
+
   void
   Vector::clear ()
   {

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.