From 97a43dbe94dfe047f885bfb5d37d24b0bc7bce42 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Thu, 23 Mar 2000 20:41:00 +0000 Subject: [PATCH] make_flux_sparsity_pattern on locally refined grids git-svn-id: https://svn.dealii.org/trunk@2627 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/dofs/dof_tools.cc | 63 +++++++++++++++++++----- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index 94444a7b83..27d6282af7 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -242,6 +242,9 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, vector dofs_on_other_cell(total_dofs); DoFHandler::active_cell_iterator cell = dof.begin_active(), endc = dof.end(); + + (const_cast& > (dof.get_tria())).clear_user_flags(); + for (; cell!=endc; ++cell) { cell->get_dof_indices (dofs_on_this_cell); @@ -256,23 +259,59 @@ DoFTools::make_flux_sparsity_pattern (const DoFHandler &dof, face < GeometryInfo::faces_per_cell; ++face) { - if (! cell->at_boundary(face) ) + DoFHandler::face_iterator cell_face = cell->face(face); + if (cell_face->user_flag_set ()) + continue; + + if (! cell->at_boundary (face) ) { - DoFHandler::active_cell_iterator neighbor = cell->neighbor(face); - neighbor->get_dof_indices (dofs_on_other_cell); - // only add one direction - // The other is taken care of - // by neighbor. - for (unsigned int i=0; i::cell_iterator neighbor = cell->neighbor(face); + // Refinement edges are taken care of + // by coarser cells + if (neighbor->level() < cell->level()) + continue; + + unsigned int neighbor_face = cell->neighbor_of_neighbor(face); + + if (neighbor->has_children()) { - for (unsigned int j=0; j::subfaces_per_face; + ++sub_nr) + { + DoFHandler::cell_iterator sub_neighbor + = neighbor-> + child(GeometryInfo::child_cell_on_face(neighbor_face, sub_nr)); + + sub_neighbor->get_dof_indices (dofs_on_other_cell); + for (unsigned int i=0; iface(neighbor_face)->set_user_flag (); + } + } else { + neighbor->get_dof_indices (dofs_on_other_cell); + for (unsigned int i=0; iface(neighbor_face)->set_user_flag (); } - } - } + } + } } } -- 2.39.5