From 2d762f58e5e38d6a6bd2aafca6d01fb3f94575ed Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 31 Aug 2015 17:23:41 -0500 Subject: [PATCH] Add tests. --- tests/hp/face_domination_01.cc | 92 ++++++++++++++++++++++++++++ tests/hp/face_domination_01.output | 3 + tests/hp/face_domination_02.cc | 96 ++++++++++++++++++++++++++++++ tests/hp/face_domination_02.output | 7 +++ 4 files changed, 198 insertions(+) create mode 100644 tests/hp/face_domination_01.cc create mode 100644 tests/hp/face_domination_01.output create mode 100644 tests/hp/face_domination_02.cc create mode 100644 tests/hp/face_domination_02.output diff --git a/tests/hp/face_domination_01.cc b/tests/hp/face_domination_01.cc new file mode 100644 index 0000000000..26eb855fbe --- /dev/null +++ b/tests/hp/face_domination_01.cc @@ -0,0 +1,92 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 test that checks that FE_Nothing does not dominate the neighboring Q1. + + + +#include "../tests.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +const unsigned int dim=2; + +void print_dofs (const hp::DoFHandler<2>::active_cell_iterator &cell) +{ + deallog << "DoFs on cell=" << cell << ": "; + + std::vector dof_indices (cell->get_fe().dofs_per_cell); + cell->get_dof_indices (dof_indices); + for (unsigned int i=0; i triangulation; + std::vector subdivisions(dim, 1U); + subdivisions[0] = 2; + GridGenerator::subdivided_hyper_rectangle (triangulation, + subdivisions, + Point(0,0), + Point(2,1)); + + hp::FECollection fe_collection; + fe_collection.push_back(FESystem(FE_Nothing(),1)); + fe_collection.push_back(FESystem(FE_Q(1),1)); + + hp::DoFHandler dof_handler(triangulation); + + dof_handler.begin_active()->set_active_fe_index(1); + + dof_handler.distribute_dofs(fe_collection); + + print_dofs (dof_handler.begin_active()); + print_dofs (++dof_handler.begin_active()); + + ConstraintMatrix constraints; + constraints.clear(); + dealii::DoFTools::make_hanging_node_constraints (dof_handler, constraints); + constraints.close (); + + constraints.print(deallog.get_file_stream()); +} + + + diff --git a/tests/hp/face_domination_01.output b/tests/hp/face_domination_01.output new file mode 100644 index 0000000000..d4853e5d70 --- /dev/null +++ b/tests/hp/face_domination_01.output @@ -0,0 +1,3 @@ + +DEAL::DoFs on cell=0.0: 0 1 2 3 +DEAL::DoFs on cell=0.1: diff --git a/tests/hp/face_domination_02.cc b/tests/hp/face_domination_02.cc new file mode 100644 index 0000000000..16abe78a00 --- /dev/null +++ b/tests/hp/face_domination_02.cc @@ -0,0 +1,96 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 test that checks that FE_Nothing does not dominate the +// neighboring Q1. This works fine for a single, scalar element as +// shown in the _01 test, but fails at the time the test was written +// for systems + + +#include "../tests.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +const unsigned int dim=2; + +void print_dofs (const hp::DoFHandler<2>::active_cell_iterator &cell) +{ + deallog << "DoFs on cell=" << cell << ": "; + + std::vector dof_indices (cell->get_fe().dofs_per_cell); + cell->get_dof_indices (dof_indices); + for (unsigned int i=0; i triangulation; + std::vector subdivisions(dim, 1U); + subdivisions[0] = 2; + GridGenerator::subdivided_hyper_rectangle (triangulation, + subdivisions, + Point(0,0), + Point(2,1)); + + hp::FECollection fe_collection; + fe_collection.push_back(FESystem(FE_Q(1),1, + FE_Nothing(),1)); + fe_collection.push_back(FESystem(FE_Q(2),1, + FE_Q(1),1)); + + hp::DoFHandler dof_handler(triangulation); + + dof_handler.begin_active()->set_active_fe_index(1); + + dof_handler.distribute_dofs(fe_collection); + + print_dofs (dof_handler.begin_active()); + print_dofs (++dof_handler.begin_active()); + + ConstraintMatrix constraints; + constraints.clear(); + dealii::DoFTools::make_hanging_node_constraints (dof_handler, constraints); + constraints.close (); + + constraints.print(deallog.get_file_stream()); +} + + + diff --git a/tests/hp/face_domination_02.output b/tests/hp/face_domination_02.output new file mode 100644 index 0000000000..464831bdc9 --- /dev/null +++ b/tests/hp/face_domination_02.output @@ -0,0 +1,7 @@ + +DEAL::DoFs on cell=0.0: 0 1 11 2 3 4 13 5 6 7 8 9 10 +DEAL::DoFs on cell=0.1: 11 12 13 14 + 2 = 0 + 5 = 0 + 7 11: 0.500000 + 7 13: 0.500000 -- 2.39.5