From fde350c9c830258c46db1d1076bff2340509b207 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Tue, 16 Aug 2022 17:33:40 -0600 Subject: [PATCH] Assert for released handle on Transfer classes. --- include/deal.II/distributed/cell_data_transfer.templates.h | 5 +++++ source/distributed/solution_transfer.cc | 5 +++++ 2 files changed, 10 insertions(+) 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; } -- 2.39.5