]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test. 4861/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 15 Aug 2017 17:20:38 +0000 (11:20 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 16 Aug 2017 03:06:22 +0000 (21:06 -0600)
tests/sharedtria/tria_custom_refine01_cxx11.cc [new file with mode: 0644]
tests/sharedtria/tria_custom_refine01_cxx11.mpirun=3.output [new file with mode: 0644]

diff --git a/tests/sharedtria/tria_custom_refine01_cxx11.cc b/tests/sharedtria/tria_custom_refine01_cxx11.cc
new file mode 100644 (file)
index 0000000..a8e8bda
--- /dev/null
@@ -0,0 +1,89 @@
+// ---------------------------------------------------------------------
+//
+// 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;
+}
+
diff --git a/tests/sharedtria/tria_custom_refine01_cxx11.mpirun=3.output b/tests/sharedtria/tria_custom_refine01_cxx11.mpirun=3.output
new file mode 100644 (file)
index 0000000..2ae81a1
--- /dev/null
@@ -0,0 +1,172 @@
+
+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)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0:3d::(6_1:0,0)
+DEAL:0:3d::(6_1:1,0)
+DEAL:0:3d::(6_1:2,0)
+DEAL:0:3d::(6_1:3,0)
+DEAL:0:3d::(6_1:4,0)
+DEAL:0:3d::(6_1:5,0)
+DEAL:0:3d::(6_1:6,0)
+DEAL:0:3d::(6_1:7,0)
+DEAL:0:3d::(0_2:00,0)
+DEAL:0:3d::(0_2:01,0)
+DEAL:0:3d::(0_2:02,0)
+DEAL:0:3d::(0_2:03,0)
+DEAL:0:3d::(0_2:04,0)
+DEAL:0:3d::(0_2:05,0)
+DEAL:0:3d::(0_2:06,0)
+DEAL:0:3d::(0_2:07,0)
+DEAL:0::OK
+
+DEAL:1:2d::(CellId,subdomain_id) for each active cell:
+DEAL:1:2d::(0_1:1,1)
+DEAL:1:2d::(0_1:2,1)
+DEAL:1:2d::(0_1:3,1)
+DEAL:1:2d::(1_1:0,1)
+DEAL:1: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
+

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.