From: Daniel Arndt Date: Thu, 31 Mar 2016 17:21:45 +0000 (+0200) Subject: periodic_neighbor in MGTools::make_flux_sparsity_pattern X-Git-Tag: v8.5.0-rc1~1095^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87acdcb9b80addff4a538b58da1fa6d77c2dcfaf;p=dealii.git periodic_neighbor in MGTools::make_flux_sparsity_pattern --- diff --git a/source/multigrid/mg_tools.cc b/source/multigrid/mg_tools.cc index 932429d10c..bea3e5779b 100644 --- a/source/multigrid/mg_tools.cc +++ b/source/multigrid/mg_tools.cc @@ -602,11 +602,18 @@ namespace MGTools face < GeometryInfo::faces_per_cell; ++face) { - if ( (! cell->at_boundary(face)) && - (static_cast(cell->neighbor_level(face)) == level) ) + bool use_face = false; + if ((! cell->at_boundary(face)) && + (static_cast(cell->neighbor_level(face)) == level)) + use_face = true; + else if (cell->has_periodic_neighbor(face) && + (static_cast(cell->periodic_neighbor_level(face)) == level)) + use_face = true; + + if (use_face) { typename DoFHandler::cell_iterator - neighbor = cell->neighbor(face); + neighbor = cell->neighbor_or_periodic_neighbor(face); neighbor->get_mg_dof_indices (dofs_on_other_cell); // only add one direction The other is taken care of by // neighbor (except when the neighbor is not owned by the same @@ -672,12 +679,18 @@ namespace MGTools ++face) { // Neighbor is coarser - - if ( (! cell->at_boundary(face)) && - (static_cast(cell->neighbor_level(face)) != level) ) + bool use_face = false; + if ((! cell->at_boundary(face)) && + (static_cast(cell->neighbor_level(face)) != level)) + use_face = true; + else if (cell->has_periodic_neighbor(face) && + (static_cast(cell->periodic_neighbor_level(face)) != level)) + use_face = true; + + if (use_face) { typename DoFHandler::cell_iterator - neighbor = cell->neighbor(face); + neighbor = cell->neighbor_or_periodic_neighbor(face); neighbor->get_mg_dof_indices (dofs_on_other_cell); for (unsigned int i=0; iuser_flag_set ()) continue; - if (cell->at_boundary (face) ) + if (cell->at_boundary (face) && !cell->has_periodic_neighbor(face)) { for (unsigned int i=0; i::cell_iterator - neighbor = cell->neighbor(face); + neighbor = cell->neighbor_or_periodic_neighbor(face); if (neighbor->level() < cell->level()) continue; - unsigned int neighbor_face = cell->neighbor_of_neighbor(face); + unsigned int neighbor_face = cell->has_periodic_neighbor(face)? + cell->periodic_neighbor_of_periodic_neighbor(face): + cell->neighbor_of_neighbor(face); neighbor->get_mg_dof_indices (dofs_on_other_cell); for (unsigned int i=0; iat_boundary(face)) && - (static_cast(cell->neighbor_level(face)) != level) ) + bool use_face = false; + if ((! cell->at_boundary(face)) && + (static_cast(cell->neighbor_level(face)) != level)) + use_face = true; + else if (cell->has_periodic_neighbor(face) && + (static_cast(cell->periodic_neighbor_level(face)) != level)) + use_face = true; + + if (use_face) { typename DoFHandler::cell_iterator - neighbor = cell->neighbor(face); + neighbor = cell->neighbor_or_periodic_neighbor(face); neighbor->get_mg_dof_indices (dofs_on_other_cell); for (unsigned int i=0; i