From 26f86fc04c30f6fda11941dfe81a1dc85ddd37d0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 19 Mar 2010 23:58:53 +0000 Subject: [PATCH] Fix a rather silly bug. git-svn-id: https://svn.dealii.org/trunk@20858 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/multigrid/mg_tools.cc | 75 +++++++++----------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/deal.II/deal.II/source/multigrid/mg_tools.cc b/deal.II/deal.II/source/multigrid/mg_tools.cc index 2afe759d0c..92eaf98f41 100644 --- a/deal.II/deal.II/source/multigrid/mg_tools.cc +++ b/deal.II/deal.II/source/multigrid/mg_tools.cc @@ -1119,7 +1119,7 @@ MGTools::make_boundary_list( const MGDoFHandler& dof, const typename FunctionMap::type& function_map, std::vector >& boundary_indices, - const std::vector& component_mask_) + const std::vector& component_mask) { // if for whatever reason we were // passed an empty map, return @@ -1129,19 +1129,22 @@ MGTools::make_boundary_list( 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) + if (component_mask.size() == 0) { typename MGDoFHandler::cell_iterator cell = dof.begin(), @@ -1151,47 +1154,30 @@ MGTools::make_boundary_list( 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) - { - const typename MGDoFHandler::face_iterator - face = cell->face(face_no); - face->get_mg_dof_indices(level, local_dofs); - const unsigned char bi = face->boundary_indicator(); - // Face is listed in - // boundary map - if (function_map.find(bi) != function_map.end()) - { - for (unsigned int i=0;iat_boundary(face_no) == true) + { + const typename MGDoFHandler::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::type::const_iterator i=function_map.begin(); -// i!=function_map.end(); ++i) -// Assert (n_components == i->second->n_components, -// ExcInvalidFE()); - - // set the component mask to either - // the original value or a vector - // of @p{true}s - const std::vector component_mask ((component_mask_.size() == 0) ? - std::vector (n_components, true) : - component_mask_); -// Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0, -// ExcComponentMismatch()); - - // field to store the indices - 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); - + Assert (std::count(component_mask.begin(), component_mask.end(), true) > 0, + ExcMessage("It's probably worthwhile to select at least one component.")); + typename MGDoFHandler::cell_iterator cell = dof.begin(), endc = dof.end(); @@ -1199,9 +1185,12 @@ MGTools::make_boundary_list( 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(); - + // we can presently deal only with // primitive elements for boundary // values. this does not preclude @@ -1225,7 +1214,7 @@ MGTools::make_boundary_list( "values that correspond to primitive (scalar) base " "elements")); } - + typename MGDoFHandler::face_iterator face = cell->face(face_no); const unsigned char boundary_component = face->boundary_indicator(); if (function_map.find(boundary_component) != function_map.end()) @@ -1274,7 +1263,7 @@ MGTools::make_boundary_list( // face dof // index to // cell dof - + // index const unsigned int cell_i = (dim == 1 ? -- 2.39.5