From fc70316d4d1f267c6084b3c316d30e2591f377cf Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 18 Jun 2022 10:38:33 +0900 Subject: [PATCH] Can't use ReferenceCells in switch-case. --- source/cgal/surface_mesh.cc | 39 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/source/cgal/surface_mesh.cc b/source/cgal/surface_mesh.cc index c4f0befdb9..da6fe521a6 100644 --- a/source/cgal/surface_mesh.cc +++ b/source/cgal/surface_mesh.cc @@ -34,27 +34,28 @@ namespace const auto reference_cell_type = face->reference_cell(); std::vector 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()); -- 2.39.5