From: MichaƂ Wichrowski Date: Thu, 4 Dec 2014 19:58:03 +0000 (-0600) Subject: Add a testcase. X-Git-Tag: v8.2.0-rc1~32^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F284%2Fhead;p=dealii.git Add a testcase. --- 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