From: Wolfgang Bangerth Date: Thu, 18 Jan 2018 22:28:31 +0000 (-0700) Subject: Add test. X-Git-Tag: v9.0.0-rc1~551^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68bb964ce7f6f1f66ba7716d7f249bc0dc24037c;p=dealii.git Add test. --- diff --git a/tests/dofs/locally_owned_dofs_per_subdomain_01.cc b/tests/dofs/locally_owned_dofs_per_subdomain_01.cc new file mode 100644 index 0000000000..79ad784c37 --- /dev/null +++ b/tests/dofs/locally_owned_dofs_per_subdomain_01.cc @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2008 - 2015 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 the structures reporting DoF indexing are sized correctly for +// the hp::DoFHandler. In particular, we're interested in the case when one +// subdomain has no DoFs associated with it. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +using namespace dealii; + +int main () +{ + initlog(); + + const int dim = 2; + + const unsigned int n_subdomains = 2; + + hp::FECollection fe_collection; + fe_collection.push_back(FE_Q(1)); + fe_collection.push_back(FE_Nothing()); + + Triangulation tria; + GridGenerator::hyper_cube (tria, 0, 1, true); + tria.refine_global(1); + GridTools::partition_triangulation (n_subdomains, tria); + + hp::DoFHandler hp_dof_handler (tria); + for (auto cell : hp_dof_handler.active_cell_iterators()) + { + if (cell == hp_dof_handler.begin_active()) + cell->set_active_fe_index(0); // FE_Q + else + cell->set_active_fe_index(1); // FE_Nothing + } + hp_dof_handler.distribute_dofs (fe_collection); + + Assert(DoFTools::locally_owned_dofs_per_subdomain(hp_dof_handler).size() == n_subdomains, + ExcDimensionMismatch(DoFTools::locally_owned_dofs_per_subdomain(hp_dof_handler).size(), n_subdomains)); + Assert(DoFTools::locally_relevant_dofs_per_subdomain(hp_dof_handler).size() == n_subdomains, + ExcDimensionMismatch(DoFTools::locally_relevant_dofs_per_subdomain(hp_dof_handler).size(), n_subdomains)); + + deallog << "OK" << std::endl; +} diff --git a/tests/dofs/locally_owned_dofs_per_subdomain_01.output b/tests/dofs/locally_owned_dofs_per_subdomain_01.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/dofs/locally_owned_dofs_per_subdomain_01.output @@ -0,0 +1,2 @@ + +DEAL::OK