From 681568e096a49ad58ff91a6a453ca589f4f6f26d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Wichrowski?= Date: Thu, 4 Dec 2014 13:58:03 -0600 Subject: [PATCH] Add a testcase. --- tests/mpi/cuthill_mckee_01.cc | 73 ++++++++++++++++++++++ tests/mpi/cuthill_mckee_01.mpirun=1.output | 3 + tests/mpi/cuthill_mckee_01.mpirun=4.output | 3 + 3 files changed, 79 insertions(+) create mode 100644 tests/mpi/cuthill_mckee_01.cc create mode 100644 tests/mpi/cuthill_mckee_01.mpirun=1.output create mode 100644 tests/mpi/cuthill_mckee_01.mpirun=4.output diff --git a/tests/mpi/cuthill_mckee_01.cc b/tests/mpi/cuthill_mckee_01.cc new file mode 100644 index 0000000000..3d0db2e7af --- /dev/null +++ b/tests/mpi/cuthill_mckee_01.cc @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace dealii; +template +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 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 index 0000000000..995f6e446b --- /dev/null +++ b/tests/mpi/cuthill_mckee_01.mpirun=1.output @@ -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 index 0000000000..995f6e446b --- /dev/null +++ b/tests/mpi/cuthill_mckee_01.mpirun=4.output @@ -0,0 +1,3 @@ + +DEAL:0:2d::OK +DEAL:0:3d::OK -- 2.39.5