From: heister Date: Mon, 1 Oct 2012 15:23:44 +0000 (+0000) Subject: merge from mainline X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f33529ca6da777b29784f3b4d2fd294b745bee8;p=dealii-svn.git merge from mainline git-svn-id: https://svn.dealii.org/branches/branch_merge_mg_into_dof_handler@26912 0785d39b-7218-0410-832d-ea1e28bc413d --- 3f33529ca6da777b29784f3b4d2fd294b745bee8 diff --cc deal.II/include/deal.II/dofs/dof_tools.h index 1c568de5b5,3565e81af0..5c71d01791 --- a/deal.II/include/deal.II/dofs/dof_tools.h +++ b/deal.II/include/deal.II/dofs/dof_tools.h @@@ -1234,22 -1250,61 +1250,61 @@@ namespace DoFTool template void extract_dofs (const hp::DoFHandler &dof_handler, - const std::vector &select, - std::vector &selected_dofs, - const bool blocks = false); + const ComponentMask &component_mask, + std::vector &selected_dofs); - /** - * Do the same thing as - * extract_dofs() for one level - * of a multi-grid DoF numbering. - */ + /** + * This function is the equivalent to the DoFTools::extract_dofs() functions above + * except that the selection of which degrees of freedom to extract is not done + * based on components (see @ref GlossComponent) but instead based on whether they + * are part of a particular block (see @ref GlossBlock). Consequently, the second + * argument is not a ComponentMask but a BlockMask object. + * + * @param dof_handler The DoFHandler object from which to extract degrees of freedom + * @param block_mask The block mask that describes which blocks to consider (see + * @ref GlossBlockMask) + * @param selected_dofs A vector of length DoFHandler::n_dofs() in which those + * entries are true that correspond to the selected blocks. + */ + template + void + extract_dofs (const DoFHandler &dof_handler, + const BlockMask &block_mask, + std::vector &selected_dofs); + + /** + * The same function as above, + * but for a hp::DoFHandler. + */ + template + void + extract_dofs (const hp::DoFHandler &dof_handler, + const BlockMask &block_mask, + std::vector &selected_dofs); + + /** + * Do the same thing as the corresponding + * extract_dofs() functino for one level + * of a multi-grid DoF numbering. + */ - template ++ template + void + extract_level_dofs (const unsigned int level, - const MGDoFHandler &dof, ++ const DH &dof, + const ComponentMask &component_mask, + std::vector &selected_dofs); + + /** + * Do the same thing as the corresponding + * extract_dofs() functino for one level + * of a multi-grid DoF numbering. + */ - template + template void extract_level_dofs (const unsigned int level, - const MGDoFHandler &dof, + const DH &dof, - const std::vector &select, - std::vector &selected_dofs, - const bool blocks = false); + const BlockMask &component_mask, + std::vector &selected_dofs); /** * Extract all degrees of freedom diff --cc deal.II/include/deal.II/multigrid/mg_constrained_dofs.h index 4288c6d92c,e011893a8e..5b90025982 --- a/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h +++ b/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h @@@ -59,14 -58,9 +59,14 @@@ class MGConstrainedDoFs : public Subscr */ template void initialize(const MGDoFHandler& dof, - const typename FunctionMap::type& function_map, - const std::vector& component_mask = std::vector()); + const typename FunctionMap::type& function_map, + const ComponentMask &component_mask = ComponentMask()); + template + void initialize(const DoFHandler& dof, + const typename FunctionMap::type& function_map, + const std::vector& component_mask = std::vector()); + /** * Reset the data structures. */ diff --cc deal.II/source/dofs/dof_handler.cc index 2bbf7f7c5b,1d4cacf434..ca50bf37d3 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@@ -1137,15 -714,15 +1044,15 @@@ DoFHandler::last_active_f switch (dim) { case 1: - Assert (false, ExcImpossibleInDim(1)); - return raw_face_iterator(); + Assert (false, ExcImpossibleInDim(1)); + return raw_face_iterator(); case 2: - return last_active_line (); + return last_active_line (); case 3: - return last_active_quad (); + return last_active_quad (); default: - Assert (false, ExcNotImplemented()); - return raw_face_iterator (); + Assert (false, ExcNotImplemented()); + return face_iterator (); } } @@@ -1155,30 -741,34 +1071,32 @@@ DoFHandler::begin_raw_lin template - typename DoFHandler::raw_line_iterator - DoFHandler::begin_raw_line (const unsigned int level) const + typename DoFHandler::line_iterator + DoFHandler::begin_line (const unsigned int level) const { - Assert(tria != 0, ExcNotInitialized()); - switch (dim) - { - case 1: - Assert (leveln_levels(), ExcInvalidLevel(level)); + typename Triangulation::line_iterator ti = tria->begin_line(level); + typename DoFHandler::line_iterator ri(*ti, this); + return ri; + } - if (tria->n_raw_lines(level) == 0) - return end_line (); - - + template + typename DoFHandler::active_line_iterator + DoFHandler::begin_active_line (const unsigned int level) const + { + typename Triangulation::active_line_iterator ti = tria->begin_active_line(level); + typename DoFHandler::active_line_iterator ri(*ti, this); + return ri; + } - return raw_line_iterator (tria, - level, - 0, - this); - default: - Assert (level == 0, ExcFacesHaveNoLevel()); - return raw_line_iterator (tria, - 0, - 0, - this); - } + + template + typename DoFHandler::raw_line_iterator + DoFHandler::end_raw_line (const unsigned int level) const + { + typename Triangulation::raw_line_iterator ti = tria->end_raw_line(level); + typename DoFHandler::raw_line_iterator ri(ti.access_any(), this); + return ri; } diff --cc deal.II/source/dofs/dof_tools.cc index a10b59bcf2,a955d6d26b..20805db545 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@@ -3361,16 -3344,19 +3344,19 @@@ namespace DoFTool face_1->get_dof_indices(dofs_1, face_1_index); face_2->get_dof_indices(dofs_2, face_2_index); - // .. and constrain them (respecting - // component_mask): + // .. and constrain them (respecting + // component_mask): for (unsigned int i = 0; i < dofs_per_face; ++i) { - if (component_mask.size() == 0 || - component_mask[fe.face_system_to_component_index(i).first]) { - if(!constraint_matrix.is_constrained(dofs_1[i])) { - constraint_matrix.add_line(dofs_1[i]); - constraint_matrix.add_entry(dofs_1[i], dofs_2[i], 1.0); + if ((component_mask.n_selected_components(fe.n_components()) == fe.n_components()) + || + (component_mask[fe.face_system_to_component_index(i).first] == true)) + { + if(!constraint_matrix.is_constrained(dofs_1[i])) + { + constraint_matrix.add_line(dofs_1[i]); + constraint_matrix.add_entry(dofs_1[i], dofs_2[i], 1.0); + } } - } } } @@@ -3399,9 -3385,9 +3385,9 @@@ const types::boundary_id boundary_component, const int direction, dealii::Tensor<1,DH::space_dimension> - &offset, + &offset, dealii::ConstraintMatrix &constraint_matrix, - const std::vector &component_mask) + const ComponentMask &component_mask) { static const int space_dim = DH::space_dimension; Assert (0<=direction && direction + void + extract_dofs (const DoFHandler &dof, + const BlockMask &block_mask, + std::vector &selected_dofs) + { + // simply forward to the function that works based on a component mask + extract_dofs (dof, dof.get_fe().component_mask (block_mask), + selected_dofs); + } + + + + template + void + extract_dofs (const hp::DoFHandler &dof, + const BlockMask &block_mask, + std::vector &selected_dofs) + { + // simply forward to the function that works based on a component mask + extract_dofs (dof, dof.get_fe().component_mask (block_mask), + selected_dofs); + } + + + - template + template void - extract_level_dofs( - const unsigned int level, - const DH &dof, - const std::vector &component_select, - std::vector &selected_dofs, - const bool count_by_blocks) + extract_level_dofs(const unsigned int level, - const MGDoFHandler &dof, ++ const DH &dof, + const ComponentMask &component_mask, + std::vector &selected_dofs) { - const FiniteElement& fe = dof.get_fe(); + const FiniteElement& fe = dof.get_fe(); - if (count_by_blocks == true) - { - Assert(component_select.size() == fe.n_blocks(), - ExcDimensionMismatch(component_select.size(), fe.n_blocks())); - } - else - { - Assert(component_select.size() == fe.n_components(), - ExcDimensionMismatch(component_select.size(), fe.n_components())); - } - + Assert(component_mask.represents_n_components(n_components(dof)), + 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(level), ExcDimensionMismatch(selected_dofs.size(), dof.n_dofs(level))); @@@ -3902,8 -3914,8 +3914,8 @@@ // then loop over all cells and do // work std::vector indices(fe.dofs_per_cell); - typename MGDoFHandler::cell_iterator c; - for (c = dof.begin(level) ; c != dof.end(level) ; ++ c) + typename DH::cell_iterator c; - for (c = dof.begin(level) ; c != dof.end(level) ; ++ c) ++ for (c = dof.begin(level) ; c != dof.end(level) ; ++ c) { c->get_mg_dof_indices(indices); for (unsigned int i=0; i ++ template + void + extract_level_dofs(const unsigned int level, - const MGDoFHandler &dof, ++ const DH &dof, + const BlockMask &block_mask, + std::vector &selected_dofs) + { + // simply defer to the other extract_level_dofs() function + extract_level_dofs (level, dof, dof.get_fe().component_mask(block_mask), + selected_dofs); + } + + + template void extract_boundary_dofs (const DH &dof_handler, @@@ -3928,10 -3954,10 +3954,10 @@@ "See the documentation for more information.")); IndexSet indices; - extract_boundary_dofs (dof_handler, component_select, + extract_boundary_dofs (dof_handler, component_mask, indices, boundary_indicators); - // clear and reset array by default values + // clear and reset array by default values selected_dofs.clear (); selected_dofs.resize (dof_handler.n_dofs(), false); @@@ -4008,44 -4037,44 +4037,44 @@@ if (!check_vector_component) selected_dofs.add_index (face_dof_indices[i]); else - // check for - // component is - // required. somewhat - // tricky as usual - // for the case that - // the shape function - // is non-primitive, - // but use usual - // convention (see - // docs) + // check for + // component is + // required. somewhat + // tricky as usual + // for the case that + // the shape function + // is non-primitive, + // but use usual + // convention (see + // docs) { - // first get at the - // cell-global - // number of a face - // dof, to ask the - // fe certain - // questions + // first get at the + // cell-global + // number of a face + // dof, to ask the + // fe certain + // questions const unsigned int cell_index - = (dim == 1 ? - i - : - (dim == 2 ? - (i<2*fe.dofs_per_vertex ? i : i+2*fe.dofs_per_vertex) + = (dim == 1 ? + i + : + (dim == 2 ? + (i<2*fe.dofs_per_vertex ? i : i+2*fe.dofs_per_vertex) + : + (dim == 3 ? + (i<4*fe.dofs_per_vertex ? + i : - (dim == 3 ? - (i<4*fe.dofs_per_vertex ? - i - : - (i<4*fe.dofs_per_vertex+4*fe.dofs_per_line ? - i+4*fe.dofs_per_vertex - : - i+4*fe.dofs_per_vertex+8*fe.dofs_per_line)) - : - numbers::invalid_unsigned_int))); + (i<4*fe.dofs_per_vertex+4*fe.dofs_per_line ? + i+4*fe.dofs_per_vertex + : + i+4*fe.dofs_per_vertex+8*fe.dofs_per_line)) + : + numbers::invalid_unsigned_int))); if (fe.is_primitive (cell_index)) { - if (component_select[fe.face_system_to_component_index(i).first] + if (component_mask[fe.face_system_to_component_index(i).first] - == true) + == true) selected_dofs.add_index (face_dof_indices[i]); } else // not primitive diff --cc deal.II/source/dofs/dof_tools.inst.in index 206641e784,b0f889f3f6..68536b3d24 --- a/deal.II/source/dofs/dof_tools.inst.in +++ b/deal.II/source/dofs/dof_tools.inst.in @@@ -425,15 -431,25 +431,37 @@@ template void DoFTools::extract_dofs (const hp::DoFHandler&, - const std::vector&, std::vector&, bool); + const ComponentMask &, + std::vector&); + + template void DoFTools::extract_dofs + (const hp::DoFHandler&, + const BlockMask &, + std::vector&); + -template void DoFTools::extract_level_dofs ++template void DoFTools::extract_level_dofs > ++(const unsigned int level, ++ const DoFHandler&, ++ const ComponentMask &, ++ std::vector&); + +template void DoFTools::extract_level_dofs > - (const unsigned int, const DoFHandler&, - const std::vector&, std::vector&, bool); ++(const unsigned int level, ++ const DoFHandler&, ++ const BlockMask &, ++ std::vector&); + +template void DoFTools::extract_level_dofs > - (const unsigned int, const MGDoFHandler&, - const std::vector&, std::vector&, bool); + (const unsigned int level, + const MGDoFHandler&, + const ComponentMask &, + std::vector&); + -template void DoFTools::extract_level_dofs ++template void DoFTools::extract_level_dofs > + (const unsigned int level, + const MGDoFHandler&, + const BlockMask &, + std::vector&); template void @@@ -734,15 -750,19 +762,19 @@@ DoFTools::count_dofs_per_component +DoFTools::extract_level_dofs > - (const unsigned int, const DoFHandler&, - const std::vector&, std::vector&, bool); + (const unsigned int level, - const MGDoFHandler&, ++ const DoFHandler&, + const ComponentMask&, + std::vector&); template void -DoFTools::extract_level_dofs +DoFTools::extract_level_dofs > - (const unsigned int, const MGDoFHandler&, - const std::vector&, std::vector&, bool); + (const unsigned int level, + const MGDoFHandler&, + const BlockMask&, + std::vector&); #endif @@@ -762,15 -782,19 +794,19 @@@ DoFTools::count_dofs_per_component +DoFTools::extract_level_dofs > - (const unsigned int, const DoFHandler<1, 3>&, - const std::vector&, std::vector&, bool); + (const unsigned int level, - const MGDoFHandler<1,3>&, ++ const DoFHandler<1,3>&, + const ComponentMask &, + std::vector&); template void -DoFTools::extract_level_dofs<1,3> +DoFTools::extract_level_dofs > - (const unsigned int, const MGDoFHandler<1, 3>&, - const std::vector&, std::vector&, bool); + (const unsigned int level, + const MGDoFHandler<1,3>&, + const BlockMask &, + std::vector&); #endif diff --cc deal.II/source/multigrid/mg_tools.cc index c81d632032,15d96c3c86..7d2e640eba --- a/deal.II/source/multigrid/mg_tools.cc +++ b/deal.II/source/multigrid/mg_tools.cc @@@ -30,9 -30,9 +30,10 @@@ #include #include #include +#include #include #include + #include #include #include @@@ -977,60 -978,61 +978,61 @@@ namespace MGTool // otherwise determine the number // of dofs in each component // separately. do so in parallel - std::vector > - dofs_in_component (n_components, - std::vector(dof_handler.n_dofs(l), - false)); - std::vector > - component_select (n_components, - std::vector(n_components, false)); - Threads::TaskGroup<> tasks; - for (unsigned int i=0; i &, - const std::vector &, - std::vector &, - bool) - = &DoFTools::template extract_level_dofs >; - component_select[i][i] = true; - tasks += Threads::new_task (fun_ptr, - l, dof_handler, - component_select[i], - dofs_in_component[i], false); - } - tasks.join_all(); + std::vector > + dofs_in_component (n_components, + std::vector(dof_handler.n_dofs(l), + false)); + std::vector component_select (n_components); + Threads::TaskGroup<> tasks; + for (unsigned int i=0; i &, + const ComponentMask &, + std::vector &) - = &DoFTools::template extract_level_dofs; ++ = &DoFTools::template extract_level_dofs >; + + std::vector tmp(n_components, false); + tmp[i] = true; + component_select[i] = ComponentMask(tmp); + + tasks += Threads::new_task (fun_ptr, + l, dof_handler, + component_select[i], + dofs_in_component[i]); + } + tasks.join_all(); // next count what we got - unsigned int component = 0; - for (unsigned int b=0;b& base = fe.base_element(b); + unsigned int component = 0; + for (unsigned int b=0;b& base = fe.base_element(b); // Dimension of base element - unsigned int d = base.n_components(); - - for (unsigned int m=0;m > - dofs_in_block (n_blocks, std::vector(dof_handler.n_dofs(l), false)); + dofs_in_block (n_blocks, std::vector(dof_handler.n_dofs(l), false)); - std::vector > - block_select (n_blocks, std::vector(n_blocks, false)); + std::vector block_select (n_blocks); Threads::TaskGroup<> tasks; for (unsigned int i=0; i&, - std::vector&, - bool) - = &DoFTools::template extract_level_dofs; - block_select[i][i] = true; - tasks += Threads::new_task (fun_ptr, - l, dof_handler, block_select[i], - dofs_in_block[i], true); - }; + { + void (*fun_ptr) (const unsigned int level, - const MGDoFHandler&, ++ const DH&, + const BlockMask &, + std::vector&) - = &DoFTools::template extract_level_dofs; ++ = &DoFTools::template extract_level_dofs; + + std::vector tmp(n_blocks, false); + tmp[i] = true; + block_select[i] = tmp; + + tasks += Threads::new_task (fun_ptr, + l, dof_handler, block_select[i], + dofs_in_block[i]); + } tasks.join_all (); // next count what we got @@@ -1179,58 -1184,59 +1183,59 @@@ std::vector local_dofs; local_dofs.reserve (DoFTools::max_dofs_per_face(dof)); - std::fill (local_dofs.begin (), local_dofs.end (), + std::fill (local_dofs.begin (), + local_dofs.end (), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); // First, deal with the simpler // case when we have to identify // all boundary dofs - if (component_mask.size() == 0) + if (component_mask.n_selected_components(n_components) == n_components) { typename MGDoFHandler::cell_iterator - cell = dof.begin(), - endc = dof.end(); + cell = dof.begin(), + endc = dof.end(); for (; cell!=endc; ++cell) - { - const FiniteElement &fe = cell->get_fe(); - const unsigned int level = cell->level(); - local_dofs.resize(fe.dofs_per_face); - - for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; - ++face_no) - if (cell->at_boundary(face_no) == true) - { - const typename MGDoFHandler::face_iterator - face = cell->face(face_no); - const types::boundary_id bi = face->boundary_indicator(); + { + const FiniteElement &fe = cell->get_fe(); + const unsigned int level = cell->level(); + local_dofs.resize(fe.dofs_per_face); + + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + if (cell->at_boundary(face_no) == true) + { + const typename MGDoFHandler::face_iterator + face = cell->face(face_no); + const types::boundary_id bi = face->boundary_indicator(); // Face is listed in // boundary map - if (function_map.find(bi) != function_map.end()) - { - face->get_mg_dof_indices(level, local_dofs); - for (unsigned int i=0;iget_mg_dof_indices(level, local_dofs); + for (unsigned int i=0;i 0, + Assert (component_mask.n_selected_components(n_components) > 0, - ExcMessage("It's probably worthwhile to select at least one component.")); + ExcMessage("It's probably worthwhile to select at least one component.")); typename MGDoFHandler::cell_iterator - cell = dof.begin(), - endc = dof.end(); + cell = dof.begin(), + endc = dof.end(); for (; cell!=endc; ++cell) - for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; - ++face_no) - { - if (cell->at_boundary(face_no) == false) - continue; + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + { + if (cell->at_boundary(face_no) == false) + continue; - const FiniteElement &fe = cell->get_fe(); - const unsigned int level = cell->level(); + const FiniteElement &fe = cell->get_fe(); + const unsigned int level = cell->level(); // we can presently deal only with // primitive elements for boundary @@@ -1242,25 -1248,25 +1247,25 @@@ // that are non-zero for the // components we are interested in, // are in fact primitive - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - { - const std::vector &nonzero_component_array - = cell->get_fe().get_nonzero_components (i); - for (unsigned int c=0; cget_fe().is_primitive (i), - ExcMessage ("This function can only deal with requested boundary " - "values that correspond to primitive (scalar) base " - "elements")); - } + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + { + const ComponentMask &nonzero_component_array + = cell->get_fe().get_nonzero_components (i); + for (unsigned int c=0; cget_fe().is_primitive (i), + ExcMessage ("This function can only deal with requested boundary " + "values that correspond to primitive (scalar) base " + "elements")); + } - typename MGDoFHandler::face_iterator face = cell->face(face_no); - const types::boundary_id boundary_component = face->boundary_indicator(); - if (function_map.find(boundary_component) != function_map.end()) + typename MGDoFHandler::face_iterator face = cell->face(face_no); + const types::boundary_id boundary_component = face->boundary_indicator(); + if (function_map.find(boundary_component) != function_map.end()) // face is of the right component - { + { // get indices, physical location and // boundary values of dofs on this // face @@@ -1347,22 -1354,18 +1352,18 @@@ // components. if shape function is non-primitive, then we will ignore // the result in the following anyway, otherwise there's only one // non-zero component which we will use - component = (std::find (fe.get_nonzero_components(cell_i).begin(), - fe.get_nonzero_components(cell_i).end(), - true) - - - fe.get_nonzero_components(cell_i).begin()); - } + component = fe.get_nonzero_components(cell_i).first_selected_component(); + } - if (component_mask[component] == true) - boundary_indices[level].insert(local_dofs[i]); - } - } - else - for (unsigned int i=0; i void + make_boundary_list( + const DoFHandler& dof, + const typename FunctionMap::type& function_map, + std::vector >& boundary_indices, + const std::vector& component_mask) + { + // if for whatever reason we were + // passed an empty map, return + // immediately + if (function_map.size() == 0) + return; + + const unsigned int n_levels = dof.get_tria().n_levels(); + + + const unsigned int n_components = DoFTools::n_components(dof); + const bool fe_is_system = (n_components != 1); + + AssertDimension (boundary_indices.size(), n_levels); + + std::vector local_dofs; + local_dofs.reserve (DoFTools::max_dofs_per_face(dof)); + std::fill (local_dofs.begin (), local_dofs.end (), + DoFHandler::invalid_dof_index); + + // First, deal with the simpler + // case when we have to identify + // all boundary dofs + if (component_mask.size() == 0) + { + typename DoFHandler::cell_iterator + cell = dof.begin(), + endc = dof.end(); + for (; cell!=endc; ++cell) + { + const FiniteElement &fe = cell->get_fe(); + const unsigned int level = cell->level(); + local_dofs.resize(fe.dofs_per_face); + + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + if (cell->at_boundary(face_no)) + { + const typename DoFHandler::face_iterator + face = cell->face(face_no); + const unsigned char bi = face->boundary_indicator(); + // Face is listed in + // boundary map + if (function_map.find(bi) != function_map.end()) + { + face->get_mg_dof_indices(level, local_dofs); + for (unsigned int i=0;i 0, + ExcMessage("It's probably worthwhile to select at least one component.")); + + typename DoFHandler::cell_iterator + cell = dof.begin(), + endc = dof.end(); + for (; cell!=endc; ++cell) + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + { + if (!(cell->at_boundary(face_no))) + continue; + + const FiniteElement &fe = cell->get_fe(); + const unsigned int level = cell->level(); + + // we can presently deal only with + // primitive elements for boundary + // values. this does not preclude + // us using non-primitive elements + // in components that we aren't + // interested in, however. make + // sure that all shape functions + // that are non-zero for the + // components we are interested in, + // are in fact primitive + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + { - const std::vector &nonzero_component_array - = cell->get_fe().get_nonzero_components (i); ++ const ComponentMask &nonzero_component_array ++ = cell->get_fe().get_nonzero_components (i); + for (unsigned int c=0; cget_fe().is_primitive (i), + ExcMessage ("This function can only deal with requested boundary " + "values that correspond to primitive (scalar) base " + "elements")); + } + + typename DoFHandler::face_iterator face = cell->face(face_no); + const unsigned char boundary_component = face->boundary_indicator(); + if (function_map.find(boundary_component) != function_map.end()) + // face is of the right component + { + // get indices, physical location and + // boundary values of dofs on this + // face + local_dofs.resize (fe.dofs_per_face); + face->get_mg_dof_indices (level, local_dofs); + if (fe_is_system) + { + // enter those dofs + // into the list that + // match the + // component + // signature. avoid + // the usual + // complication that + // we can't just use + // *_system_to_component_index + // for non-primitive + // FEs + for (unsigned int i=0; i + void make_boundary_list(const MGDoFHandler& dof, - const typename FunctionMap::type& function_map, - std::vector& boundary_indices, - const std::vector& component_mask) + const typename FunctionMap::type& function_map, + std::vector& boundary_indices, + const ComponentMask & component_mask) { Assert (boundary_indices.size() == dof.get_tria().n_levels(), - ExcDimensionMismatch (boundary_indices.size(), - dof.get_tria().n_levels())); + ExcDimensionMismatch (boundary_indices.size(), + dof.get_tria().n_levels())); std::vector > my_boundary_indices (dof.get_tria().n_levels()); diff --cc deal.II/source/multigrid/mg_tools.inst.in index 4f657ada47,9ec731c1e7..24932ea63e --- a/deal.II/source/multigrid/mg_tools.inst.in +++ b/deal.II/source/multigrid/mg_tools.inst.in @@@ -101,16 -92,10 +101,16 @@@ for (deal_II_dimension : DIMENSIONS const MGDoFHandler&, const FunctionMap::type&, std::vector >&, - const std::vector&); + const ComponentMask &); + + template void make_boundary_list( + const DoFHandler&, + const FunctionMap::type&, + std::vector >&, + const std::vector&); #endif - template void make_boundary_list( + template void make_boundary_list( const MGDoFHandler&, const FunctionMap::type&, std::vector&, @@@ -121,12 -106,7 +121,12 @@@ extract_inner_interface_dofs (const MGDoFHandler &mg_dof_handler, std::vector > &interface_dofs, std::vector > &boundary_interface_dofs); - template + template + void + extract_inner_interface_dofs (const DoFHandler &mg_dof_handler, + std::vector > &interface_dofs, + std::vector > &boundary_interface_dofs); + template void extract_inner_interface_dofs (const MGDoFHandler &mg_dof_handler, std::vector > &interface_dofs);