From 30725ddf9ec9eaec39dce10d67175f18240bcb8e Mon Sep 17 00:00:00 2001 From: Fernando Posada Date: Tue, 31 Mar 2015 07:50:30 +0200 Subject: [PATCH] Added function to get a std::map with all vertex in the boundaries, as requested in the laplace_transform method --- include/deal.II/grid/grid_tools.h | 8 ++++++++ source/grid/grid_tools.cc | 27 ++++++++++++++++++++++++++- source/grid/grid_tools.inst.in | 5 +++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index a2d0b0a02b..5cbcd29f47 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -296,6 +296,14 @@ namespace GridTools Triangulation &tria, const Function *coefficient = 0); + /** + * + * + */ + template + std::map > + get_all_vertex_at_boundary (const Triangulation &tria); + /** * Scale the entire triangulation by the given factor. To preserve the * orientation of the triangulation, the factor must be positive. diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index c9e5d9d2a7..70b613c7b4 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -769,6 +769,32 @@ namespace GridTools } + template + std::map > + get_all_vertex_at_boundary (const Triangulation &tria) + { + std::map > vertex_map; + typename Triangulation::active_cell_iterator + cell = tria.begin_active(), + endc = tria.end(); + for (; cell!=endc; ++cell) + { + for (unsigned int i=0;i::faces_per_cell; ++i) + { + const auto face = cell->face(i); + if (face->at_boundary()) + { + for (unsigned j = 0; j < GeometryInfo::vertices_per_face; ++j) + { + const auto vertex = face->vertex(j); + const auto vertex_index = face->vertex_index(j); + vertex_map[vertex_index] = vertex / vertex.norm(); + } + } + } + } + return vertex_map; + } /** * Distort a triangulation in @@ -1562,7 +1588,6 @@ next_cell: } - template void partition_triangulation (const unsigned int n_partitions, diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index 7c1ae95385..beb84584ed 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -211,6 +211,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS laplace_transform (const std::map > &new_points, Triangulation &triangulation, const Function *coefficient); + + template + std::map > + get_all_vertex_at_boundary (const Triangulation &tria); + # endif template -- 2.39.5