From: angelrca Date: Wed, 3 Jun 2015 09:29:22 +0000 (+0200) Subject: test case interpolate_nothing_03 added X-Git-Tag: v8.3.0-rc1~130^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64d4f1f6da40264d36be5c3174f3860ba2c2ce11;p=dealii.git test case interpolate_nothing_03 added --- diff --git a/tests/hp/interpolate_nothing_03.cc b/tests/hp/interpolate_nothing_03.cc new file mode 100644 index 0000000000..37f21dc041 --- /dev/null +++ b/tests/hp/interpolate_nothing_03.cc @@ -0,0 +1,99 @@ +// --------------------------------------------------------------------- +// +// 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 +// scalar elements. + +#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(3); + + hp::FECollection fe_collection; + + fe_collection.push_back(FE_Q(1)); + fe_collection.push_back(FE_Nothing()); + + hp::DoFHandler dof_handler (triangulation); + + typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + + for (; cell!= endc; ++cell) + { + Point center = cell -> center(); + if (center[0] < 0) + cell->set_active_fe_index(1); + else + cell->set_active_fe_index(0); + } + + dof_handler.distribute_dofs (fe_collection); + + Vector interpolant(dof_handler.n_dofs()); + + // interpolate the function + VectorTools::interpolate(dof_handler, + ConstantFunction(3.14), + interpolant); + deallog << interpolant.mean_value() << 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_03.output b/tests/hp/interpolate_nothing_03.output new file mode 100644 index 0000000000..b4794096af --- /dev/null +++ b/tests/hp/interpolate_nothing_03.output @@ -0,0 +1,5 @@ + + +DEAL::3.14 +DEAL::3.14 +DEAL::3.14