]> https://gitweb.dealii.org/ - dealii.git/commitdiff
improve assert message for non matching reference cell types 16020/head
authorMagdalena Schreter <magdalena.schreter@tum.de>
Wed, 20 Sep 2023 13:03:23 +0000 (15:03 +0200)
committerMagdalena Schreter <magdalena.schreter@tum.de>
Wed, 20 Sep 2023 22:32:12 +0000 (00:32 +0200)
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/grid/reference_cell.h
source/base/data_out_base.cc

index 43cadc9db349c8939bfd16154047de8f58678267..3c2e04763feba123e00f4af0c4c38d04b7d28405 100644 (file)
@@ -2636,9 +2636,8 @@ 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!"));
+         internal::ExcNonMatchingReferenceCellTypes(this->reference_cell(),
+                                                    fe.reference_cell()));
 
   return fe;
 }
index aeea0690de43466320b453c7674bdcc6574d143a..11bcb633b6351782a877e85b27ab534cf8b63796 100644 (file)
@@ -2687,6 +2687,25 @@ namespace internal
      */
     const ArrayView<const T> vertices_1;
   };
+
+  /**
+   * This exception is raised whenever the types of two reference cell objects
+   * were assumed to be equal, but were not.
+   *
+   * Parameters to the constructor are the first and second reference cells,
+   * both of type <tt>ReferenceCell</tt>.
+   */
+  DeclException2(
+    ExcNonMatchingReferenceCellTypes,
+    ReferenceCell,
+    ReferenceCell,
+    << "The reference-cell type used on this cell (" << arg1.to_string()
+    << ") does not match the reference-cell type of the finite element "
+    << "associated with this cell (" << arg2.to_string() << "). "
+    << "Did you accidentally use simplex elements on hypercube meshes "
+    << "(or the other way around), or are you using a mixed mesh and "
+    << "assigned a simplex element to a hypercube cell (or the other "
+    << "way around) via the active_fe_index?");
 } // namespace internal
 
 
index bdbdb228cfc5e34c28b37e25f750812adde65413..d4ef78f35752bbc824635f85940ce94f73c7c4ad 100644 (file)
@@ -9560,7 +9560,7 @@ XDMFEntry::get_xdmf_content(const unsigned int   indent_level,
   // We now store the type of cell in the XDMFEntry:
   (void)reference_cell;
   Assert(cell_type == reference_cell,
-         ExcMessage("Incorrect ReferenceCell type passed in."));
+         internal::ExcNonMatchingReferenceCellTypes(cell_type, reference_cell));
   return get_xdmf_content(indent_level);
 }
 

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.