From: Marc Fehling Date: Tue, 16 Aug 2022 23:33:40 +0000 (-0600) Subject: Assert for released handle on Transfer classes. X-Git-Tag: v9.5.0-rc1~1040^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14193%2Fhead;p=dealii.git Assert for released handle on Transfer classes. --- diff --git a/include/deal.II/distributed/cell_data_transfer.templates.h b/include/deal.II/distributed/cell_data_transfer.templates.h index 83dd4fbadb..8cd5508780 100644 --- a/include/deal.II/distributed/cell_data_transfer.templates.h +++ b/include/deal.II/distributed/cell_data_transfer.templates.h @@ -104,6 +104,10 @@ namespace parallel &(*triangulation)); Assert(tria != nullptr, ExcInternalError()); + Assert(handle == numbers::invalid_unsigned_int, + ExcMessage("You can only add one data container per " + "CellDataTransfer object.")); + handle = tria->register_data_attach( [this](const typename parallel::distributed:: Triangulation::cell_iterator &cell, @@ -193,6 +197,7 @@ namespace parallel post_unpack_action(all_out); input_vectors.clear(); + handle = numbers::invalid_unsigned_int; } diff --git a/source/distributed/solution_transfer.cc b/source/distributed/solution_transfer.cc index ebae6e3294..3f47b9ab37 100644 --- a/source/distributed/solution_transfer.cc +++ b/source/distributed/solution_transfer.cc @@ -157,6 +157,10 @@ namespace parallel &dof_handler->get_triangulation()))); Assert(tria != nullptr, ExcInternalError()); + Assert(handle == numbers::invalid_unsigned_int, + ExcMessage("You can only add one solution per " + "SolutionTransfer object.")); + handle = tria->register_data_attach( [this]( const typename Triangulation::cell_iterator &cell_, @@ -287,6 +291,7 @@ namespace parallel } input_vectors.clear(); + handle = numbers::invalid_unsigned_int; }