]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MappingQCache: assert that level information was set up 12178/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 11 May 2021 07:40:06 +0000 (09:40 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 11 May 2021 07:40:06 +0000 (09:40 +0200)
include/deal.II/fe/mapping_q_cache.h
source/fe/mapping_q_cache.cc

index 3854993ec86dd012944038fbf2d24accde3b20cc..893141d35f8691482ab52d46ab4130ff7d60b705 100644 (file)
@@ -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;
 };
 
 /*@}*/
index 220a781a152a487b4bc398e69ca23938439d0ad7..563dbc028995cca693c6a169f9932166739ffa0e 100644 (file)
@@ -40,6 +40,7 @@ template <int dim, int spacedim>
 MappingQCache<dim, spacedim>::MappingQCache(
   const unsigned int polynomial_degree)
   : MappingQGeneric<dim, spacedim>(polynomial_degree)
+  , uses_level_info(false)
 {}
 
 
@@ -49,6 +50,7 @@ MappingQCache<dim, spacedim>::MappingQCache(
   const MappingQCache<dim, spacedim> &mapping)
   : MappingQGeneric<dim, spacedim>(mapping)
   , support_point_cache(mapping.support_point_cache)
+  , uses_level_info(mapping.uses_level_info)
 {}
 
 
@@ -180,6 +182,8 @@ MappingQCache<dim, spacedim>::initialize(
     /* copy_data */ nullptr,
     2 * MultithreadInfo::n_threads(),
     /* chunk_size = */ 1);
+
+  uses_level_info = true;
 }
 
 
@@ -245,6 +249,8 @@ MappingQCache<dim, spacedim>::initialize(
 
       return points;
     });
+
+  uses_level_info = true;
 }
 
 
@@ -268,6 +274,8 @@ MappingQCache<dim, spacedim>::initialize(
                      return new_point;
                    },
                    function_describes_relative_displacement);
+
+  uses_level_info = true;
 }
 
 
@@ -481,6 +489,8 @@ MappingQCache<dim, spacedim>::initialize(
 
       return result;
     });
+
+  uses_level_info = false;
 }
 
 
@@ -694,6 +704,8 @@ MappingQCache<dim, spacedim>::initialize(
 
       return result;
     });
+
+  uses_level_info = true;
 }
 
 
@@ -720,6 +732,8 @@ MappingQCache<dim, spacedim>::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()];

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.