From 194493e9efabd00beb29386b2b7d0505167d36e7 Mon Sep 17 00:00:00 2001 From: Johannes Heinz Date: Wed, 25 Jan 2023 14:50:10 +0100 Subject: [PATCH] Get vertices in CGAL order on face --- include/deal.II/cgal/utilities.h | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/deal.II/cgal/utilities.h b/include/deal.II/cgal/utilities.h index bca24647f8..421655da16 100644 --- a/include/deal.II/cgal/utilities.h +++ b/include/deal.II/cgal/utilities.h @@ -625,6 +625,42 @@ namespace CGALWrappers return vertices; } + /** + * Get vertices of face in CGAL ordering + * + * @param cell A cell_iterator to a deal.II cell. + * @param face_no The face number within the given cell. + * @param mapping Mapping object for the cell. + * @return Array of vertices in CGAL order. + */ + template + std::vector> + get_vertices_in_cgal_order( + const typename dealii::Triangulation::cell_iterator &cell, + const unsigned int face_no, + const Mapping & mapping) + { + // Elements have to be rectangular or simplices + const unsigned int n_vertices = cell->face(face_no)->n_vertices(); + Assert( + (n_vertices == ReferenceCells::get_hypercube().n_vertices()) || + (n_vertices == ReferenceCells::get_simplex().n_vertices()), + ExcNotImplemented()); + + std::vector> ordered_vertices(n_vertices); + std::copy_n(mapping.get_vertices(cell, face_no).begin(), + n_vertices, + ordered_vertices.begin()); + + if (ReferenceCell::n_vertices_to_type(dim - 1, n_vertices) == + ReferenceCells::Quadrilateral) + std::swap(ordered_vertices[2], ordered_vertices[3]); + + return ordered_vertices; + } + + + } // namespace CGALWrappers # endif -- 2.39.5