From: Mathias Anselmann Date: Tue, 4 Jun 2019 11:47:42 +0000 (+0200) Subject: changed extract_dofs so that it works in parallel X-Git-Tag: v9.2.0-rc1~1436^2~13 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=512346efc4c56ebfbc55c91886d345d1a029e484;p=dealii.git changed extract_dofs so that it works in parallel --- diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 0cb7e10617..c7665b4a25 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -451,40 +451,41 @@ namespace DoFTools const ComponentMask & component_mask, std::vector & selected_dofs) { - const FiniteElement &fe = dof.begin_active()->get_fe(); - (void)fe; - - Assert(component_mask.represents_n_components(fe.n_components()), + Assert(component_mask.represents_n_components( + dof.get_fe_collection().n_components()), ExcMessage( "The given component mask is not sized correctly to represent the " "components of the given finite element.")); - Assert(selected_dofs.size() == dof.n_dofs(), - ExcDimensionMismatch(selected_dofs.size(), dof.n_dofs())); + Assert(selected_dofs.size() == dof.n_locally_owned_dofs(), + ExcDimensionMismatch(selected_dofs.size(), + dof.n_locally_owned_dofs())); // two special cases: no component is selected, and all components are // selected; both rather stupid, but easy to catch - if (component_mask.n_selected_components(n_components(dof)) == 0) + if (component_mask.n_selected_components( + dof.get_fe_collection().n_components()) == 0) { - std::fill_n(selected_dofs.begin(), dof.n_dofs(), false); + std::fill_n(selected_dofs.begin(), dof.n_locally_owned_dofs(), false); return; } - else if (component_mask.n_selected_components(n_components(dof)) == - n_components(dof)) + else if (component_mask.n_selected_components( + dof.get_fe_collection().n_components()) == + dof.get_fe_collection().n_components()) { - std::fill_n(selected_dofs.begin(), dof.n_dofs(), true); + std::fill_n(selected_dofs.begin(), dof.n_locally_owned_dofs(), true); return; } // preset all values by false - std::fill_n(selected_dofs.begin(), dof.n_dofs(), false); + std::fill_n(selected_dofs.begin(), dof.n_locally_owned_dofs(), false); // get the component association of each DoF and then select the ones // that match the given set of components - std::vector dofs_by_component(dof.n_dofs()); + std::vector dofs_by_component(dof.n_locally_owned_dofs()); internal::get_component_association(dof, component_mask, dofs_by_component); - for (types::global_dof_index i = 0; i < dof.n_dofs(); ++i) + for (types::global_dof_index i = 0; i < dof.n_locally_owned_dofs(); ++i) if (component_mask[dofs_by_component[i]] == true) selected_dofs[i] = true; }