]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add Triangulation::all_reference_cells_are_simplex() and ::is_mixed_mesh() 13044/head
authorPeter Munch <peterrmuench@gmail.com>
Wed, 8 Dec 2021 15:27:34 +0000 (16:27 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Wed, 8 Dec 2021 16:13:42 +0000 (17:13 +0100)
include/deal.II/grid/tria.h
source/grid/tria.cc

index 265b70d0ae650be17ffaa2b90b75d64f74327c95..90d29f33794aa501b425a1781f2f5e25a613a765 100644 (file)
@@ -3416,6 +3416,21 @@ public:
   bool
   all_reference_cells_are_hyper_cube() const;
 
+  /**
+   * Indicate if the triangulation only consists of simplex-like cells, i.e.,
+   * lines, triangles, or tetrahedra.
+   */
+  bool
+  all_reference_cells_are_simplex() const;
+
+  /**
+   * Indicate if the triangulation consists of different cell types (mix of
+   * simplices, hypercubes, ...) or different face types, as in the case
+   * of pyramids or wedges..
+   */
+  bool
+  is_mixed_mesh() const;
+
 #ifdef DOXYGEN
   /**
    * Write and read the data of this object from a stream for the purpose
index 57fce4ad707c3fcc9005d3036b51d6ba8cc1d849..d279c78bb6bcc46fc1ed38c67f33f0db4e844b9e 100644 (file)
@@ -14655,7 +14655,36 @@ Triangulation<dim, spacedim>::all_reference_cells_are_hyper_cube() const
                     "cells used by this triangulation if the "
                     "triangulation doesn't yet have any cells in it."));
   return (this->reference_cells.size() == 1 &&
-          this->reference_cells[0] == ReferenceCells::get_hypercube<dim>());
+          this->reference_cells[0].is_hyper_cube());
+}
+
+
+
+template <int dim, int spacedim>
+bool
+Triangulation<dim, spacedim>::all_reference_cells_are_simplex() const
+{
+  Assert(this->reference_cells.size() > 0,
+         ExcMessage("You can't ask about the kinds of reference "
+                    "cells used by this triangulation if the "
+                    "triangulation doesn't yet have any cells in it."));
+  return (this->reference_cells.size() == 1 &&
+          this->reference_cells[0].is_simplex());
+}
+
+
+
+template <int dim, int spacedim>
+bool
+Triangulation<dim, spacedim>::is_mixed_mesh() const
+{
+  Assert(this->reference_cells.size() > 0,
+         ExcMessage("You can't ask about the kinds of reference "
+                    "cells used by this triangulation if the "
+                    "triangulation doesn't yet have any cells in it."));
+  return reference_cells.size() > 1 ||
+         ((reference_cells[0].is_hyper_cube() == false) &&
+          (reference_cells[0].is_simplex() == false));
 }
 
 

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.