]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Can't use ReferenceCells in switch-case. 14011/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 18 Jun 2022 01:38:33 +0000 (10:38 +0900)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 18 Jun 2022 01:38:33 +0000 (10:38 +0900)
source/cgal/surface_mesh.cc

index c4f0befdb9168ebc1fd8552b11f70f968b60fcb4..da6fe521a6c82e0b790f5909bf2659f3b3f46bc7 100644 (file)
@@ -34,27 +34,28 @@ namespace
     const auto reference_cell_type = face->reference_cell();
     std::vector<typename CGAL_Mesh::Vertex_index> indices;
 
-    switch (reference_cell_type)
+    if (reference_cell_type == ReferenceCells::Line)
       {
-        case ReferenceCells::Line:
-          mesh.add_edge(deal2cgal.at(face->vertex_index(0)),
-                        deal2cgal.at(face->vertex_index(1)));
-          break;
-        case ReferenceCells::Triangle:
-          indices = {deal2cgal.at(face->vertex_index(0)),
-                     deal2cgal.at(face->vertex_index(1)),
-                     deal2cgal.at(face->vertex_index(2))};
-          break;
-        case ReferenceCells::Quadrilateral:
-          indices = {deal2cgal.at(face->vertex_index(0)),
-                     deal2cgal.at(face->vertex_index(1)),
-                     deal2cgal.at(face->vertex_index(3)),
-                     deal2cgal.at(face->vertex_index(2))};
-          break;
-        default:
-          Assert(false, ExcInternalError());
-          break;
+        mesh.add_edge(deal2cgal.at(face->vertex_index(0)),
+                      deal2cgal.at(face->vertex_index(1)));
       }
+    else if (reference_cell_type == ReferenceCells::Triangle)
+      {
+        indices = {deal2cgal.at(face->vertex_index(0)),
+                   deal2cgal.at(face->vertex_index(1)),
+                   deal2cgal.at(face->vertex_index(2))};
+      }
+
+    else if (reference_cell_type == ReferenceCells::Quadrilateral)
+      {
+        indices = {deal2cgal.at(face->vertex_index(0)),
+                   deal2cgal.at(face->vertex_index(1)),
+                   deal2cgal.at(face->vertex_index(3)),
+                   deal2cgal.at(face->vertex_index(2))};
+      }
+    else
+      Assert(false, ExcInternalError());
+
     if (clockwise_ordering == true)
       std::reverse(indices.begin(), indices.end());
 

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.