From 2feb8d32a9eb4af95b2de6a90825620e3d8ed4e0 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 11 May 2021 09:40:06 +0200 Subject: [PATCH] MappingQCache: assert that level information was set up --- include/deal.II/fe/mapping_q_cache.h | 6 ++++++ source/fe/mapping_q_cache.cc | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/deal.II/fe/mapping_q_cache.h b/include/deal.II/fe/mapping_q_cache.h index 3854993ec8..893141d35f 100644 --- a/include/deal.II/fe/mapping_q_cache.h +++ b/include/deal.II/fe/mapping_q_cache.h @@ -232,6 +232,12 @@ private: * this class goes out of scope. */ boost::signals2::connection clear_signal; + + /** + * Specifies if support_point_cache has been set up for the cells on the + * levels. + */ + bool uses_level_info; }; /*@}*/ diff --git a/source/fe/mapping_q_cache.cc b/source/fe/mapping_q_cache.cc index 220a781a15..563dbc0289 100644 --- a/source/fe/mapping_q_cache.cc +++ b/source/fe/mapping_q_cache.cc @@ -40,6 +40,7 @@ template MappingQCache::MappingQCache( const unsigned int polynomial_degree) : MappingQGeneric(polynomial_degree) + , uses_level_info(false) {} @@ -49,6 +50,7 @@ MappingQCache::MappingQCache( const MappingQCache &mapping) : MappingQGeneric(mapping) , support_point_cache(mapping.support_point_cache) + , uses_level_info(mapping.uses_level_info) {} @@ -180,6 +182,8 @@ MappingQCache::initialize( /* copy_data */ nullptr, 2 * MultithreadInfo::n_threads(), /* chunk_size = */ 1); + + uses_level_info = true; } @@ -245,6 +249,8 @@ MappingQCache::initialize( return points; }); + + uses_level_info = true; } @@ -268,6 +274,8 @@ MappingQCache::initialize( return new_point; }, function_describes_relative_displacement); + + uses_level_info = true; } @@ -481,6 +489,8 @@ MappingQCache::initialize( return result; }); + + uses_level_info = false; } @@ -694,6 +704,8 @@ MappingQCache::initialize( return result; }); + + uses_level_info = true; } @@ -720,6 +732,8 @@ MappingQCache::compute_mapping_support_points( ExcMessage("Must call MappingQCache::initialize() before " "using it or after mesh has changed!")); + Assert(uses_level_info || cell->is_active(), ExcInternalError()); + AssertIndexRange(cell->level(), support_point_cache->size()); AssertIndexRange(cell->index(), (*support_point_cache)[cell->level()].size()); return (*support_point_cache)[cell->level()][cell->index()]; -- 2.39.5