From: bangerth Date: Fri, 29 Aug 2008 02:16:16 +0000 (+0000) Subject: Improve copying cached data. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=769274731aed82ff2320687d140be06a2938e5ce;p=dealii-svn.git Improve copying cached data. git-svn-id: https://svn.dealii.org/trunk@16693 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index ab6d9e7acb..18222d8231 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -244,6 +244,14 @@ inconvenience this causes.

lac

    +
  1. +

    + Improved: The CompressedSparsityPattern can now elide some operations + upon entering entries that may have been added before already. +
    + (Timo Heister, WB 2008/08/28) +

    +
  2. Fixed: There are now functions CompressedSparsityPattern::print and diff --git a/deal.II/lac/source/compressed_sparsity_pattern.cc b/deal.II/lac/source/compressed_sparsity_pattern.cc index 44006ffcfc..c7bd346606 100644 --- a/deal.II/lac/source/compressed_sparsity_pattern.cc +++ b/deal.II/lac/source/compressed_sparsity_pattern.cc @@ -35,7 +35,7 @@ const unsigned int CompressedSparsityPattern::Line::cache_size; // Therefore, we require now, that the caller checks if this function // is necessary and only calls it, if it is actually used. Since it is -// it called less often, it is removed from the inlined section. +// called less often, it is removed from the inlined section. void CompressedSparsityPattern::Line::flush_cache () const { @@ -136,44 +136,52 @@ CompressedSparsityPattern::Line::flush_cache () const } // then allocate new memory and merge - // arrays - std::vector new_entries; - new_entries.reserve (n_new_entries); - unsigned int cache_position = 0; - unsigned int entry_position = 0; - while ((entry_position= entries.size(), + ExcInternalError()); + if (n_new_entries > entries.size()) + { + std::vector new_entries; + new_entries.reserve (n_new_entries); + unsigned int cache_position = 0; + unsigned int entry_position = 0; + while ((entry_position