From: Wolfgang Bangerth Date: Tue, 8 Aug 2017 00:36:53 +0000 (-0600) Subject: Add another test. X-Git-Tag: v9.0.0-rc1~1344^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edd13fa93a045e3053c1b3c7f2165800d5349463;p=dealii.git Add another test. --- diff --git a/tests/sharedtria/communicate_active_fe_indices_02.cc b/tests/sharedtria/communicate_active_fe_indices_02.cc new file mode 100644 index 0000000000..1784eef34f --- /dev/null +++ b/tests/sharedtria/communicate_active_fe_indices_02.cc @@ -0,0 +1,101 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + + +// like _01, but allow for artificial cells + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +template +void test() +{ + parallel::shared::Triangulation + triangulation (MPI_COMM_WORLD, dealii::Triangulation::none, true); + + GridGenerator::hyper_cube(triangulation); + triangulation.refine_global (3); + + hp::FECollection fe; + for (unsigned int i=0; i(1)); + + hp::DoFHandler dof_handler (triangulation); + + // set the active_fe_index on all locally active cells equal to the + // subdomain_id. we can later verify this equality also on ghost + // cells + for (auto cell : dof_handler.active_cell_iterators()) + if (cell->is_locally_owned()) + cell->set_active_fe_index (cell->subdomain_id()); + + dof_handler.distribute_dofs (fe); + + deallog << "n_dofs: " << dof_handler.n_dofs() << std::endl; + deallog << "n_locally_owned_dofs: " << dof_handler.n_locally_owned_dofs() << std::endl; + + // verify that the information has been communicated between processors + for (auto cell : dof_handler.active_cell_iterators()) + { + if (cell->is_locally_owned()) + Assert (cell->active_fe_index () + == + cell->subdomain_id(), + ExcInternalError()); + if (cell->is_ghost()) + Assert (cell->active_fe_index () + == + cell->subdomain_id(), + ExcInternalError()); + } +} + + +int main(int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + + MPILogInitAll all; + + deallog.push("1d"); + test<1>(); + deallog.pop(); + + deallog.push("2d"); + test<2>(); + deallog.pop(); + + deallog.push("3d"); + test<3>(); + deallog.pop(); +} diff --git a/tests/sharedtria/communicate_active_fe_indices_02.with_metis=true.mpirun=3.output b/tests/sharedtria/communicate_active_fe_indices_02.with_metis=true.mpirun=3.output new file mode 100644 index 0000000000..9f7fa6057a --- /dev/null +++ b/tests/sharedtria/communicate_active_fe_indices_02.with_metis=true.mpirun=3.output @@ -0,0 +1,23 @@ + +DEAL:0:1d::n_dofs: 9 +DEAL:0:1d::n_locally_owned_dofs: 3 +DEAL:0:2d::n_dofs: 81 +DEAL:0:2d::n_locally_owned_dofs: 26 +DEAL:0:3d::n_dofs: 729 +DEAL:0:3d::n_locally_owned_dofs: 239 + +DEAL:1:1d::n_dofs: 9 +DEAL:1:1d::n_locally_owned_dofs: 4 +DEAL:1:2d::n_dofs: 81 +DEAL:1:2d::n_locally_owned_dofs: 28 +DEAL:1:3d::n_dofs: 729 +DEAL:1:3d::n_locally_owned_dofs: 241 + + +DEAL:2:1d::n_dofs: 9 +DEAL:2:1d::n_locally_owned_dofs: 2 +DEAL:2:2d::n_dofs: 81 +DEAL:2:2d::n_locally_owned_dofs: 27 +DEAL:2:3d::n_dofs: 729 +DEAL:2:3d::n_locally_owned_dofs: 249 +