From 6623034b67515fbee155d21255ff82c965570207 Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 21 Feb 2014 18:32:24 +0000 Subject: [PATCH] add failing fe_nothing tests git-svn-id: https://svn.dealii.org/trunk@32526 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/hp/fe_nothing_20.cc | 95 +++++++++++++++++++++++++++++++++++ tests/hp/fe_nothing_20.output | 8 +++ tests/hp/fe_nothing_21.cc | 86 +++++++++++++++++++++++++++++++ tests/hp/fe_nothing_21.output | 8 +++ 4 files changed, 197 insertions(+) create mode 100644 tests/hp/fe_nothing_20.cc create mode 100644 tests/hp/fe_nothing_20.output create mode 100644 tests/hp/fe_nothing_21.cc create mode 100644 tests/hp/fe_nothing_21.output diff --git a/tests/hp/fe_nothing_20.cc b/tests/hp/fe_nothing_20.cc new file mode 100644 index 0000000000..fdb59c2ef6 --- /dev/null +++ b/tests/hp/fe_nothing_20.cc @@ -0,0 +1,95 @@ +// --------------------------------------------------------------------- +// $Id: fe_nothing_04.cc 31349 2013-10-20 19:07:06Z maier $ +// +// Copyright (C) 2009 - 2013 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. +// +// --------------------------------------------------------------------- + + + +// interpolate() can not deal with FE_Nothing in an hp setting + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + + +template +void test () +{ + Triangulation triangulation; + GridGenerator :: hyper_cube (triangulation, -0.5, 0.5); + triangulation.refine_global(4); + + hp::FECollection fe_collection; + + fe_collection.push_back (FESystem(FE_Q(2),dim, + FE_Q(1),1, + FE_Nothing(), dim)); + + fe_collection.push_back (FESystem(FE_Nothing(dim+1), 1, + FE_Q(2), dim)); + + hp::DoFHandler dof_handler (triangulation); + + + + dof_handler.distribute_dofs (fe_collection); + + deallog << " Number of active cells: " + << triangulation.n_active_cells() + << std::endl + << " Number of degrees of freedom: " + << dof_handler.n_dofs() + << std::endl; + + + Vector solution(dof_handler.n_dofs()); + + VectorTools::interpolate(dof_handler, + ZeroFunction(2*dim+1), + solution); + + deallog << "l2_norm = " << solution.l2_norm() << std::endl; +} + + + +int main () +{ + initlog(); + + //test<1> (); + test<2> (); + test<3> (); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/fe_nothing_20.output b/tests/hp/fe_nothing_20.output new file mode 100644 index 0000000000..34d04cfe64 --- /dev/null +++ b/tests/hp/fe_nothing_20.output @@ -0,0 +1,8 @@ + +DEAL:: Number of active cells: 2 +DEAL:: Number of degrees of freedom: 2 +DEAL:: Number of active cells: 4 +DEAL:: Number of degrees of freedom: 8 +DEAL:: Number of active cells: 8 +DEAL:: Number of degrees of freedom: 26 +DEAL::OK diff --git a/tests/hp/fe_nothing_21.cc b/tests/hp/fe_nothing_21.cc new file mode 100644 index 0000000000..e3a61cd689 --- /dev/null +++ b/tests/hp/fe_nothing_21.cc @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------- +// $Id: fe_nothing_04.cc 31349 2013-10-20 19:07:06Z maier $ +// +// Copyright (C) 2009 - 2013 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. +// +// --------------------------------------------------------------------- + + + +// interpolate() can not deal with FE_Nothing, simplified version of fe_nothing_20.cc + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + + +template +void test () +{ + Triangulation triangulation; + GridGenerator :: hyper_cube (triangulation, -0.5, 0.5); + triangulation.refine_global(4); + + FESystem fe(FE_Nothing(),1, FE_Q(1),1); + + deallog << "n support points: " << fe.get_unit_support_points().size() << std::endl; + + + DoFHandler dof_handler (triangulation); + + dof_handler.distribute_dofs (fe); + deallog << " Number of active cells: " + << triangulation.n_active_cells() + << std::endl + << " Number of degrees of freedom: " + << dof_handler.n_dofs() + << std::endl; + + + Vector solution(dof_handler.n_dofs()); + + VectorTools::interpolate(dof_handler, + ZeroFunction(2), + solution); + + deallog << "l2_norm = " << solution.l2_norm() << std::endl; +} + + + +int main () +{ + initlog(); + + //test<1> (); + test<2> (); + test<3> (); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/fe_nothing_21.output b/tests/hp/fe_nothing_21.output new file mode 100644 index 0000000000..34d04cfe64 --- /dev/null +++ b/tests/hp/fe_nothing_21.output @@ -0,0 +1,8 @@ + +DEAL:: Number of active cells: 2 +DEAL:: Number of degrees of freedom: 2 +DEAL:: Number of active cells: 4 +DEAL:: Number of degrees of freedom: 8 +DEAL:: Number of active cells: 8 +DEAL:: Number of degrees of freedom: 26 +DEAL::OK -- 2.39.5