From: Martin Kronbichler Date: Sun, 3 Apr 2016 11:11:12 +0000 (+0200) Subject: Fix mg transfer for minlevel > 0. X-Git-Tag: v8.5.0-rc1~1145^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88e6fdd4cbd673582189cf57202e994d0bcf69ff;p=dealii.git Fix mg transfer for minlevel > 0. --- diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index 76225e32cb..4d285809d0 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -197,6 +197,8 @@ MGLevelGlobalTransfer::copy_to_mg MGLevelObject &dst, const InVector &src) const { + AssertIndexRange(dst.max_level(), mg_dof_handler.get_triangulation().n_global_levels()); + AssertIndexRange(dst.min_level(), dst.max_level()+1); reinit_vector(mg_dof_handler, component_to_block_map, dst); bool first = true; #ifdef DEBUG_OUTPUT @@ -213,7 +215,7 @@ MGLevelGlobalTransfer::copy_to_mg internal::copy_vector(copy_indices[dst.max_level()], src, dst[dst.max_level()]); // do the initial restriction - for (unsigned int level=mg_dof_handler.get_triangulation().n_global_levels()-1; level != 0; ) + for (unsigned int level=dst.max_level(); level != dst.min_level(); ) { --level; this->restrict_and_add (level+1, dst[level], dst[level+1]); @@ -221,7 +223,7 @@ MGLevelGlobalTransfer::copy_to_mg return; } - for (unsigned int level=mg_dof_handler.get_triangulation().n_global_levels(); level != 0;) + for (unsigned int level=dst.max_level()+1; level != dst.min_level(); ) { --level; #ifdef DEBUG_OUTPUT @@ -271,6 +273,8 @@ MGLevelGlobalTransfer::copy_from_mg OutVector &dst, const MGLevelObject &src) const { + AssertIndexRange(src.max_level(), mg_dof_handler.get_triangulation().n_global_levels()); + AssertIndexRange(src.min_level(), src.max_level()+1); if (perform_plain_copy) { AssertDimension(dst.size(), src[src.max_level()].size()); @@ -282,7 +286,7 @@ MGLevelGlobalTransfer::copy_from_mg // attention, since they belong to the coarse level, but have fine level // basis functions dst = 0; - for (unsigned int level=0; level::copy_from_mg_add // For non-DG: degrees of freedom in the refinement face may need special // attention, since they belong to the coarse level, but have fine level // basis functions - for (unsigned int level=0; level >::const_iterator dof_pair_iterator; const VectorType &src_level = src[level]; @@ -373,6 +377,8 @@ MGLevelGlobalTransfer >::copy_to_mg MGLevelObject > &dst, const parallel::distributed::Vector &src) const { + AssertIndexRange(dst.max_level(), mg_dof_handler.get_triangulation().n_global_levels()); + AssertIndexRange(dst.min_level(), dst.max_level()+1); reinit_vector(mg_dof_handler, component_to_block_map, dst); bool first = true; @@ -386,7 +392,7 @@ MGLevelGlobalTransfer >::copy_to_mg static_cast &>(dst_view) = static_cast &>(src_view); // do the initial restriction - for (unsigned int level=mg_dof_handler.get_triangulation().n_global_levels()-1; level != 0; ) + for (unsigned int level=dst.max_level(); level != dst.min_level(); ) { --level; this->restrict_and_add (level+1, dst[level], dst[level+1]); @@ -403,7 +409,7 @@ MGLevelGlobalTransfer >::copy_to_mg ghosted_global_vector = src; ghosted_global_vector.update_ghost_values(); - for (unsigned int level=mg_dof_handler.get_triangulation().n_global_levels(); level != 0;) + for (unsigned int level=dst.max_level()+1; level != dst.min_level();) { --level; @@ -442,6 +448,8 @@ MGLevelGlobalTransfer >::copy_from_mg parallel::distributed::Vector &dst, const MGLevelObject > &src) const { + AssertIndexRange(src.max_level(), mg_dof_handler.get_triangulation().n_global_levels()); + AssertIndexRange(src.min_level(), src.max_level()+1); if (perform_plain_copy) { // In this case, we can simply copy the local range (in parallel by @@ -460,7 +468,7 @@ MGLevelGlobalTransfer >::copy_from_mg // basis functions dst = 0; - for (unsigned int level=0; level >::const_iterator dof_pair_iterator; @@ -505,7 +513,7 @@ MGLevelGlobalTransfer >::copy_from_mg_add // basis functions dst.zero_out_ghosts(); - for (unsigned int level=0; level >::const_iterator dof_pair_iterator;