From bfb2dfbb0a612e28fb78971a000b921741e8ac57 Mon Sep 17 00:00:00 2001 From: elddle Date: Thu, 12 Jan 2017 11:46:08 -0500 Subject: [PATCH] Fix get_ria_vector for BDM --- source/fe/fe_bdm.cc | 6 ++-- tests/fe/bdm_16.cc | 70 ++++++++++++++++++++++++++++++++++++++++++ tests/fe/bdm_16.output | 15 +++++++++ 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 tests/fe/bdm_16.cc create mode 100644 tests/fe/bdm_16.output diff --git a/source/fe/fe_bdm.cc b/source/fe/fe_bdm.cc index 46cd58045b..6a72ac67a7 100644 --- a/source/fe/fe_bdm.cc +++ b/source/fe/fe_bdm.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2003 - 2016 by the deal.II authors +// Copyright (C) 2003 - 2017 by the deal.II authors // // This file is part of the deal.II library. // @@ -263,9 +263,9 @@ FE_BDM::get_ria_vector (const unsigned int deg) } const unsigned int dofs_per_cell = PolynomialsBDM::compute_n_pols(deg); - const unsigned int dofs_per_face = PolynomialSpace::compute_n_pols(deg); + const unsigned int dofs_per_face = PolynomialSpace::compute_n_pols(deg+1); - Assert(GeometryInfo::faces_per_cell*dofs_per_face < dofs_per_cell, + Assert(GeometryInfo::faces_per_cell*dofs_per_face <= dofs_per_cell, ExcInternalError()); // all dofs need to be diff --git a/tests/fe/bdm_16.cc b/tests/fe/bdm_16.cc new file mode 100644 index 0000000000..bf204822d4 --- /dev/null +++ b/tests/fe/bdm_16.cc @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// The test is used to check the restriction_is_additive flags. The +// face degrees of freedom of a BDM element must be non-additive as +// they have continuity requirements, however the interior DOFs must +// be additive, e.g. for order 1 elements all DOFs are non-additive, +// while for the order 2 element in 2d we have 12 non-additive face DOFs +// and 2 additive interior ones. The test should output a vector +// consisting of faces_per_cell * dofs_per_face zeros, followed by +// interior_dofs ones. + +#include "../tests.h" +#include +#include + +#include +#include + + +std::ofstream logfile ("output"); + +template +void +test (const unsigned int degree) +{ + FE_BDM fe_bdm(degree); + + deallog << "Degree=" << degree + << ", restriction is additive flags:" + << std::endl; + + for (unsigned int i=0; i(i); + + deallog << "Dimension 3: " << std::endl; + for (unsigned int i=1; i<4; ++i) + test<3>(i); + + return 0; +} + + + diff --git a/tests/fe/bdm_16.output b/tests/fe/bdm_16.output new file mode 100644 index 0000000000..91073d5859 --- /dev/null +++ b/tests/fe/bdm_16.output @@ -0,0 +1,15 @@ + +DEAL::Dimension 2: +DEAL::Degree=1, restriction is additive flags: +DEAL::0 0 0 0 0 0 0 0 +DEAL::Degree=2, restriction is additive flags: +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 1 1 +DEAL::Degree=3, restriction is additive flags: +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 +DEAL::Dimension 3: +DEAL::Degree=1, restriction is additive flags: +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +DEAL::Degree=2, restriction is additive flags: +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 +DEAL::Degree=3, restriction is additive flags: +DEAL::0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 -- 2.39.5