From 7d1e9f97cc2e81f43279c0fa8ee642d3a5585533 Mon Sep 17 00:00:00 2001 From: "denis.davydov" Date: Sun, 27 Apr 2014 15:41:40 +0000 Subject: [PATCH] made distribute_dofs() return NumberCache as it was originally git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32848 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/dofs/dof_handler_policy.h | 14 ++++++------- deal.II/source/dofs/dof_handler.cc | 2 +- deal.II/source/dofs/dof_handler_policy.cc | 21 ++++++++++++------- 3 files changed, 22 insertions(+), 15 deletions(-) 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 6747ecbbc2..9456dc491a 100644 --- a/deal.II/include/deal.II/dofs/dof_handler_policy.h +++ b/deal.II/include/deal.II/dofs/dof_handler_policy.h @@ -71,9 +71,9 @@ namespace internal * the object given as last argument. */ virtual - void + NumberCache distribute_dofs (dealii::DoFHandler &dof_handler, - NumberCache &number_cache) const = 0; + NumberCache &number_cache_current) const = 0; /** * Distribute the multigrid dofs on each level @@ -110,9 +110,9 @@ namespace internal * the object given as last argument. */ virtual - void + NumberCache distribute_dofs (dealii::DoFHandler &dof_handler, - NumberCache &number_cache) const; + NumberCache &number_cache_current) const; /** * Distribute multigrid DoFs. @@ -154,9 +154,9 @@ namespace internal * number_cache.locally_owned_dofs are updated consistently. */ virtual - void + NumberCache distribute_dofs (dealii::DoFHandler &dof_handler, - NumberCache & number_cache) const; + NumberCache & number_cache_current) const; /** * This function is not yet implemented. @@ -196,7 +196,7 @@ namespace internal * the object given as last argument. */ virtual - void + NumberCache distribute_dofs (dealii::DoFHandler &dof_handler, NumberCache &number_cache) const; diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index 2b9cc1fb0d..3198251d29 100644 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@ -1172,7 +1172,7 @@ void DoFHandler::distribute_dofs (const FiniteElementdistribute_dofs (*this,number_cache); + number_cache = policy->distribute_dofs (*this,number_cache); // initialize the block info object // only if this is a sequential diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index c5370a0e5f..c5d0aef91d 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -870,10 +870,10 @@ namespace internal template - void + NumberCache Sequential:: distribute_dofs (DoFHandler &dof_handler, - NumberCache & number_cache ) const + NumberCache & number_cache_current ) const { const types::global_dof_index n_dofs = Implementation::distribute_dofs (0, @@ -882,6 +882,7 @@ namespace internal // now set the elements of the // number cache appropriately + NumberCache number_cache; number_cache.n_global_dofs = n_dofs; number_cache.n_locally_owned_dofs = number_cache.n_global_dofs; @@ -898,6 +899,7 @@ namespace internal number_cache.locally_owned_dofs_per_processor = std::vector (1, number_cache.locally_owned_dofs); + return number_cache; } @@ -965,12 +967,14 @@ namespace internal /* --------------------- class ParallelSequential ---------------- */ template - void + NumberCache ParallelShared:: distribute_dofs (DoFHandler &dof_handler, - NumberCache & number_cache) const + NumberCache & number_cache_current) const { - Sequential::distribute_dofs (dof_handler,number_cache); + NumberCache number_cache = Sequential::distribute_dofs (dof_handler,number_cache_current); + //update current number cache in DoFHandler + number_cache_current = number_cache; DoFRenumbering::subdomain_wise (dof_handler); const parallel::shared::Triangulation *shared_tr = dynamic_cast*>(&dof_handler.get_tria()); const unsigned int n_mpi_processes = Utilities::MPI::n_mpi_processes( shared_tr->get_communicator () ); @@ -978,6 +982,7 @@ namespace internal for (unsigned int i=0; i @@ -1968,11 +1973,12 @@ namespace internal template - void + NumberCache ParallelDistributed:: distribute_dofs (DoFHandler &dof_handler, - NumberCache &number_cache) const + NumberCache &number_cache_current) const { + NumberCache number_cache; #ifndef DEAL_II_WITH_P4EST (void)dof_handler; @@ -2184,6 +2190,7 @@ namespace internal #endif // DEBUG #endif // DEAL_II_WITH_P4EST + return number_cache; } -- 2.39.5