]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix copy of matrix values.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 6 Dec 2010 13:55:13 +0000 (13:55 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 6 Dec 2010 13:55:13 +0000 (13:55 +0000)
git-svn-id: https://svn.dealii.org/trunk@22927 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/trilinos_sparse_matrix.cc

index 7e5f2167a16e80471a802355d4a77010be6f3ca3..d1856fd101aab89cd6d6a05caec4584349b32e66 100644 (file)
@@ -678,11 +678,13 @@ namespace TrilinosWrappers
 
     if (copy_values == true)
       {
+                               // point to the first data entry in the two
+                               // matrices and copy the content
        const TrilinosScalar * in_values = input_matrix[0];
        TrilinosScalar * values = (*matrix)[0];
        const unsigned int my_nonzeros = input_matrix.NumMyNonzeros();
-       for (unsigned int i=0; i<my_nonzeros; ++i)
-         values[i] = in_values[0];
+       std::memcpy (&values[0], &in_values[0],
+                    my_nonzeros*sizeof (TrilinosScalar));
       }
 
     compress();

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.