]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Improve copy_from function a bit more.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Apr 2009 11:29:50 +0000 (11:29 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Apr 2009 11:29:50 +0000 (11:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@18621 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/source/sparsity_pattern.cc

index 32a18e56876bd9e9739753477542973152ef82b6..4ea77db4a2e82bd328753b68a4e9c91bbced877e 100644 (file)
@@ -585,9 +585,10 @@ SparsityPattern::copy_from (const CompressedSparsityPattern &csp,
   for (unsigned int row = 0; row<csp.n_rows(); ++row)
     {
       unsigned int *cols = &colnums[rowstart[row]] + (is_square ? 1 : 0);
-      for (unsigned int j=0; j<csp.row_length(row); ++j)
-       {
-         const unsigned int col = csp.column_number(row,j);
+      const unsigned int row_length = csp.row_length(row);
+      for (unsigned int j=0; j<row_length; ++j)
+        {
+          const unsigned int col = csp.column_number(row,j);
          Assert (col < csp.n_cols(), ExcInvalidIndex(col,csp.n_cols()));
          
          if ((col!=row) || !is_square)
@@ -644,7 +645,7 @@ SparsityPattern::copy_from (const CompressedSetSparsityPattern &csp,
       for (; col_num != csp.row_end (row); ++col_num)
        {
          const unsigned int col = *col_num;
-         //      Assert (col < csp.n_cols(), ExcInvalidIndex(col,csp.n_cols()));
+         //Assert (col < csp.n_cols(), ExcInvalidIndex(col,csp.n_cols()));
          
          if ((col!=row) || !is_square)
            *cols++ = col;
@@ -655,7 +656,6 @@ SparsityPattern::copy_from (const CompressedSetSparsityPattern &csp,
                                   // pattern since we already have
                                   // allocated the right amount of data,
                                   // and the CSP data is sorted, too.
-  //compress ();
   compressed = true;
 }
 
@@ -694,9 +694,10 @@ SparsityPattern::copy_from (const CompressedSimpleSparsityPattern &csp,
   for (unsigned int row = 0; row<csp.n_rows(); ++row)
     {
       unsigned int *cols = &colnums[rowstart[row]] + (is_square ? 1 : 0);
-      for (unsigned int j=0; j<csp.row_length(row); ++j)
-        {
-          const unsigned int col = csp.column_number(row,j);
+      const unsigned int row_length = csp.row_length(row);
+      for (unsigned int j=0; j<row_length; ++j)
+       {
+         const unsigned int col = csp.column_number(row,j);
           Assert (col < csp.n_cols(), ExcInvalidIndex(col,csp.n_cols()));
 
           if ((col!=row) || !is_square)

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.