From c3844a7ea459d038f6983d658e0ccb73f4b7f49c Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 1 Nov 2012 19:06:34 +0000 Subject: [PATCH] Fix an inconsistency where after calling DoFHandler::clear() it still reported n_dofs()>0 etc. git-svn-id: https://svn.dealii.org/trunk@27291 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/dofs/number_cache.h | 5 +++++ deal.II/source/dofs/dof_handler.cc | 2 ++ deal.II/source/dofs/number_cache.cc | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/deal.II/include/deal.II/dofs/number_cache.h b/deal.II/include/deal.II/dofs/number_cache.h index 623b24ba97..670549558a 100644 --- a/deal.II/include/deal.II/dofs/number_cache.h +++ b/deal.II/include/deal.II/dofs/number_cache.h @@ -44,6 +44,11 @@ namespace internal */ std::size_t memory_consumption () const; + /** + * This function resets all the stored information. + */ + void clear (); + /** * Total number of dofs, * accumulated over all diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index 04a0624e41..afa53fe64e 100644 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@ -842,6 +842,8 @@ void DoFHandler::clear_space () std::vector tmp; std::swap (vertex_dofs, tmp); + + number_cache.clear (); } diff --git a/deal.II/source/dofs/number_cache.cc b/deal.II/source/dofs/number_cache.cc index d83663d5db..cc6e75e6e0 100644 --- a/deal.II/source/dofs/number_cache.cc +++ b/deal.II/source/dofs/number_cache.cc @@ -28,6 +28,14 @@ namespace internal {} + void NumberCache::clear () + { + n_global_dofs = 0; + n_locally_owned_dofs = 0; + locally_owned_dofs.clear(); + n_locally_owned_dofs_per_processor.clear(); + locally_owned_dofs_per_processor.clear(); + } std::size_t NumberCache::memory_consumption () const -- 2.39.5