From 89967cb039f3901454f2b3c30c289dc72be14261 Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 19 Oct 2023 09:49:14 -0400 Subject: [PATCH] Move another function to grid_tools_geometry.h. --- include/deal.II/grid/grid_tools.h | 16 ---------- include/deal.II/grid/grid_tools_geometry.h | 17 ++++++++++ source/grid/grid_tools.cc | 32 ------------------- source/grid/grid_tools.inst.in | 36 ---------------------- source/grid/grid_tools_geometry.cc | 33 ++++++++++++++++++++ source/grid/grid_tools_geometry.inst.in | 15 +++++++++ 6 files changed, 65 insertions(+), 84 deletions(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index b1aa321e4d..d8fe636706 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -2112,22 +2112,6 @@ namespace GridTools compute_local_to_global_vertex_index_map( const parallel::distributed::Triangulation &triangulation); - /** - * Return the highest value among ratios between extents in each of the - * coordinate directions of a @p cell. Moreover, return the dimension - * relative to the highest elongation. - * - * @param[in] cell an iterator pointing to the cell. - * - * @return A std::pair such that the @p first value - * is the dimension of the highest elongation and the @p second value is the - * ratio among the dimensions of the @p cell. - */ - template - std::pair - get_longest_direction( - typename Triangulation::active_cell_iterator cell); - /** @} */ /** * @name Partitions and subdomains of triangulations diff --git a/include/deal.II/grid/grid_tools_geometry.h b/include/deal.II/grid/grid_tools_geometry.h index 53b8bd5773..5c7879503a 100644 --- a/include/deal.II/grid/grid_tools_geometry.h +++ b/include/deal.II/grid/grid_tools_geometry.h @@ -31,6 +31,7 @@ #include #include #include +#include #include DEAL_II_NAMESPACE_OPEN @@ -181,6 +182,22 @@ namespace GridTools cell_measure(const std::vector> &all_vertices, const ArrayView &vertex_indices); + /** + * Return the highest value among ratios between extents in each of the + * coordinate directions of a @p cell. Moreover, return the dimension + * relative to the highest elongation. + * + * @param[in] cell an iterator pointing to the cell. + * + * @return A std::pair such that the @p first value + * is the dimension of the highest elongation and the @p second value is the + * ratio among the dimensions of the @p cell. + */ + template + std::pair + get_longest_direction( + typename Triangulation::active_cell_iterator cell); + /** * This function computes an affine approximation of the map from the unit * coordinates to the real coordinates of the form $p_\text{real} = A diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index cec677b5cb..e21c012af9 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -4803,38 +4803,6 @@ namespace GridTools - template - std::pair - get_longest_direction( - typename Triangulation::active_cell_iterator cell) - { - double max_ratio = 1; - unsigned int index = 0; - - for (unsigned int i = 0; i < dim; ++i) - for (unsigned int j = i + 1; j < dim; ++j) - { - unsigned int ax = i % dim; - unsigned int next_ax = j % dim; - - double ratio = - cell->extent_in_direction(ax) / cell->extent_in_direction(next_ax); - - if (ratio > max_ratio) - { - max_ratio = ratio; - index = ax; - } - else if (1.0 / ratio > max_ratio) - { - max_ratio = 1.0 / ratio; - index = next_ax; - } - } - return std::make_pair(index, max_ratio); - } - - template void remove_hanging_nodes(Triangulation &tria, diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index 4824f73888..3f4fd209e7 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -498,42 +498,6 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) #endif } - -for (deal_II_dimension : DIMENSIONS) - { - template std::pair - GridTools::get_longest_direction( - Triangulation::active_cell_iterator); - - template void - GridTools::remove_hanging_nodes( - Triangulation & tria, bool, unsigned int); - - template void - GridTools::remove_anisotropy( - Triangulation &, double, unsigned int); - -#if deal_II_dimension < 3 - template std::pair - GridTools::get_longest_direction( - Triangulation::active_cell_iterator); - - template void - GridTools::remove_hanging_nodes( - Triangulation & tria, - bool, - unsigned int); - - template void - GridTools::remove_anisotropy( - Triangulation &, - double, - unsigned int); -#endif - } - for (deal_II_vec : REAL_NONBLOCK_VECTORS; deal_II_dimension : DIMENSIONS) { template class GridTools::MarchingCubeAlgorithm + std::pair + get_longest_direction( + typename Triangulation::active_cell_iterator cell) + { + double max_ratio = 1; + unsigned int index = 0; + + for (unsigned int i = 0; i < dim; ++i) + for (unsigned int j = i + 1; j < dim; ++j) + { + unsigned int ax = i % dim; + unsigned int next_ax = j % dim; + + double ratio = + cell->extent_in_direction(ax) / cell->extent_in_direction(next_ax); + + if (ratio > max_ratio) + { + max_ratio = ratio; + index = ax; + } + else if (1.0 / ratio > max_ratio) + { + max_ratio = 1.0 / ratio; + index = next_ax; + } + } + return std::make_pair(index, max_ratio); + } + + + namespace { /** diff --git a/source/grid/grid_tools_geometry.inst.in b/source/grid/grid_tools_geometry.inst.in index 5695304d95..49befa1ffd 100644 --- a/source/grid/grid_tools_geometry.inst.in +++ b/source/grid/grid_tools_geometry.inst.in @@ -71,3 +71,18 @@ for (deal_II_space_dimension : SPACE_DIMENSIONS) const Quadrature &); \} } + +for (deal_II_dimension : DIMENSIONS) + { + template std::pair + GridTools::get_longest_direction( + Triangulation::active_cell_iterator); + +#if deal_II_dimension < 3 + template std::pair + GridTools::get_longest_direction( + Triangulation::active_cell_iterator); +#endif + } -- 2.39.5