]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a testcase. 284/head
authorMichał Wichrowski <mtwichrowski@gmail.com>
Thu, 4 Dec 2014 19:58:03 +0000 (13:58 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 4 Dec 2014 19:58:03 +0000 (13:58 -0600)
tests/mpi/cuthill_mckee_01.cc [new file with mode: 0644]
tests/mpi/cuthill_mckee_01.mpirun=1.output [new file with mode: 0644]
tests/mpi/cuthill_mckee_01.mpirun=4.output [new file with mode: 0644]

diff --git a/tests/mpi/cuthill_mckee_01.cc b/tests/mpi/cuthill_mckee_01.cc
new file mode 100644 (file)
index 0000000..3d0db2e
--- /dev/null
@@ -0,0 +1,73 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Test by Michal Wichrowski: ensure that
+// DoFRenumbering::Cuthill_McKee also works on empty processors
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/mpi.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_renumbering.h>
+#include <deal.II/fe/fe_q.h>
+#include <fstream>
+
+using namespace dealii;
+template<int dim>
+void test()
+{
+  parallel::distributed::Triangulation < dim > tr(MPI_COMM_WORLD);
+  GridGenerator::hyper_cube(tr, -1.0, 1.0);
+  DoFHandler < dim > dofh(tr);
+  static const FE_Q<dim> fe(1);
+  dofh.distribute_dofs(fe);
+  DoFRenumbering::Cuthill_McKee(dofh);
+}
+
+
+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)
+    {
+      std::ofstream logfile("output");
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      deallog.push("2d");
+      test<2>();
+      deallog << "OK" << std::endl;
+      deallog.pop();
+
+      deallog.push("3d");
+      test<3>();
+      deallog << "OK" << std::endl;
+      deallog.pop();
+    }
+  else
+    {
+      test<2>();
+      test<3>();
+    }
+}
diff --git a/tests/mpi/cuthill_mckee_01.mpirun=1.output b/tests/mpi/cuthill_mckee_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/cuthill_mckee_01.mpirun=4.output b/tests/mpi/cuthill_mckee_01.mpirun=4.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.