--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2008 - 2015 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// create a shared tria mesh and distribute with a custom function
+//
+// this is like the tria_custom_refine01 test except that it attaches
+// a lambda function rather than a (bound) function pointer to the
+// signal
+
+#include "../tests.h"
+#include <deal.II/base/tensor.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/distributed/shared_tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_generator.h>
+
+
+
+template <int dim>
+void test()
+{
+ parallel::shared::Triangulation<dim> shared_tria(MPI_COMM_WORLD,typename Triangulation<dim>::MeshSmoothing
+ (Triangulation<dim>::limit_level_difference_at_vertices), true,
+ parallel::shared::Triangulation<dim>::partition_custom_signal);
+ shared_tria.signals.post_refinement.connect ([&shared_tria]()
+ {
+ const unsigned int nproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);
+
+ typename Triangulation<dim>::active_cell_iterator
+ cell = shared_tria.begin_active();
+ for (unsigned int i=0; i < shared_tria.n_active_cells(); ++i)
+ {
+ unsigned int j=0;
+ if (i<4)
+ j=1;
+ else if (i<8)
+ j=2;
+
+ cell->set_subdomain_id(j % nproc);
+ ++cell;
+ }
+ });
+
+
+ GridGenerator::hyper_L(shared_tria);
+ shared_tria.refine_global();
+ typename Triangulation<dim>::active_cell_iterator it = shared_tria.begin_active();
+ it->set_refine_flag();
+ shared_tria.execute_coarsening_and_refinement ();
+
+ deallog << "(CellId,subdomain_id) for each active cell:" << std::endl;
+ typename Triangulation<dim>::active_cell_iterator
+ cell = shared_tria.begin_active(),
+ endc = shared_tria.end();
+ for (; cell!=endc; ++cell)
+ if (cell->subdomain_id() != numbers::artificial_subdomain_id)
+ deallog << "(" << cell->id().to_string() << "," << cell->subdomain_id() << ")" << std::endl;
+}
+
+int main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+ MPILogInitAll all;
+
+ deallog.push("2d");
+ test<2>();
+ deallog.pop();
+ deallog.push("3d");
+ test<3>();
+ deallog.pop();
+
+ deallog << "OK" << std::endl;
+}
+
--- /dev/null
+
+DEAL:0:2d::(CellId,subdomain_id) for each active cell:
+DEAL:0:2d::(0_1:1,1)
+DEAL:0:2d::(0_1:2,1)
+DEAL:0:2d::(0_1:3,1)
+DEAL:0:2d::(1_1:2,2)
+DEAL:0:2d::(2_1:0,2)
+DEAL:0:2d::(2_1:1,0)
+DEAL:0:2d::(2_1:2,0)
+DEAL:0:2d::(2_1:3,0)
+DEAL:0:2d::(0_2:00,0)
+DEAL:0:2d::(0_2:01,0)
+DEAL:0:2d::(0_2:02,0)
+DEAL:0:2d::(0_2:03,0)
+DEAL:0:3d::(CellId,subdomain_id) for each active cell:
+DEAL:0:3d::(0_1:1,1)
+DEAL:0:3d::(0_1:2,1)
+DEAL:0:3d::(0_1:3,1)
+DEAL:0:3d::(0_1:4,1)
+DEAL:0:3d::(0_1:5,2)
+DEAL:0:3d::(0_1:6,2)
+DEAL:0:3d::(0_1:7,2)
+DEAL:0:3d::(1_1:0,2)
+DEAL:0:3d::(1_1:1,0)
+DEAL:0:3d::(1_1:2,0)
+DEAL:0:3d::(1_1:3,0)
+DEAL:0:3d::(1_1:4,0)
+DEAL:0:3d::(1_1:5,0)
+DEAL:0:3d::(1_1:6,0)
+DEAL:0:3d::(1_1:7,0)
+DEAL:0:3d::(2_1:0,0)
+DEAL:0:3d::(2_1:1,0)
+DEAL:0:3d::(2_1:2,0)
+DEAL:0:3d::(2_1:3,0)
+DEAL:0:3d::(2_1:4,0)
+DEAL:0:3d::(2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:2d::(1_1:1,2)
+DEAL:1:2d::(1_1:2,2)
+DEAL:1:2d::(1_1:3,2)
+DEAL:1:2d::(2_1:0,2)
+DEAL:1:2d::(2_1:1,0)
+DEAL:1:2d::(0_2:01,0)
+DEAL:1:2d::(0_2:02,0)
+DEAL:1:2d::(0_2:03,0)
+DEAL:1:3d::(CellId,subdomain_id) for each active cell:
+DEAL:1:3d::(0_1:1,1)
+DEAL:1:3d::(0_1:2,1)
+DEAL:1:3d::(0_1:3,1)
+DEAL:1:3d::(0_1:4,1)
+DEAL:1:3d::(0_1:5,2)
+DEAL:1:3d::(0_1:6,2)
+DEAL:1:3d::(0_1:7,2)
+DEAL:1:3d::(1_1:0,2)
+DEAL:1:3d::(1_1:2,0)
+DEAL:1:3d::(1_1:4,0)
+DEAL:1:3d::(1_1:6,0)
+DEAL:1:3d::(2_1:0,0)
+DEAL:1:3d::(2_1:1,0)
+DEAL:1:3d::(2_1:2,0)
+DEAL:1:3d::(2_1:3,0)
+DEAL:1:3d::(4_1:0,0)
+DEAL:1:3d::(4_1:1,0)
+DEAL:1:3d::(4_1:4,0)
+DEAL:1:3d::(4_1:5,0)
+DEAL:1:3d::(5_1:0,0)
+DEAL:1:3d::(5_1:4,0)
+DEAL:1:3d::(0_2:01,0)
+DEAL:1:3d::(0_2:02,0)
+DEAL:1:3d::(0_2:03,0)
+DEAL:1:3d::(0_2:04,0)
+DEAL:1:3d::(0_2:05,0)
+DEAL:1:3d::(0_2:06,0)
+DEAL:1:3d::(0_2:07,0)
+DEAL:1::OK
+
+
+DEAL:2:2d::(CellId,subdomain_id) for each active cell:
+DEAL:2:2d::(0_1:1,1)
+DEAL:2:2d::(0_1:2,1)
+DEAL:2:2d::(0_1:3,1)
+DEAL:2:2d::(1_1:0,1)
+DEAL:2:2d::(1_1:1,2)
+DEAL:2:2d::(1_1:2,2)
+DEAL:2:2d::(1_1:3,2)
+DEAL:2:2d::(2_1:0,2)
+DEAL:2:2d::(2_1:1,0)
+DEAL:2:2d::(2_1:2,0)
+DEAL:2:2d::(2_1:3,0)
+DEAL:2:3d::(CellId,subdomain_id) for each active cell:
+DEAL:2:3d::(0_1:1,1)
+DEAL:2:3d::(0_1:2,1)
+DEAL:2:3d::(0_1:3,1)
+DEAL:2:3d::(0_1:4,1)
+DEAL:2:3d::(0_1:5,2)
+DEAL:2:3d::(0_1:6,2)
+DEAL:2:3d::(0_1:7,2)
+DEAL:2:3d::(1_1:0,2)
+DEAL:2:3d::(1_1:1,0)
+DEAL:2:3d::(1_1:2,0)
+DEAL:2:3d::(1_1:3,0)
+DEAL:2:3d::(1_1:4,0)
+DEAL:2:3d::(1_1:5,0)
+DEAL:2:3d::(1_1:6,0)
+DEAL:2:3d::(1_1:7,0)
+DEAL:2:3d::(2_1:0,0)
+DEAL:2:3d::(2_1:1,0)
+DEAL:2:3d::(2_1:2,0)
+DEAL:2:3d::(2_1:3,0)
+DEAL:2:3d::(3_1:0,0)
+DEAL:2:3d::(3_1:2,0)
+DEAL:2:3d::(4_1:0,0)
+DEAL:2:3d::(4_1:1,0)
+DEAL:2:3d::(4_1:4,0)
+DEAL:2:3d::(4_1:5,0)
+DEAL:2:3d::(5_1:0,0)
+DEAL:2:3d::(5_1:4,0)
+DEAL:2:3d::(6_1:0,0)
+DEAL:2:3d::(6_1:1,0)
+DEAL:2:3d::(0_2:05,0)
+DEAL:2:3d::(0_2:06,0)
+DEAL:2:3d::(0_2:07,0)
+DEAL:2::OK
+