]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify CellAccessor::at_boundary() 10552/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 19 Jun 2020 10:46:45 +0000 (12:46 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 19 Jun 2020 10:46:45 +0000 (12:46 +0200)
source/grid/tria_accessor.cc

index 51a0971543368685c6536be080fad4f1b5877229..4a48e71df8278f9a04c5ffa7b8953f2dcd309436 100644 (file)
@@ -2023,20 +2023,11 @@ template <int dim, int spacedim>
 bool
 CellAccessor<dim, spacedim>::at_boundary() const
 {
-  switch (dim)
-    {
-      case 1:
-        return at_boundary(0) || at_boundary(1);
-      case 2:
-        return (at_boundary(0) || at_boundary(1) || at_boundary(2) ||
-                at_boundary(3));
-      case 3:
-        return (at_boundary(0) || at_boundary(1) || at_boundary(2) ||
-                at_boundary(3) || at_boundary(4) || at_boundary(5));
-      default:
-        Assert(false, ExcNotImplemented());
-        return false;
-    }
+  for (const auto face : GeometryInfo<dim>::face_indices())
+    if (at_boundary(face))
+      return true;
+
+  return 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.