From e2c6f1506ed28b607b7ac4290192299d54592967 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 17 Oct 2017 18:45:44 +0200 Subject: [PATCH] Add test for embedded data in Partitioner. --- tests/mpi/parallel_partitioner_05.cc | 114 ++++++++++++++++++ .../parallel_partitioner_05.mpirun=4.output | 19 +++ 2 files changed, 133 insertions(+) create mode 100644 tests/mpi/parallel_partitioner_05.cc create mode 100644 tests/mpi/parallel_partitioner_05.mpirun=4.output diff --git a/tests/mpi/parallel_partitioner_05.cc b/tests/mpi/parallel_partitioner_05.cc new file mode 100644 index 0000000000..73c300d151 --- /dev/null +++ b/tests/mpi/parallel_partitioner_05.cc @@ -0,0 +1,114 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// check the parallel partitioner with an additional index set to describe a +// larger set for which the partitioner provides us with some renumbering +#include "../tests.h" +#include +#include +#include +#include +#include +#include + + +void test () +{ + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + const unsigned int set = 200; + AssertIndexRange (numproc, set-2); + const unsigned int local_size = set - myid; + types::global_dof_index global_size = 0; + types::global_dof_index my_start = 0; + for (unsigned int i=0; i 0 ? my_start - set/4 : 0; + types::global_dof_index after_end = myid < numproc-1 ? my_start + local_size + set/3 : my_start+local_size; + if (before_start < my_start) + local_relevant.add_range(before_start, my_start); + if (after_end > my_start + local_size) + local_relevant.add_range(my_start + local_size, after_end); + + Utilities::MPI::Partitioner v(local_owned, local_relevant, MPI_COMM_WORLD); + + std::vector restricted_indices; + for (types::global_dof_index i=before_start; i