From: denis.davydov Date: Sat, 26 Apr 2014 21:41:52 +0000 (+0000) Subject: another attempt to fix the bug X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9a06b9008214714a3ea80a027bdafbdcd9bc2b1;p=dealii-svn.git another attempt to fix the bug git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32847 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/dofs/dof_handler_policy.h b/deal.II/include/deal.II/dofs/dof_handler_policy.h index 3d207a3e44..6747ecbbc2 100644 --- a/deal.II/include/deal.II/dofs/dof_handler_policy.h +++ b/deal.II/include/deal.II/dofs/dof_handler_policy.h @@ -88,10 +88,10 @@ namespace internal * specified by the first argument. */ virtual - void + NumberCache renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache & number_cache) const = 0; + NumberCache & number_cache_current) const = 0; }; @@ -127,10 +127,10 @@ namespace internal * specified by the first argument. */ virtual - void + NumberCache renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache & number_cache) const; + NumberCache & number_cache_current) const; }; /** @@ -173,10 +173,10 @@ namespace internal * On renumbering, number_cache.locally_owned_dofs is updated consistently. */ virtual - void + NumberCache renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache & number_cache) const; + NumberCache & number_cache_current) const; }; @@ -213,10 +213,10 @@ namespace internal * specified by the first argument. */ virtual - void + NumberCache renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache &number_cache) const; + NumberCache &number_cache_current) const; }; } } diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index 0eeea16276..2b9cc1fb0d 100644 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@ -1286,7 +1286,7 @@ DoFHandler::renumber_dofs (const std::vectorrenumber_dofs (new_numbers, *this,number_cache); + number_cache = policy->renumber_dofs (new_numbers, *this,number_cache); } diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index e05e78c173..c5370a0e5f 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -928,15 +928,12 @@ namespace internal } template - void + NumberCache Sequential:: renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache &number_cache) const + NumberCache &number_cache_current) const { - //reset number cache. - number_cache = NumberCache (); - Implementation::renumber_dofs (new_numbers, IndexSet(0), dof_handler, true); @@ -946,6 +943,7 @@ namespace internal // have to set the elements // of the structure // appropriately anyway + NumberCache number_cache; number_cache.n_global_dofs = dof_handler.n_dofs(); number_cache.n_locally_owned_dofs = number_cache.n_global_dofs; @@ -962,6 +960,7 @@ namespace internal number_cache.locally_owned_dofs_per_processor = std::vector (1, number_cache.locally_owned_dofs); + return number_cache; } /* --------------------- class ParallelSequential ---------------- */ @@ -992,18 +991,18 @@ namespace internal } template - void + NumberCache ParallelShared:: renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache &number_cache) const + NumberCache &number_cache_current) const { - //reset number cache. - number_cache = NumberCache (); - - Sequential::renumber_dofs (new_numbers,dof_handler,number_cache); + NumberCache number_cache = Sequential::renumber_dofs (new_numbers,dof_handler,number_cache_current); + //update current number cache + number_cache_current = number_cache; //correct number_cache: number_cache.locally_owned_dofs = dealii::DoFTools::locally_owned_dofs_with_subdomain(dof_handler,dof_handler.get_tria().locally_owned_subdomain() ); + return number_cache; } /* --------------------- class ParallelDistributed ---------------- */ @@ -2435,17 +2434,16 @@ namespace internal template - void + NumberCache ParallelDistributed:: renumber_dofs (const std::vector &new_numbers, dealii::DoFHandler &dof_handler, - NumberCache &number_cache) const + NumberCache &number_cache_current) const { Assert (new_numbers.size() == dof_handler.locally_owned_dofs().n_elements(), ExcInternalError()); - //reset number cache. - number_cache = NumberCache (); + NumberCache number_cache; #ifndef DEAL_II_WITH_P4EST Assert (false, ExcNotImplemented()); @@ -2689,6 +2687,7 @@ namespace internal } #endif + return number_cache; } } }