]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assert that DoFCellAccessor::get/set_mg_dof_indices() 11890/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 12 Mar 2021 10:38:07 +0000 (11:38 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 14 Mar 2021 12:30:53 +0000 (13:30 +0100)
include/deal.II/dofs/dof_accessor.templates.h

index 7abbbc79d113453ca00bb431de04fbe38ed18c1f..17c60389a77393e120a380e2bcf1d18679467082 100644 (file)
@@ -1337,7 +1337,8 @@ namespace internal
         Assert(
           dim == structdim,
           ExcMessage(
-            "This function is intended to be used for DoFCellAccessor, i.e., dimension == structdim."));
+            "This function is intended to be used for DoFCellAccessor, i.e., "
+            "dimension == structdim."));
 
         process_dof_indices(
           accessor,
@@ -2600,6 +2601,9 @@ inline void
 DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::
   get_mg_dof_indices(std::vector<types::global_dof_index> &dof_indices) const
 {
+  Assert(this->dof_handler->mg_vertex_dofs.size() > 0,
+         ExcMessage("Multigrid DoF indices can only be accessed after "
+                    "DoFHandler::distribute_mg_dofs() has been called!"));
   DoFAccessor<dimension_, dimension_, space_dimension_, level_dof_access>::
     get_mg_dof_indices(this->level(), dof_indices);
 }
@@ -2611,6 +2615,9 @@ inline void
 DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::
   set_mg_dof_indices(const std::vector<types::global_dof_index> &dof_indices)
 {
+  Assert(this->dof_handler->mg_vertex_dofs.size() > 0,
+         ExcMessage("Multigrid DoF indices can only be accessed after "
+                    "DoFHandler::distribute_mg_dofs() has been called!"));
   DoFAccessor<dimension_, dimension_, space_dimension_, level_dof_access>::
     set_mg_dof_indices(this->level(), dof_indices);
 }
@@ -2759,10 +2766,10 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::get_fe() const
 
   const auto &fe = this->dof_handler->get_fe(active_fe_index());
 
-  Assert(
-    this->reference_cell() == fe.reference_cell(),
-    ExcMessage(
-      "The reference-cell type of the cell does not match the one of the finite element!"));
+  Assert(this->reference_cell() == fe.reference_cell(),
+         ExcMessage(
+           "The reference-cell type of the cell does not match the one of the "
+           "finite element!"));
 
   return fe;
 }

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.