]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added function to get a std::map with all vertex in the boundaries, as requested...
authorFernando Posada <eposada@sissa.it>
Tue, 31 Mar 2015 05:50:30 +0000 (07:50 +0200)
committerFernando Posada <eposada@sissa.it>
Tue, 31 Mar 2015 09:06:07 +0000 (11:06 +0200)
include/deal.II/grid/grid_tools.h
source/grid/grid_tools.cc
source/grid/grid_tools.inst.in

index a2d0b0a02b3767d14df58826fef72d029b78283d..5cbcd29f4722e86ce2d41af1b63a339a2d0d5a1c 100644 (file)
@@ -296,6 +296,14 @@ namespace GridTools
                           Triangulation<dim> &tria,
                           const Function<dim,double> *coefficient = 0);
 
+  /**
+  *
+  *
+  */
+  template<int dim>
+  std::map<unsigned int,Point<dim> >
+  get_all_vertex_at_boundary (const Triangulation<dim> &tria);
+
   /**
    * Scale the entire triangulation by the given factor. To preserve the
    * orientation of the triangulation, the factor must be positive.
index c9e5d9d2a74c9887135e933957e94a4d801ad4c7..70b613c7b4085b67982c08a52d6e90d22c7960d9 100644 (file)
@@ -769,6 +769,32 @@ namespace GridTools
   }
 
 
+  template<int dim>
+  std::map<unsigned int,Point<dim> >
+  get_all_vertex_at_boundary (const Triangulation<dim> &tria)
+  {
+    std::map<unsigned int, Point<dim> > vertex_map;   
+    typename Triangulation<dim>::active_cell_iterator
+    cell = tria.begin_active(),
+    endc = tria.end();
+    for (; cell!=endc; ++cell)
+    { 
+      for (unsigned int i=0;i<GeometryInfo<dim>::faces_per_cell; ++i)
+      {
+        const auto face = cell->face(i);
+        if (face->at_boundary())
+        {
+          for (unsigned j = 0; j < GeometryInfo<dim>::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 <int dim, int spacedim>
   void
   partition_triangulation (const unsigned int           n_partitions,
index 7c1ae95385ee28d4a54a9b9e4c2f2966461e24dc..beb84584ed5406f83b81975274ac1ce179812815 100644 (file)
@@ -211,6 +211,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
     laplace_transform (const std::map<unsigned int,Point<deal_II_dimension> > &new_points,
                        Triangulation<deal_II_dimension> &triangulation,
                        const Function<deal_II_dimension> *coefficient);
+
+    template
+    std::map<unsigned int,Point<deal_II_dimension> >
+    get_all_vertex_at_boundary (const Triangulation<deal_II_dimension> &tria);
+
 #  endif
 
     template

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.