From: Johannes Heinz Date: Wed, 25 Jan 2023 13:50:10 +0000 (+0100) Subject: Get vertices in CGAL order on face X-Git-Tag: v9.5.0-rc1~501^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14360%2Fhead;p=dealii.git Get vertices in CGAL order on face --- 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