]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Improve speed a little more by using add_entries in distributed version of Cuthill_Mc...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Feb 2014 08:02:52 +0000 (08:02 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Feb 2014 08:02:52 +0000 (08:02 +0000)
git-svn-id: https://svn.dealii.org/trunk@32549 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/full_matrix.h
deal.II/source/dofs/dof_renumbering.cc
deal.II/source/lac/lapack_full_matrix.cc
deal.II/source/lac/sparsity_pattern.cc

index fc5793e53e980655655567e65a9bdaa65964e17e..3ebef4e65398b8149efec8d0e2b088db23429f1a 100644 (file)
@@ -1195,7 +1195,7 @@ FullMatrix<number>::operator = (const number d)
   (void)d; // removes -Wunused-parameter warning in optimized mode
 
   if (this->n_elements() != 0)
-    std::memset (&this->values[0], 0, this->n_elements()*sizeof(number));
+    this->reset_values();
 
   return *this;
 }
index 2e8f6497d81fa3c1a6f14d9a466545c584e88479..d341ce93fcf6c3a1e175b9cedc70998269c0e3bf 100644 (file)
@@ -420,13 +420,17 @@ namespace DoFRenumbering
               row_lengths[i] = csp.row_length(locally_owned.nth_index_in_set(i));
             sparsity.reinit(locally_owned.n_elements(), locally_owned.n_elements(),
                             row_lengths);
+            std::vector<types::global_dof_index> row_entries;
             for (unsigned int i=0; i<locally_owned.n_elements(); ++i)
               {
                 const types::global_dof_index row = locally_owned.nth_index_in_set(i);
+                row_entries.resize(0);
                 for (CompressedSimpleSparsityPattern::row_iterator it =
                        csp.row_begin(row); it != csp.row_end(row); ++it)
                   if (*it != row && locally_owned.is_element(*it))
-                    sparsity.add(i, locally_owned.index_within_set(*it));
+                    row_entries.push_back(locally_owned.index_within_set(*it));
+                sparsity.add_entries(i, row_entries.begin(), row_entries.end(),
+                                     true);
               }
             sparsity.compress();
           }
index 2731f40777238d061361bc8d31863cc22338def8..2dec8d286173163aaa92f93a81022167492b584b 100644 (file)
@@ -93,7 +93,7 @@ LAPACKFullMatrix<number>::operator = (const double d)
   Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
 
   if (this->n_elements() != 0)
-    std::fill (this->values.begin(), this->values.end(), number());
+    this->reset_values();
 
   state = LAPACKSupport::matrix;
   return *this;
@@ -551,6 +551,7 @@ LAPACKFullMatrix<number>::apply_lu_factorization(Vector<number> &v,
   Assert(state == lu, ExcState(state));
   Assert(this->n_rows() == this->n_cols(),
          LACExceptions::ExcNotQuadratic());
+  AssertDimension(this->n_rows(), v.size());
 
   const char *trans = transposed ? &T : &N;
   const int nn = this->n_cols();
@@ -573,6 +574,7 @@ LAPACKFullMatrix<number>::apply_lu_factorization(LAPACKFullMatrix<number> &B,
   Assert(state == lu, ExcState(state));
   Assert(B.state == matrix, ExcState(state));
   Assert(this->n_rows() == this->n_cols(), LACExceptions::ExcNotQuadratic());
+  AssertDimension(this->n_rows(), B.n_rows());
 
   const char *trans = transposed ? &T : &N;
   const int nn = this->n_cols();
index 63841efa320c0c5eba81d2eb8a0d43e61cef4bdc..3db6cd5c21c314e697c15687b37b7167c222e3d2 100644 (file)
@@ -789,7 +789,8 @@ SparsityPattern::add_entries (const size_type row,
         {
           ForwardIterator it = begin;
           bool has_larger_entries = false;
-          std::size_t k=rowstart[row];
+          // skip diagonal
+          std::size_t k=rowstart[row]+store_diagonal_first_in_row;
           for ( ; k<rowstart[row+1]; k++)
             if (colnums[k] == invalid_entry)
               break;

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.