* Given the two triangulations specified as the first two arguments, create
* the triangulation that contains the cells of both triangulation and store
* it in the third parameter. Previous content of @p result will be deleted.
+ * One of the two input triangulations can also be the @p result triangulation.
*
* This function is most often used to compose meshes for more complicated
* geometries if the geometry can be composed of simpler parts for which
* @note This function is used in step-14 and step-19.
*
* @note This function triggers the "create" signal after doing its work. See
- * the section on signals in the general documentation of this class.
+ * the section on signals in the general documentation of this class. For
+ * example as a consequence of this, all DoFHandler objects connected to
+ * this triangulation will be reinitialized via DoFHandler::reinit().
*
* @note The check for distorted cells is only done if dim==spacedim, as
* otherwise cells can legitimately be twisted if the manifold they describe
{
// connect functions to signals of the underlying triangulation
this->tria_listeners.push_back(this->tria->signals.create.connect(
- [this]() { this->create_active_fe_table(); }));
+ [this]() { this->reinit(*(this->tria)); }));
// attach corresponding callback functions dealing with the transfer of
// active FE indices depending on the type of triangulation
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2021 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Consider a Triangulation with a connected DoFHandler.
+// When Triangulation::create_triangulation() gets called (e.g. in
+// GridGenerator::merge_triangulations()) the corresponding create signal
+// gets triggered.
+// At some point, we forgot to reset the DoFHandler at this stage.
+
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+
+#include "../tests.h"
+
+
+template <int dim>
+void
+test()
+{
+ Triangulation<dim> triangulation;
+ DoFHandler<dim> dof_handler(triangulation);
+
+ /*Make a square*/
+ Point<dim> point_1, point_2;
+ point_1(0) = 0;
+ point_1(1) = 0;
+ point_2(0) = 1;
+ point_2(1) = 1;
+ GridGenerator::hyper_rectangle(triangulation, point_1, point_2);
+
+ Triangulation<dim> triangulation_temp;
+ point_1(0) = 1;
+ point_2(0) = 2;
+ GridGenerator::hyper_rectangle(triangulation_temp, point_1, point_2);
+ /*glue squares together*/
+ GridGenerator::merge_triangulations(triangulation_temp,
+ triangulation,
+ triangulation);
+
+ deallog << "OK" << std::endl;
+}
+
+int
+main()
+{
+ initlog();
+
+ deallog.push("2d");
+ test<2>();
+ deallog.pop();
+}