]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use functionality in ReferenceCell. 14975/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 9 Feb 2023 23:55:15 +0000 (16:55 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 24 Mar 2023 20:43:27 +0000 (14:43 -0600)
source/base/qprojector.cc

index b79b62542ef5fa11ac5ef6edd847c072824fadcf..20f588eb81dae1eebb6347aaeca3153342507695 100644 (file)
@@ -749,67 +749,21 @@ QProjector<3>::project_to_all_faces(const ReferenceCell &     reference_cell,
     return Quadrature<3>(points, weights);
   };
 
-  if (reference_cell == ReferenceCells::Tetrahedron)
+  if ((reference_cell == ReferenceCells::Tetrahedron) ||
+      (reference_cell == ReferenceCells::Wedge) ||
+      (reference_cell == ReferenceCells::Pyramid))
     {
-      const std::vector<std::vector<Point<3>>> face_vertex_locations = {
-        {{Point<3>(0.0, 0.0, 0.0),
-          Point<3>(1.0, 0.0, 0.0),
-          Point<3>(0.0, 1.0, 0.0)}},
-        {{Point<3>(1.0, 0.0, 0.0),
-          Point<3>(0.0, 0.0, 0.0),
-          Point<3>(0.0, 0.0, 1.0)}},
-        {{Point<3>(0.0, 0.0, 0.0),
-          Point<3>(0.0, 1.0, 0.0),
-          Point<3>(0.0, 0.0, 1.0)}},
-        {{Point<3>(0.0, 1.0, 0.0),
-          Point<3>(1.0, 0.0, 0.0),
-          Point<3>(0.0, 0.0, 1.0)}}};
-
-      return process(face_vertex_locations);
-    }
-  else if (reference_cell == ReferenceCells::Wedge)
-    {
-      const std::vector<std::vector<Point<3>>> face_vertex_locations = {
-        {{Point<3>(1.0, 0.0, 0.0),
-          Point<3>(0.0, 0.0, 0.0),
-          Point<3>(0.0, 1.0, 0.0)}},
-        {{Point<3>(0.0, 0.0, 1.0),
-          Point<3>(1.0, 0.0, 1.0),
-          Point<3>(0.0, 1.0, 1.0)}},
-        {{Point<3>(0.0, 0.0, 0.0),
-          Point<3>(1.0, 0.0, 0.0),
-          Point<3>(0.0, 0.0, 1.0),
-          Point<3>(1.0, 0.0, 1.0)}},
-        {{Point<3>(1.0, 0.0, 0.0),
-          Point<3>(0.0, 1.0, 0.0),
-          Point<3>(1.0, 0.0, 1.0),
-          Point<3>(0.0, 1.0, 1.0)}},
-        {{Point<3>(0.0, 1.0, 0.0),
-          Point<3>(0.0, 0.0, 0.0),
-          Point<3>(0.0, 1.0, 1.0),
-          Point<3>(0.0, 0.0, 1.0)}}};
-
-      return process(face_vertex_locations);
-    }
-  else if (reference_cell == ReferenceCells::Pyramid)
-    {
-      const std::vector<std::vector<Point<3>>> face_vertex_locations = {
-        {{Point<3>(-1.0, -1.0, 0.0),
-          Point<3>(+1.0, -1.0, 0.0),
-          Point<3>(-1.0, +1.0, 0.0),
-          Point<3>(+1.0, +1.0, 0.0)}},
-        {{Point<3>(-1.0, -1.0, 0.0),
-          Point<3>(-1.0, +1.0, 0.0),
-          Point<3>(+0.0, +0.0, 1.0)}},
-        {{Point<3>(+1.0, +1.0, 0.0),
-          Point<3>(+1.0, -1.0, 0.0),
-          Point<3>(+0.0, +0.0, 1.0)}},
-        {{Point<3>(+1.0, -1.0, 0.0),
-          Point<3>(-1.0, -1.0, 0.0),
-          Point<3>(+0.0, +0.0, 1.0)}},
-        {{Point<3>(-1.0, +1.0, 0.0),
-          Point<3>(+1.0, +1.0, 0.0),
-          Point<3>(+0.0, +0.0, 1.0)}}};
+      std::vector<std::vector<Point<3>>> face_vertex_locations(
+        reference_cell.n_faces());
+      for (unsigned int f : reference_cell.face_indices())
+        {
+          face_vertex_locations[f].resize(
+            reference_cell.face_reference_cell(f).n_vertices());
+          for (unsigned int v :
+               reference_cell.face_reference_cell(f).vertex_indices())
+            face_vertex_locations[f][v] =
+              reference_cell.face_vertex_location<3>(f, v);
+        }
 
       return process(face_vertex_locations);
     }

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.