From: David Wells Date: Mon, 12 May 2025 21:27:56 +0000 (-0400) Subject: convert_hypercube_to_simplex_mesh(): combine the two templates. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e2de3c106c250f758dbe712a90496309d6e8ddb;p=dealii.git convert_hypercube_to_simplex_mesh(): combine the two templates. --- diff --git a/include/deal.II/grid/grid_generator.h b/include/deal.II/grid/grid_generator.h index c081235abc..f2861d27a5 100644 --- a/include/deal.II/grid/grid_generator.h +++ b/include/deal.II/grid/grid_generator.h @@ -2411,25 +2411,15 @@ namespace GridGenerator * * @note This function is available through the python interface as * `in_tria.convert_hypercube_to_simplex_mesh(out_tria)`. + * + * @note in 1d this function copies @p in_tria into @p out_tria since 1d + * elements (lines) are both hypercubes and simplices. */ template void convert_hypercube_to_simplex_mesh(const Triangulation &in_tria, Triangulation &out_tria); - // Doxygen will not show the function above if we include the - // specialization. -#ifndef DOXYGEN - /** - * Specialization of the above function for 1d: simply copy triangulation. - */ - template - void - convert_hypercube_to_simplex_mesh(const Triangulation<1, spacedim> &in_tria, - Triangulation<1, spacedim> &out_tria); -#endif - - /** * Perform an Alfeld split (also called barycentric refinement) of a simplex * mesh. diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 139d78e6e2..20ca4031af 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -7993,7 +7993,12 @@ namespace GridGenerator convert_hypercube_to_simplex_mesh(const Triangulation &in_tria, Triangulation &out_tria) { - Assert(dim > 1, ExcNotImplemented()); + if (dim == 1) + { + out_tria.copy_triangulation(in_tria); + return; + } + AssertThrow(in_tria.all_reference_cells_are_hyper_cube(), ExcMessage( "GridGenerator::convert_hypercube_to_simplex_mesh() expects " @@ -8410,17 +8415,6 @@ namespace GridGenerator - template - void - convert_hypercube_to_simplex_mesh(const Triangulation<1, spacedim> &in_tria, - Triangulation<1, spacedim> &out_tria) - { - out_tria.copy_triangulation(in_tria); - return; - } - - - template void alfeld_split_of_simplex_mesh(const Triangulation &in_tria,