]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test repeated local refinement of base triangulation 10113/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 10 May 2020 09:14:40 +0000 (11:14 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 10 May 2020 09:14:40 +0000 (11:14 +0200)
tests/fullydistributed_grids/copy_serial_tria_11.cc [new file with mode: 0644]
tests/fullydistributed_grids/copy_serial_tria_11.mpirun=1.output [new file with mode: 0644]

diff --git a/tests/fullydistributed_grids/copy_serial_tria_11.cc b/tests/fullydistributed_grids/copy_serial_tria_11.cc
new file mode 100644 (file)
index 0000000..5584d5d
--- /dev/null
@@ -0,0 +1,84 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 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.
+//
+// ---------------------------------------------------------------------
+
+
+// Test repeated local mesh refinement (test contributed in PR #10092).
+
+#include <deal.II/base/mpi.h>
+
+#include <deal.II/distributed/fully_distributed_tria.h>
+#include <deal.II/distributed/shared_tria.h>
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_description.h>
+
+#include "./tests.h"
+
+using namespace dealii;
+
+
+int
+main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+  initlog();
+
+  Triangulation<3, 3> tria;
+
+  GridGenerator::subdivided_hyper_rectangle(tria,
+                                            {{1.0, 1.0, 1.0, 1.0},
+                                             {1.0, 1.0, 1.0, 1.0},
+                                             {1.0, 1.0, 1.0, 1.0, 1.0, 1.0}},
+                                            Point<3>(-2.0, -2.0, -3.0),
+                                            Point<3>(+2.0, +2.0, +3.0));
+
+  for (auto cell : tria.active_cell_iterators())
+    if (cell->center()[2] < 0.0)
+      cell->set_material_id(1);
+    else
+      cell->set_material_id(0);
+
+  for (unsigned int i = 0; i < 2; ++i)
+    {
+      for (auto cell : tria.active_cell_iterators())
+        {
+          if (cell->material_id() == 1)
+            continue;
+
+          for (unsigned int f = 0; f < GeometryInfo<3>::faces_per_cell; ++f)
+            if (cell->at_boundary(f) == false &&
+                cell->neighbor(f)->material_id() == 1)
+              cell->set_refine_flag();
+        }
+
+      tria.execute_coarsening_and_refinement();
+    }
+
+  parallel::fullydistributed::Triangulation<3> tria_pft(MPI_COMM_WORLD);
+
+  auto construction_data =
+    TriangulationDescription::Utilities::create_description_from_triangulation(
+      tria, MPI_COMM_WORLD);
+
+  tria_pft.create_triangulation(construction_data);
+
+  deallog << "OK!" << std::endl;
+}
diff --git a/tests/fullydistributed_grids/copy_serial_tria_11.mpirun=1.output b/tests/fullydistributed_grids/copy_serial_tria_11.mpirun=1.output
new file mode 100644 (file)
index 0000000..5cfb783
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::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.