]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some calls to make compiler inline function 12126/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 3 May 2021 15:36:23 +0000 (17:36 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 3 May 2021 15:36:23 +0000 (17:36 +0200)
include/deal.II/grid/tria_objects.h

index 79622cda7ae25d1e7a115c5b1968e734770e6e60..414fc4789956128ae6445463166f926411790a2d 100644 (file)
@@ -374,18 +374,7 @@ namespace internal
     TriaObjects::n_objects() const
     {
       // assume that each cell has the same number of faces
-
-      unsigned int faces_per_cell = 1;
-
-      if (this->structdim == 1)
-        faces_per_cell = GeometryInfo<1>::faces_per_cell;
-      else if (this->structdim == 2)
-        faces_per_cell = GeometryInfo<2>::faces_per_cell;
-      else if (this->structdim == 3)
-        faces_per_cell = GeometryInfo<3>::faces_per_cell;
-      else
-        AssertThrow(false, ExcNotImplemented());
-
+      const unsigned int faces_per_cell = 2 * this->structdim;
       return cells.size() / faces_per_cell;
     }
 
@@ -395,18 +384,7 @@ namespace internal
     TriaObjects::get_bounding_object_indices(const unsigned int index)
     {
       // assume that each cell has the same number of faces
-
-      unsigned int faces_per_cell = 1;
-
-      if (this->structdim == 1)
-        faces_per_cell = GeometryInfo<1>::faces_per_cell;
-      else if (this->structdim == 2)
-        faces_per_cell = GeometryInfo<2>::faces_per_cell;
-      else if (this->structdim == 3)
-        faces_per_cell = GeometryInfo<3>::faces_per_cell;
-      else
-        AssertThrow(false, ExcNotImplemented());
-
+      const unsigned int faces_per_cell = 2 * this->structdim;
       return ArrayView<int>(cells.data() + index * faces_per_cell,
                             faces_per_cell);
     }

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.