From: Peter Munch Date: Fri, 28 Feb 2020 17:46:15 +0000 (+0100) Subject: Add assert to MGLevelGlobalTransfer X-Git-Tag: v9.2.0-rc1~488^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f068ac2a02250a3fa293e23cdf5946cef07eb00;p=dealii.git Add assert to MGLevelGlobalTransfer --- diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index 7ed36eef19..0cf2bbf44d 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -210,6 +210,9 @@ MGLevelGlobalTransfer::copy_to_mg( MGLevelObject & dst, const InVector & src) const { + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); AssertIndexRange(dst.max_level(), dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(dst.min_level(), dst.max_level() + 1); @@ -280,6 +283,9 @@ MGLevelGlobalTransfer::copy_from_mg( const MGLevelObject &src) const { (void)dof_handler; + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); AssertIndexRange(src.max_level(), dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(src.min_level(), src.max_level() + 1); @@ -349,10 +355,14 @@ template template void MGLevelGlobalTransfer::copy_from_mg_add( - const DoFHandler & /*dof_handler*/, + const DoFHandler &dof_handler, OutVector & dst, const MGLevelObject &src) const { + (void)dof_handler; + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); // 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 @@ -402,6 +412,9 @@ MGLevelGlobalTransfer>::copy_to_mg( MGLevelObject> &dst, const LinearAlgebra::distributed::Vector & src) const { + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); copy_to_mg(dof_handler, dst, src, false); } @@ -415,6 +428,9 @@ MGLevelGlobalTransfer>::copy_to_mg( const LinearAlgebra::distributed::Vector & src, const bool solution_transfer) const { + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); LinearAlgebra::distributed::Vector &this_ghosted_global_vector = solution_transfer ? solution_ghosted_global_vector : ghosted_global_vector; const std::vector> &this_copy_indices = @@ -521,6 +537,9 @@ MGLevelGlobalTransfer>::copy_from_mg( const MGLevelObject> &src) const { (void)dof_handler; + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); AssertIndexRange(src.max_level(), dof_handler.get_triangulation().n_global_levels()); AssertIndexRange(src.min_level(), src.max_level() + 1); @@ -591,10 +610,14 @@ template void MGLevelGlobalTransfer>:: copy_from_mg_add( - const DoFHandler & /*dof_handler*/, - LinearAlgebra::distributed::Vector & dst, + const DoFHandler & dof_handler, + LinearAlgebra::distributed::Vector &dst, const MGLevelObject> &src) const { + (void)dof_handler; + Assert(copy_indices.size() == + dof_handler.get_triangulation().n_global_levels(), + ExcMessage("MGTransfer::build() has not been called!")); // 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