]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Assert for released handle on Transfer classes. 14193/head
authorMarc Fehling <mafehling.git@gmail.com>
Tue, 16 Aug 2022 23:33:40 +0000 (17:33 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Wed, 17 Aug 2022 14:28:41 +0000 (08:28 -0600)
include/deal.II/distributed/cell_data_transfer.templates.h
source/distributed/solution_transfer.cc

index 83dd4fbadb67582076b3cb3caa0d8080514a5d60..8cd5508780fcfc3d11601c52a8d7593f2d81e292 100644 (file)
@@ -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<dim, spacedim>::cell_iterator &cell,
@@ -193,6 +197,7 @@ namespace parallel
         post_unpack_action(all_out);
 
       input_vectors.clear();
+      handle = numbers::invalid_unsigned_int;
     }
 
 
index ebae6e32941aa7c06813c79079f3ab9280864d46..3f47b9ab371e14ba8c8eced1d32ea3dd7aa8037f 100644 (file)
@@ -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<dim, spacedim>::cell_iterator &cell_,
@@ -287,6 +291,7 @@ namespace parallel
         }
 
       input_vectors.clear();
+      handle = numbers::invalid_unsigned_int;
     }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.