]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make the awkward map a returned value, rather than a reference argument.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 2010 23:31:18 +0000 (23:31 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 2010 23:31:18 +0000 (23:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@22987 0785d39b-7218-0410-832d-ea1e28bc413d

15 files changed:
deal.II/examples/step-38/step-38.cc
deal.II/include/deal.II/grid/grid_tools.h
deal.II/source/grid/grid_tools.cc
deal.II/source/grid/grid_tools.inst.in
tests/codim_one/direction_flag_01.cc
tests/codim_one/direction_flag_02.cc
tests/codim_one/extract_boundary_mesh_00.cc
tests/codim_one/extract_boundary_mesh_01.cc
tests/codim_one/extract_boundary_mesh_02.cc
tests/codim_one/extract_boundary_mesh_03.cc
tests/codim_one/extract_boundary_mesh_04.cc
tests/codim_one/extract_boundary_mesh_05.cc
tests/codim_one/extract_boundary_mesh_06.cc
tests/codim_one/interpolate_boundary_values_1d_closed_ring.cc
tests/codim_one/normal_vectors_01.cc

index e5d78044a62827e8eadb81d5eb802fc8ccaf01e5..ad2e48152cb93ec769e3a51d51691b6480fef9cb 100755 (executable)
@@ -205,10 +205,6 @@ LaplaceBeltrami<dim>::~LaplaceBeltrami ()
 template <int dim>
 void LaplaceBeltrami<dim>::make_mesh ()
 {
-  std::map<typename Triangulation<dim-1,dim>::cell_iterator,
-           typename Triangulation<dim,dim>::face_iterator>
-  surface_to_volume_mapping;
-
   HyperBallBoundary<dim> boundary_description;
   Triangulation<dim> volume_mesh;
   GridGenerator::half_hyper_ball(volume_mesh);
@@ -225,7 +221,6 @@ void LaplaceBeltrami<dim>::make_mesh ()
   boundary_ids.insert(0);
   
   GridTools::extract_boundary_mesh (volume_mesh, triangulation,
-                                   surface_to_volume_mapping,
                                    boundary_ids);
   triangulation.refine_global(3);
 
index 77d682ded0faf8cec6f6f59211852c6e9aca6e03..48dc6e36bbce1b50f9756cae00fba5bdf210467a 100644 (file)
@@ -804,11 +804,15 @@ class GridTools
                                      * mesh").  The boundary to be extracted
                                      * is specified by a list of
                                      * boundary_ids.  If none is specified
-                                     * the whole boundary will be extracted.
+                                     * the whole boundary will be
+                                     * extracted. The function is used in
+                                     * step-38.
                                      *
                                      * It also builds a mapping linking the
                                      * cells on the surface mesh to the
-                                     * corresponding faces on the volume one.
+                                     * corresponding faces on the volume
+                                     * one. This mapping is the return value
+                                     * of the function.
                                      *
                                      * @note The function builds the surface
                                      * mesh by creating a coarse mesh from
@@ -878,12 +882,11 @@ class GridTools
                                      * curved boundaries.
                                      */
     template <template <int,int> class Container, int dim, int spacedim>
-    static void
+    static
+    std::map<typename Container<dim-1,spacedim>::cell_iterator,
+            typename Container<dim,spacedim>::face_iterator>
     extract_boundary_mesh (const Container<dim,spacedim> &volume_mesh,
                           Container<dim-1,spacedim>     &surface_mesh,
-                          std::map<typename Container<dim-1,spacedim>::cell_iterator,
-                                   typename Container<dim,spacedim>::face_iterator>
-                          &surface_to_volume_mapping,
                           const std::set<unsigned char> &boundary_ids
                           = std::set<unsigned char>());
 
index bfe89e2bf23c31606f00f2b05eef7a75884cd532..466847fc2ea3a6157939ffa791104f9a80f09998 100644 (file)
@@ -1830,19 +1830,19 @@ fix_up_distorted_child_cells (const typename Triangulation<dim,spacedim>::Distor
 
 
 template <template <int,int> class Container, int dim, int spacedim>
-void
+std::map<typename Container<dim-1,spacedim>::cell_iterator,
+        typename Container<dim,spacedim>::face_iterator>
 GridTools::extract_boundary_mesh (const Container<dim,spacedim> &volume_mesh,
                                  Container<dim-1,spacedim>     &surface_mesh,
-                                 std::map<typename Container<dim-1,spacedim>::cell_iterator,
-                                 typename Container<dim,spacedim>::face_iterator>
-                                   &surface_to_volume_mapping,
                                  const std::set<unsigned char> &boundary_ids)
 {
 // Assumption:
 //    We are relying below on the fact that Triangulation::create_triangulation(...) will keep the order
 //    pass by CellData and that it will not reorder the vertices.
 
-  surface_to_volume_mapping.clear();
+  std::map<typename Container<dim-1,spacedim>::cell_iterator,
+    typename Container<dim,spacedim>::face_iterator>
+  surface_to_volume_mapping;
 
   const unsigned int boundary_dim = dim-1; //dimension of the boundary mesh
 
@@ -1939,6 +1939,8 @@ GridTools::extract_boundary_mesh (const Container<dim,spacedim> &volume_mesh,
        break;
     }
   while (true);
+
+  return surface_to_volume_mapping;
 }
 
 // explicit instantiations
index e4b4f392d98202e6fc1a044e5fd9ebf0b70c0364..7a507444a4548ab61ba2018da431ced2b0d72198 100644 (file)
@@ -213,12 +213,10 @@ for (deal_II_dimension : DIMENSIONS)
   {
 #if deal_II_dimension != 1
     template
-      void
+      std::map<  Triangulation<deal_II_dimension-1,deal_II_dimension>::cell_iterator,
+                Triangulation<deal_II_dimension>::face_iterator>
       GridTools::extract_boundary_mesh (const Triangulation<deal_II_dimension> &volume_mesh,
                                        Triangulation<deal_II_dimension-1,deal_II_dimension>  &surface_mesh,
-                                       std::map<  Triangulation<deal_II_dimension-1,deal_II_dimension>::cell_iterator,
-                                                  Triangulation<deal_II_dimension>::face_iterator>
-      &surface_to_volume_mapping,
                                        const std::set<unsigned char> &boundary_ids);
 #endif
   }
@@ -228,12 +226,10 @@ for (deal_II_dimension : DIMENSIONS; Container : DOFHANDLER_TEMPLATES)
 
 #if deal_II_dimension != 1
     template
-      void
+      std::map<  Container<deal_II_dimension-1,deal_II_dimension>::cell_iterator,
+                Container<deal_II_dimension>::face_iterator>
       GridTools::extract_boundary_mesh (const Container<deal_II_dimension> &volume_mesh,
                                        Container<deal_II_dimension-1,deal_II_dimension>  &surface_mesh,
-                                       std::map<  Container<deal_II_dimension-1,deal_II_dimension>::cell_iterator,
-                                                  Container<deal_II_dimension>::face_iterator>
-      &surface_to_volume_mapping,
                                        const std::set<unsigned char> &boundary_ids);
 #endif
-  }
\ No newline at end of file
+  }
index 8afa7b36eeec1e34c782f0115b1fe645402e6eb9..459e1f211ad087af4a9858bb4feaad75989ba803 100644 (file)
@@ -30,12 +30,9 @@ void test ()
   const unsigned int dim = spacedim-1;
 
   Triangulation<dim,spacedim> boundary_mesh;
-  map<Triangulation<dim,spacedim>::cell_iterator,Triangulation<spacedim,spacedim>::face_iterator >
-    surface_to_volume_mapping;
   Triangulation<spacedim> volume_mesh;
   GridGenerator::hyper_cube(volume_mesh);
-  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                   surface_to_volume_mapping);
+  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
   for (Triangulation<dim,spacedim>::active_cell_iterator
         cell = boundary_mesh.begin_active();
        cell != boundary_mesh.end(); ++cell)
index 525209c614bdca670f6f7ee997ee6132add18be1..09a56be2f3845dee132152210b048f04fe4c9484 100644 (file)
@@ -30,12 +30,9 @@ void test ()
   const unsigned int dim = spacedim-1;
 
   Triangulation<dim,spacedim> boundary_mesh;
-  map<Triangulation<dim,spacedim>::cell_iterator,Triangulation<spacedim,spacedim>::face_iterator >
-    surface_to_volume_mapping;
   Triangulation<spacedim> volume_mesh;
   GridGenerator::hyper_cube(volume_mesh);
-  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                   surface_to_volume_mapping);
+  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
   for (Triangulation<dim,spacedim>::active_cell_iterator
         cell = boundary_mesh.begin_active();
        cell != boundary_mesh.end(); ++cell)
