const FullMatrix<double> &matrix = FullMatrix<double>(),
const std::vector<unsigned int> &first_vector_components = std::vector<unsigned int>());
+ /*@}*/
+ /**
+ * @name Dealing with boundary and manifold ids
+ */
+ /*@{*/
+
+ /**
+ * Copy boundary ids to manifold ids. The default manifold_id for
+ * new Triangulation objects is numbers::invalid_manifold_id. When
+ * refinements occurs, the Triangulation asks where to locate new
+ * points to the underlying manifold, and if the manifold_id of a
+ * boundary face is set to numbers::invalid_manifold_id, then
+ * Triangulation reverts back boundary_id (this was the behavior of
+ * deal.II < 8.2). This function copies the boundary_ids of the
+ * boundary faces to the manifold_ids of the same faces, allowing
+ * the user to change the boundary_ids and use them for boundary
+ * conditions regardless of the geometry, which will use
+ * manifold_ids to create new points. Only active cells will be
+ * iterated over. This is a function you'd typically call when there
+ * is only one active level on your Triangulation.
+ *
+ * The optional parameter @p reset_boundary_ids, indicates wether
+ * this function should reset the boundary_ids of the Triangulation
+ * to its default value 0 after copying its value to the
+ * manifold_id. By default, boundary_ids are left untouched.
+ *
+ * @ingroup manifold
+ * @ingroup boundary
+ *
+ * @author Luca Heltai, 2015
+ */
+ template <int dim, int spacedim>
+ void copy_boundary_to_manifold_id(Triangulation<dim, spacedim> &tria,
+ bool reset_boundary_ids=false);
/*@}*/
/**
--- /dev/null
+//------------------------------------------------------------
+// Copyright (C) 2015, the deal.II authors
+//
+// This file is subject to LGPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//------------------------------------------------------------
+
+
+// Copy from boundary ids to manifold ids
+
+#include "../tests.h"
+#include <fstream>
+#include <base/logstream.h>
+
+
+// all include files you need here
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/grid_out.h>
+
+template<int dim, int spacedim>
+void print_info(Triangulation<dim,spacedim> &tria) {
+ typename Triangulation<dim,spacedim>::active_cell_iterator cell;
+
+ for (cell = tria.begin_active(); cell != tria.end(); ++cell)
+ {
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ if(cell->face(f)->at_boundary())
+ deallog << "face: " << cell->face(f)
+ << ", boundary_id: "
+ << (int)cell->face(f)->boundary_indicator()
+ << ", manifold_id: "
+ << (int)cell->face(f)->manifold_id() << std::endl;
+ }
+}
+
+
+// Helper function
+template <int dim, int spacedim>
+void test()
+{
+ deallog << "Testing dim=" << dim
+ << ", spacedim="<< spacedim << std::endl;
+
+ Triangulation<dim,spacedim> tria;
+ GridGenerator::hyper_cube (tria, 0., 1., true);
+
+ print_info(tria);
+ GridTools::copy_boundary_to_manifold_id(tria);
+ print_info(tria);
+ GridTools::copy_boundary_to_manifold_id(tria, true);
+ print_info(tria);
+}
+
+int main ()
+{
+ initlog(true);
+
+ test<1,1>();
+ test<1,2>();
+ test<2,2>();
+ test<2,3>();
+ test<3,3>();
+
+ return 0;
+}
+
--- /dev/null
+
+DEAL::Testing dim=1, spacedim=1
+DEAL::face: 0, boundary_id: 0, manifold_id: -1
+DEAL::face: 1, boundary_id: 1, manifold_id: -1
+DEAL::face: 0, boundary_id: 0, manifold_id: 0
+DEAL::face: 1, boundary_id: 1, manifold_id: 1
+DEAL::face: 0, boundary_id: 0, manifold_id: 0
+DEAL::face: 1, boundary_id: 0, manifold_id: 1
+DEAL::Testing dim=1, spacedim=2
+DEAL::face: 0, boundary_id: 0, manifold_id: -1
+DEAL::face: 1, boundary_id: 1, manifold_id: -1
+DEAL::face: 0, boundary_id: 0, manifold_id: 0
+DEAL::face: 1, boundary_id: 1, manifold_id: 1
+DEAL::face: 0, boundary_id: 0, manifold_id: 0
+DEAL::face: 1, boundary_id: 0, manifold_id: 1
+DEAL::Testing dim=2, spacedim=2
+DEAL::face: 1, boundary_id: 0, manifold_id: -1
+DEAL::face: 2, boundary_id: 1, manifold_id: -1
+DEAL::face: 0, boundary_id: 2, manifold_id: -1
+DEAL::face: 3, boundary_id: 3, manifold_id: -1
+DEAL::face: 1, boundary_id: 0, manifold_id: 0
+DEAL::face: 2, boundary_id: 1, manifold_id: 1
+DEAL::face: 0, boundary_id: 2, manifold_id: 2
+DEAL::face: 3, boundary_id: 3, manifold_id: 3
+DEAL::face: 1, boundary_id: 0, manifold_id: 0
+DEAL::face: 2, boundary_id: 0, manifold_id: 1
+DEAL::face: 0, boundary_id: 0, manifold_id: 2
+DEAL::face: 3, boundary_id: 0, manifold_id: 3
+DEAL::Testing dim=2, spacedim=3
+DEAL::face: 1, boundary_id: 0, manifold_id: -1
+DEAL::face: 2, boundary_id: 1, manifold_id: -1
+DEAL::face: 0, boundary_id: 2, manifold_id: -1
+DEAL::face: 3, boundary_id: 3, manifold_id: -1
+DEAL::face: 1, boundary_id: 0, manifold_id: 0
+DEAL::face: 2, boundary_id: 1, manifold_id: 1
+DEAL::face: 0, boundary_id: 2, manifold_id: 2
+DEAL::face: 3, boundary_id: 3, manifold_id: 3
+DEAL::face: 1, boundary_id: 0, manifold_id: 0
+DEAL::face: 2, boundary_id: 0, manifold_id: 1
+DEAL::face: 0, boundary_id: 0, manifold_id: 2
+DEAL::face: 3, boundary_id: 0, manifold_id: 3
+DEAL::Testing dim=3, spacedim=3
+DEAL::face: 2, boundary_id: 0, manifold_id: -1
+DEAL::face: 3, boundary_id: 1, manifold_id: -1
+DEAL::face: 0, boundary_id: 2, manifold_id: -1
+DEAL::face: 4, boundary_id: 3, manifold_id: -1
+DEAL::face: 1, boundary_id: 4, manifold_id: -1
+DEAL::face: 5, boundary_id: 5, manifold_id: -1
+DEAL::face: 2, boundary_id: 0, manifold_id: 0
+DEAL::face: 3, boundary_id: 1, manifold_id: 1
+DEAL::face: 0, boundary_id: 2, manifold_id: 2
+DEAL::face: 4, boundary_id: 3, manifold_id: 3
+DEAL::face: 1, boundary_id: 4, manifold_id: 4
+DEAL::face: 5, boundary_id: 5, manifold_id: 5
+DEAL::face: 2, boundary_id: 0, manifold_id: 0
+DEAL::face: 3, boundary_id: 0, manifold_id: 1
+DEAL::face: 0, boundary_id: 0, manifold_id: 2
+DEAL::face: 4, boundary_id: 0, manifold_id: 3
+DEAL::face: 1, boundary_id: 0, manifold_id: 4
+DEAL::face: 5, boundary_id: 0, manifold_id: 5