]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some code.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Jan 2021 05:00:36 +0000 (22:00 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Jan 2021 05:00:36 +0000 (22:00 -0700)
source/grid/reference_cell.cc

index 2ce04c7d8e9a321ab5f6e66dbe9300f55fe14fb5..19a303d0b8ce11db9ae431ce2cf81adda5a36bd0 100644 (file)
@@ -75,19 +75,11 @@ namespace ReferenceCell
       }
     else if (reference_cell == Type::Tri)
       {
-        std::vector<Point<spacedim>> vertices;
-        if (spacedim == 2)
-          {
-            vertices.emplace_back(0.0, 0.0);
-            vertices.emplace_back(1.0, 0.0);
-            vertices.emplace_back(0.0, 1.0);
-          }
-        else if (spacedim == 3)
-          {
-            vertices.emplace_back(0.0, 0.0, 0.0);
-            vertices.emplace_back(1.0, 0.0, 0.0);
-            vertices.emplace_back(0.0, 1.0, 0.0);
-          }
+        const std::vector<Point<spacedim>> vertices = {
+          Point<spacedim>(),               // the origin
+          Point<spacedim>::unit_vector(0), // unit point along x-axis
+          Point<spacedim>::unit_vector(1)  // unit point along y-axis
+        };
 
         std::vector<CellData<dim>> cells(1);
         cells[0].vertices = {0, 1, 2};

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.