From 2ae755810340fdb051b4fb8f18f7e58b263234ee Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 10 Jan 2018 18:58:14 -0700 Subject: [PATCH] Add a test. --- tests/mpi/renumber_z_order_03.cc | 82 +++++++++++++++++++ tests/mpi/renumber_z_order_03.mpirun=2.output | 2 + 2 files changed, 84 insertions(+) create mode 100644 tests/mpi/renumber_z_order_03.cc create mode 100644 tests/mpi/renumber_z_order_03.mpirun=2.output diff --git a/tests/mpi/renumber_z_order_03.cc b/tests/mpi/renumber_z_order_03.cc new file mode 100644 index 0000000000..bef306ff2f --- /dev/null +++ b/tests/mpi/renumber_z_order_03.cc @@ -0,0 +1,82 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 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 that DofRenumbering::hierarchical() also works for a +// parallel::shared::Triangulation + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +int main (int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1); + mpi_initlog(); + + const int dim = 2; + + dealii::FE_DGQ fe(0); + + // create a p::s::Triangulation. specifically choose z-order, for + // which the algorithm previously worked by accident (because the + // partitioning of cells was contiguous in z-order) + + dealii::parallel::shared::Triangulation tria_world(MPI_COMM_WORLD, + dealii::Triangulation::none, + false, + parallel::shared::Triangulation::partition_zorder); + dealii::GridGenerator::hyper_cube(tria_world, -1, 1); + tria_world.refine_global(2); + + dealii::DoFHandler dh_world(tria_world); + dh_world.distribute_dofs(fe); + dealii::DoFRenumbering::hierarchical(dh_world); + + dealii::parallel::shared::Triangulation tria_self(MPI_COMM_SELF); + dealii::GridGenerator::hyper_cube(tria_self, -1, 1); + tria_self.refine_global(2); + + dealii::DoFHandler dh_self(tria_self); + dh_self.distribute_dofs(fe); + dealii::DoFRenumbering::hierarchical(dh_self); + + typename dealii::DoFHandler::active_cell_iterator cell_world = dh_world.begin_active(), + endc_world = dh_world.end(), cell_self = dh_self.begin_active(), endc_self = dh_self.end(); + for (; cell_world != endc_world && cell_self != endc_self; ++cell_world, ++cell_self) + if (cell_world->is_locally_owned()) + Assert (cell_world->dof_index(0) == cell_self->dof_index(0), + ExcInternalError()); + + deallog << "OK" << std::endl; +} diff --git a/tests/mpi/renumber_z_order_03.mpirun=2.output b/tests/mpi/renumber_z_order_03.mpirun=2.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/mpi/renumber_z_order_03.mpirun=2.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5