]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bug in CellDataStorage::erase() fixed 8433/head
authorReza Rastak <rastak@stanford.edu>
Tue, 30 Jul 2019 01:42:00 +0000 (18:42 -0700)
committerReza Rastak <rastak@stanford.edu>
Tue, 30 Jul 2019 01:42:00 +0000 (18:42 -0700)
include/deal.II/base/quadrature_point_data.h
tests/base/cell_data_storage_02.cc

index f0a08bd99b87880832721cb33922fe3fdcc61774..154ce61bf000e127353cdcd9d211063770a085bb 100644 (file)
@@ -559,6 +559,8 @@ bool
 CellDataStorage<CellIteratorType, DataType>::erase(const CellIteratorType &cell)
 {
   const auto it = map.find(cell);
+  if (it == map.end())
+    return false;
   for (unsigned int i = 0; i < it->second.size(); i++)
     {
       Assert(
index b01f6b376fc3c5e8d0a00c63bfd7f6b8f4fc1f1b..422ddbcc8740739916f31fb3522db3c44075f314 100644 (file)
@@ -102,6 +102,10 @@ test()
           fe_values.reinit(dof_cell);
           const std::vector<Point<dim>> &q_points =
             fe_values.get_quadrature_points();
+          // before initialization, you can erase it without any consequences
+          const bool erased_nonexisting_data = data_storage.erase(cell);
+          Assert(!erased_nonexisting_data, ExcInternalError());
+          // initialize
           data_storage.initialize(cell, rhs.size());
           {
             std::vector<std::shared_ptr<MyQData>> qpd =

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.