]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Optimize function. Modify testcase so that there is a row with more than one entry.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 16 Apr 2013 02:59:11 +0000 (02:59 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 16 Apr 2013 02:59:11 +0000 (02:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@29292 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/sparse_matrix.templates.h
tests/trilinos/sparse_matrix_copy_from_01.cc
tests/trilinos/sparse_matrix_copy_from_01/cmp/generic

index 2dbf6e0ee9bc68a762ffc5f5340cdd9420147fb3..ce97bbcaeee535bfed9abd0a126745c108b0734f 100644 (file)
@@ -385,10 +385,10 @@ SparseMatrix<number>::copy_from (const TrilinosWrappers::SparseMatrix &matrix)
       value_cache.resize(ncols);
       colnum_cache.resize(ncols);
 
-      // then copy everything
-      for (int i = 0; i < ncols; ++i)
-       this->set(row, colnum_cache[i],
-                 value_cache[i]);
+      // then copy everything in one swoop
+      this->set(row,
+               colnum_cache,
+               value_cache);
     }
 
   return *this;
index 7e305b72cfe728e1eafab102d73e2516b85f0cdb..5cd59506542698cb8e056e1230bbca26c37e2eb1 100644 (file)
@@ -35,6 +35,8 @@ int main (int argc,char **argv)
   SparsityPattern sparsity (5,5,5);
   sparsity.add (1,2);
   sparsity.add (2,3);
+  sparsity.add (3,2);
+  sparsity.add (3,3);
   sparsity.add (3,4);
   sparsity.add (4,3);
   sparsity.compress();
index 6a95ff5cf17b05e98206151ef1f9615f1f72f7ac..638836310ac3043af2f0018180b820d7856b1b3c 100644 (file)
@@ -3,8 +3,8 @@ DEAL::Original:
 1.000e+00                                              
            2.000e+00  3.000e+00                        
                       4.000e+00  5.000e+00             
-                                 6.000e+00  7.000e+00  
-                                 9.000e+00  8.000e+00  
+                      7.000e+00  6.000e+00  8.000e+00  
+                                 1.000e+01  9.000e+00  
 DEAL::Copy with all values:
 (0,0) 1.00000
 (1,1) 2.00000
@@ -12,6 +12,7 @@ DEAL::Copy with all values:
 (2,2) 4.00000
 (2,3) 5.00000
 (3,3) 6.00000
-(3,4) 7.00000
-(4,4) 8.00000
-(4,3) 9.00000
+(3,2) 7.00000
+(3,4) 8.00000
+(4,4) 9.00000
+(4,3) 10.0000

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.