From 745c4e5ff04d2d65df396d5163512d17cc378b9b Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 2 Nov 2008 23:21:38 +0000 Subject: [PATCH] Associate DoFs on interfaces between subdomains pseudo-randomly with the subdomains. This is done to better equilibrate the number of DoFs per subdomain even if the number of cells is already well equilibrated. git-svn-id: https://svn.dealii.org/trunk@17457 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/dofs/dof_tools.cc | 40 ++++++++++++++++++------ deal.II/doc/news/changes.h | 15 +++++++++ 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index 710cf47970..f1189af9a5 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -3710,11 +3710,17 @@ DoFTools::get_subdomain_association (const DH &dof_handler, std::vector local_dof_indices; local_dof_indices.reserve (max_dofs_per_cell(dof_handler)); - - // this function is similar to the - // make_sparsity_pattern function, - // see there for more information + // pseudo-randomly assign variables + // which lie on the interface + // between subdomains to each of + // the two or more + bool coin_flip = true; + + // loop over all cells and record + // which subdomain a DoF belongs + // to. toss a coin in case it is on + // an interface typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -3725,13 +3731,27 @@ DoFTools::get_subdomain_association (const DH &dof_handler, local_dof_indices.resize (dofs_per_cell); cell->get_dof_indices (local_dof_indices); - // set subdomain ids. if dofs already - // have their values set then they must - // be on partition interfaces. don't - // worry about that, just overwrite it + // set subdomain ids. if dofs + // already have their values + // set then they must be on + // partition interfaces. in + // that case randomly assign + // them to either the previous + // association or the current + // one, where we take "random" + // to be "once this way once + // that way" for (unsigned int i=0; i
    +
  1. +

    + Changed: The function DoFTools::get_subdomain_association function used + to assign degrees of freedom to the subdomain of the last cell on which + the degree of freedom is a part. This introduced a bias for degrees of + freedom's subdomains located on boundaries of subdomains, and + consequently to unequal numbers of DoFs per subdomain even if the + number of cells is roughly equal across subdomains. This behavior has + been changed by assigning degrees of freedom pseudo-randomly to any of + the subdomains on which they are located. This is a deviation from + previous behavior, however. +
    + (Timo Heister, WB 2008/11/02) +

    +
  2. Changed: The way we set up threads in the Threads::spawn functions -- 2.39.5