index 831bb59ac2aa513c285c8bbff952bd8b0c896e70..63eb96d55e751771df991e0814cf093c833f4324 100644 (file)
@@ -104,9 +104,8 @@ int main ()
 
     Triangulation<dim-1,dim> boundary_mesh;
 
-
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
 
     if (test_vertices_orientation(boundary_mesh, surface_to_volume_mapping))
       deallog << "Passed.";
@@ -135,9 +134,8 @@ int main ()
 
     Triangulation<dim-1,dim> boundary_mesh;
 
-
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
 
     if (test_vertices_orientation(boundary_mesh, surface_to_volume_mapping))
       deallog << "Passed.";
@@ -170,9 +168,9 @@ int main ()
     set<unsigned char> boundary_ids;
     boundary_ids.insert(0);
 
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping,
-                                     boundary_ids);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
+                                         boundary_ids);
 
     if (test_vertices_orientation(boundary_mesh, surface_to_volume_mapping))
       deallog << "Passed.";
index e7183458cee17006f877630a970240d2bce245bc..bcc413749c6f29a9a615219cf7794c1d2e059df0 100644 (file)
@@ -107,8 +107,8 @@ int main ()
 
     Triangulation<dim-1,dim> boundary_mesh;
 
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
 
     Assert (test_vertices_orientation(boundary_mesh, surface_to_volume_mapping,2),
            ExcInternalError());
