From: Jean-Paul Pelteret Date: Fri, 25 Sep 2015 15:11:12 +0000 (+0200) Subject: Added assert for p::d::Triangulation and removed if statement. X-Git-Tag: v8.4.0-rc2~358^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a096cd505c39dfd1c5ae7227ad2608c302bac4e;p=dealii.git Added assert for p::d::Triangulation and removed if statement. Assert was added in both DoFTools::locally_owned_dofs_per_subdomain and DoFTools::locally_relevant_dofs_per_subdomain . --- diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 16c0e42cd9..ba91a5ecc0 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -1079,6 +1079,16 @@ namespace DoFTools std::vector locally_owned_dofs_per_subdomain (const DH &dof_handler) { + // If the Triangulation is distributed, the only thing we can usefully + // ask is for its locally owned subdomain + Assert ((dynamic_cast *> + (&dof_handler.get_tria()) == 0), + ExcMessage ("For parallel::distributed::Triangulation objects and " + "associated DoF handler objects, asking for any information " + "related to a subdomain other than the locally owned one does " + "not make sense.")); + //the following is a random process (flip of a coin), thus should be called once only. std::vector< dealii::types::subdomain_id > subdomain_association (dof_handler.n_dofs ()); dealii::DoFTools::get_subdomain_association (dof_handler, subdomain_association); @@ -1128,6 +1138,16 @@ namespace DoFTools std::vector locally_relevant_dofs_per_subdomain (const DH &dof_handler) { + // If the Triangulation is distributed, the only thing we can usefully + // ask is for its locally owned subdomain + Assert ((dynamic_cast *> + (&dof_handler.get_tria()) == 0), + ExcMessage ("For parallel::distributed::Triangulation objects and " + "associated DoF handler objects, asking for any information " + "related to a subdomain other than the locally owned one does " + "not make sense.")); + // Collect all the locally owned DoFs // Note: Even though the distribution of DoFs by the locally_owned_dofs_per_subdomain // function is pseudo-random, we will collect all the DoFs on the subdomain @@ -1165,8 +1185,7 @@ namespace DoFTools for (std::vector::iterator it=local_dof_indices.begin(); it!=local_dof_indices.end(); ++it) - if (!dof_set[subdomain_id].is_element(*it)) - subdomain_halo_global_dof_indices.insert(*it); + subdomain_halo_global_dof_indices.insert(*it); } dof_set[subdomain_id].add_indices(subdomain_halo_global_dof_indices.begin(),