]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test for hp::distribute_dofs on p::d::Triangulation. 6939/head
authorMarc Fehling <marc.fehling@gmx.net>
Fri, 20 Jul 2018 17:21:33 +0000 (11:21 -0600)
committerMarc Fehling <marc.fehling@gmx.net>
Fri, 20 Jul 2018 18:41:52 +0000 (12:41 -0600)
tests/mpi/hp_distribute_dofs_01.cc [new file with mode: 0644]
tests/mpi/hp_distribute_dofs_01.mpirun=1.output [new file with mode: 0644]
tests/mpi/hp_distribute_dofs_01.mpirun=2.output [new file with mode: 0644]

diff --git a/tests/mpi/hp_distribute_dofs_01.cc b/tests/mpi/hp_distribute_dofs_01.cc
new file mode 100644 (file)
index 0000000..6a7db60
--- /dev/null
@@ -0,0 +1,89 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2009 - 2018 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// hp::DoFHandler::distribute_dofs failed
+// if a processor only owns artificial cells
+
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/hp/dof_handler.h>
+
+#include "../tests.h"
+
+
+template <int dim>
+void
+test()
+{
+  parallel::distributed::Triangulation<dim> tria(
+    MPI_COMM_WORLD,
+    typename Triangulation<dim>::MeshSmoothing(
+      Triangulation<dim>::smoothing_on_refinement |
+      Triangulation<dim>::smoothing_on_coarsening));
+
+  GridGenerator::hyper_cube(tria, -1.0, 1.0);
+  tria.refine_global(1);
+
+  const unsigned int max_degree = (dim == 2) ? 4 : 8;
+
+  hp::DoFHandler<dim>   dh(tria);
+  hp::FECollection<dim> fe_collection;
+  for (unsigned int degree = 1; degree <= max_degree; ++degree)
+    fe_collection.push_back(FE_Q<dim>(degree));
+
+  dh.distribute_dofs(fe_collection); // <-- fails
+
+  // make sure no processor is
+  // hanging
+  MPI_Barrier(MPI_COMM_WORLD);
+
+  if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
+    deallog << "OK" << std::endl;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+
+
+  unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
+
+  deallog.push(Utilities::int_to_string(myid));
+
+  if (myid == 0)
+    {
+      initlog();
+
+      deallog.push("2d");
+      test<2>();
+      deallog.pop();
+      deallog.push("3d");
+      test<3>();
+      deallog.pop();
+    }
+  else
+    {
+      test<2>();
+      test<3>();
+    }
+}
diff --git a/tests/mpi/hp_distribute_dofs_01.mpirun=1.output b/tests/mpi/hp_distribute_dofs_01.mpirun=1.output
new file mode 100644 (file)
index 0000000..995f6e4
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL:0:2d::OK
+DEAL:0:3d::OK
diff --git a/tests/mpi/hp_distribute_dofs_01.mpirun=2.output b/tests/mpi/hp_distribute_dofs_01.mpirun=2.output
new file mode 100644 (file)
index 0000000..995f6e4
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL:0:2d::OK
+DEAL:0:3d::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.