index 6da03eb6fc0eda4dbdcc0ecae34a80cb5276ddc4..40e2f06feee23afd1c43271af45bec9ad6156afd 100644 (file)
@@ -100,8 +100,8 @@ int main ()
     Triangulation<dim-1,dim> boundary_mesh;
     boundary_mesh.set_boundary (0, surface_description);
 
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
     deallog << volume_mesh.n_active_cells () << std::endl;
     deallog << boundary_mesh.n_active_cells () << std::endl;
     save_mesh(boundary_mesh);
index 9b01670bc5eb989b9193d9c33f01cfd5038951d1..ba892045ba8e68e687198ac7663f4a8d9e912f45 100644 (file)
@@ -114,8 +114,8 @@ int main ()
     Triangulation<dim-1,dim> boundary_mesh;
     boundary_mesh.set_boundary (1, surface_description);
 
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
     deallog << volume_mesh.n_active_cells () << std::endl;
     deallog << boundary_mesh.n_active_cells () << std::endl;
     save_mesh(boundary_mesh);
index 2bac4696be19c407dbfe195a81ff3c89d3271ca3..d7a6c5703dc501638ea258ce9bea840da7f12a88 100644 (file)
@@ -120,9 +120,9 @@ int main ()
     set<unsigned char> boundary_ids;
     boundary_ids.insert(1);
 
-    GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                     surface_to_volume_mapping,
-                                     boundary_ids);
+    surface_to_volume_mapping
+      = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
+                                         boundary_ids);
 
     deallog << volume_mesh.n_active_cells () << std::endl;
     deallog << boundary_mesh.n_active_cells () << std::endl;
index ffd07a5ec6398b0e79cae2ad56786bc1a7276c69..bc3fdf4a79f97d5e5156c17ab4807e61c6006591 100644 (file)
@@ -38,8 +38,8 @@ void test ()
   Triangulation<dim> volume_mesh;
   GridGenerator::hyper_cube(volume_mesh);
 
-  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                   surface_to_volume_mapping);
+  surface_to_volume_mapping
+    = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
 
   FE_Q <dim-1,dim>  boundary_fe (1);
   DoFHandler<dim-1,dim> boundary_dh(boundary_mesh);
index f88f023b446ca4ec351f7c77bf2b48540fc40453..96e7eed0765981526bae969c01bb8bde37a84824 100644 (file)
@@ -39,8 +39,8 @@ void test ()
   Triangulation<spacedim> volume_mesh;
   GridGenerator::hyper_cube(volume_mesh);
   volume_mesh.refine_global(1);
-  GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh,
-                                   surface_to_volume_mapping);
+  surface_to_volume_mapping
+    = GridTools::extract_boundary_mesh (volume_mesh, boundary_mesh);
   boundary_mesh.refine_global(1);
 
   for (Triangulation<dim,spacedim>::active_cell_iterator
index ba5d43a9e9ba079505ad9c2744b18d1ae9122c1d..9ce59ed03e7a55acb5d955b5cb32df698ac05f73 100644 (file)
@@ -50,8 +50,8 @@ void test() {
   Triangulation<spacedim> volume_mesh;
   GridGenerator::hyper_cube(volume_mesh);
 
-  GridTools::extract_boundary_mesh (volume_mesh, tria,
-                                     surface_to_volume_mapping);
+  surface_to_volume_mapping
+    = GridTools::extract_boundary_mesh (volume_mesh, tria);
 
     FE_Q<dim,spacedim> fe(2);
     DoFHandler<dim,spacedim> dof_handler (tria);
index ec33ec0db9e9aaaa7961477414ff7e88576c812a..7b6a0160cf8f0475b63da5fb867fe12424fb0c36 100644 (file)
@@ -53,9 +53,9 @@ void test ()
   std::set<unsigned char> boundary_ids;
   boundary_ids.insert(0);
   
-  GridTools::extract_boundary_mesh (volume_mesh, tria,
-                                   surface_to_volume_mapping,
-                                   boundary_ids);
+  surface_to_volume_mapping
+    = GridTools::extract_boundary_mesh (volume_mesh, tria,
+                                       boundary_ids);
   
   FE_Q<dim-1,dim> fe (1);
   DoFHandler<dim-1,dim> dh(tria);

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.