From: Daniel Arndt Date: Sat, 19 May 2018 18:21:15 +0000 (+0200) Subject: Add test case and changelog entry X-Git-Tag: v9.1.0-rc1~1124^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f19854656aa311eff6456e0fc783db66cca16d0;p=dealii.git Add test case and changelog entry --- diff --git a/doc/news/changes/minor/20180519DanielArndt b/doc/news/changes/minor/20180519DanielArndt new file mode 100644 index 0000000000..64717447d9 --- /dev/null +++ b/doc/news/changes/minor/20180519DanielArndt @@ -0,0 +1,5 @@ +Fixed: DoFTools::make_flux_sparsity_pattern was accessing invalid dof indices +in case neighboring cells were not using FiniteElement objects with the same +number of degrees of freedom. This is fixed now. +
+(Daniel Arndt, 2018/05/19) diff --git a/tests/hp/flux_sparsity_02.cc b/tests/hp/flux_sparsity_02.cc new file mode 100644 index 0000000000..f9757fac9f --- /dev/null +++ b/tests/hp/flux_sparsity_02.cc @@ -0,0 +1,101 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 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. +// +// --------------------------------------------------------------------- + +// A second test that checks make_flux_sparsity_pattern +// with scalar valued hp objects. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +template +void +check () +{ + Triangulation triangulation; + std::vector subdivisions(dim, 1U); + subdivisions[0] = 2; + Point p1,p2; + switch (dim) + { + case 2: + p1[0] = p1[1] = 0.0; + p2[0] = 2.0; + p2[1] = 1.0; + break; + case 3: + p1[0] = p1[1] = p1[2] = 0.0; + p2[0] = 2.0; + p2[1] = p2[2] = 1.0; + break; + default: + Assert(false, ExcNotImplemented()); + } + + GridGenerator::subdivided_hyper_rectangle (triangulation, + subdivisions, + p1, p2); + + // Create FE Collection and insert two FE objects + // DGQ0 and DGQ1 + hp::FECollection fe_collection; + fe_collection.push_back(FE_DGQ(0)); + fe_collection.push_back(FE_DGQ(1)); + + hp::DoFHandler dof_handler(triangulation); + dof_handler.begin_active()->set_active_fe_index(1); + dof_handler.distribute_dofs(fe_collection); + + DynamicSparsityPattern dsp(dof_handler.n_dofs(), + dof_handler.n_dofs()); + + DoFTools::make_flux_sparsity_pattern (dof_handler, dsp); + dsp.compress(); + + // Print sparsity pattern, we expect that all dofs couple with each other. + dsp.print(deallog.get_file_stream()); +} + + + +int main() +{ + initlog(); + + deallog.push ("2d"); + check<2> (); + deallog.pop (); + deallog.push ("3d"); + check<3> (); + deallog.pop (); +} + + + diff --git a/tests/hp/flux_sparsity_02.output b/tests/hp/flux_sparsity_02.output new file mode 100644 index 0000000000..26fea0c985 --- /dev/null +++ b/tests/hp/flux_sparsity_02.output @@ -0,0 +1,15 @@ + +[0,0,1,2,3,4] +[1,0,1,2,3,4] +[2,0,1,2,3,4] +[3,0,1,2,3,4] +[4,0,1,2,3,4] +[0,0,1,2,3,4,5,6,7,8] +[1,0,1,2,3,4,5,6,7,8] +[2,0,1,2,3,4,5,6,7,8] +[3,0,1,2,3,4,5,6,7,8] +[4,0,1,2,3,4,5,6,7,8] +[5,0,1,2,3,4,5,6,7,8] +[6,0,1,2,3,4,5,6,7,8] +[7,0,1,2,3,4,5,6,7,8] +[8,0,1,2,3,4,5,6,7,8]