From 04d293e6a9d60499ad89e504b2977f993447cd37 Mon Sep 17 00:00:00 2001 From: Reza Rastak Date: Mon, 29 Jul 2019 18:42:00 -0700 Subject: [PATCH] Bug in CellDataStorage::erase() fixed --- include/deal.II/base/quadrature_point_data.h | 2 ++ tests/base/cell_data_storage_02.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index f0a08bd99b..154ce61bf0 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -559,6 +559,8 @@ bool CellDataStorage::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( diff --git a/tests/base/cell_data_storage_02.cc b/tests/base/cell_data_storage_02.cc index b01f6b376f..422ddbcc87 100644 --- a/tests/base/cell_data_storage_02.cc +++ b/tests/base/cell_data_storage_02.cc @@ -102,6 +102,10 @@ test() fe_values.reinit(dof_cell); const std::vector> &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> qpd = -- 2.39.5