From 8938f4389fda6873aad4759d63b26b0469329ad3 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 8 Oct 2009 19:36:03 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@19775 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/hp/fe_nothing_03.cc | 114 +++++++++++++++++++++++++++++ tests/hp/fe_nothing_03/cmp/generic | 11 +++ 2 files changed, 125 insertions(+) create mode 100644 tests/hp/fe_nothing_03.cc create mode 100644 tests/hp/fe_nothing_03/cmp/generic diff --git a/tests/hp/fe_nothing_03.cc b/tests/hp/fe_nothing_03.cc new file mode 100644 index 0000000000..d8ad908554 --- /dev/null +++ b/tests/hp/fe_nothing_03.cc @@ -0,0 +1,114 @@ +//---------------------------- fe_nothing_01.cc --------------------------- +// $Id: fe_nothing_03.cc 19539 2009-09-25 02:48:15Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2009 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- fe_nothing_01.cc --------------------------- + + +// test that FE_Nothing works as intended + + +#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 (FE_Q(1)); + fe_collection.push_back (FE_Nothing()); + + hp::DoFHandler dof_handler (triangulation); + + // loop over cells, and set cells + // within a circle to be of type + // FE_Nothing, while outside the + // circle to be of type FE_Q(1) + + typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + + for(; cell != endc; cell++) + { + Point center = cell->center(); + if(std::sqrt(center.square()) < 0.25 ) + cell->set_active_fe_index(1); + else + cell->set_active_fe_index(0); + } + + 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; + + + + // .... test constraint handling + + ConstraintMatrix constraints; + + DoFTools::make_hanging_node_constraints (dof_handler, constraints); + + constraints.close(); + + deallog << " Number of constraints: " + << constraints.n_constraints() + << std::endl; + +} + + + +int main () +{ + std::ofstream logfile("fe_nothing_03/output"); + logfile.precision(2); + + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1> (); + test<2> (); + test<3> (); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/fe_nothing_03/cmp/generic b/tests/hp/fe_nothing_03/cmp/generic new file mode 100644 index 0000000000..cf66adbec4 --- /dev/null +++ b/tests/hp/fe_nothing_03/cmp/generic @@ -0,0 +1,11 @@ + +DEAL:: Number of active cells: 16 +DEAL:: Number of degrees of freedom: 10 +DEAL:: Number of constraints: 0 +DEAL:: Number of active cells: 256 +DEAL:: Number of degrees of freedom: 252 +DEAL:: Number of constraints: 0 +DEAL:: Number of active cells: 4096 +DEAL:: Number of degrees of freedom: 4766 +DEAL:: Number of constraints: 0 +DEAL::OK -- 2.39.5