From 9b04ac41734946ce81a37364259ed0848bab9e19 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 10 Dec 2014 20:46:29 -0600 Subject: [PATCH] Add a test. --- tests/hp/interpolate_nothing_01.cc | 87 ++++++++++++++++++++++++++ tests/hp/interpolate_nothing_01.output | 4 ++ 2 files changed, 91 insertions(+) create mode 100644 tests/hp/interpolate_nothing_01.cc create mode 100644 tests/hp/interpolate_nothing_01.output diff --git a/tests/hp/interpolate_nothing_01.cc b/tests/hp/interpolate_nothing_01.cc new file mode 100644 index 0000000000..9803f2899a --- /dev/null +++ b/tests/hp/interpolate_nothing_01.cc @@ -0,0 +1,87 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2014 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. +// +// --------------------------------------------------------------------- + + + +// check that VectorTools::interpolate works for FE_Nothing +// elements. this is another confirmation that we had previously fixed +// a bug again reported by Krishna Garikipati but that had previously +// been addressed by ensuring that +// FE_Nothing::has_unit_support_points() returns true + +#include "../tests.h" +#include +#include +#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); + triangulation.refine_global (3); + + hp::FECollection hp_fe; + hp_fe.push_back(FESystem(FE_Q(2), 1, FE_Nothing(), 1)); + hp::DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs (hp_fe); + + Vector interpolant (dof_handler.n_dofs()); + Vector error (triangulation.n_active_cells()); + + // interpolate the function + VectorTools::interpolate (dof_handler, + ZeroFunction(hp_fe[0].n_components()), + interpolant); + deallog << interpolant.l2_norm() << std::endl; +} + + + +int main () +{ + std::ofstream logfile("output"); + logfile.precision (3); + deallog << std::setprecision(3); + + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1>(); + test<2>(); + test<3>(); +} + diff --git a/tests/hp/interpolate_nothing_01.output b/tests/hp/interpolate_nothing_01.output new file mode 100644 index 0000000000..70626d7e3f --- /dev/null +++ b/tests/hp/interpolate_nothing_01.output @@ -0,0 +1,4 @@ + +DEAL::0 +DEAL::0 +DEAL::0 -- 2.39.5