From 3c0cc215025f0fbaff338fa20496fd41cf24baeb Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 May 2006 22:19:19 +0000 Subject: [PATCH] New tests git-svn-id: https://svn.dealii.org/trunk@12984 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/hp/Makefile | 3 +- tests/hp/crash_05.cc | 89 ++++++++++++++++++++++++++++++++++++++++++++ tests/hp/random.cc | 88 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 tests/hp/crash_05.cc create mode 100644 tests/hp/random.cc diff --git a/tests/hp/Makefile b/tests/hp/Makefile index 163d835ebf..dac33e0a2c 100644 --- a/tests/hp/Makefile +++ b/tests/hp/Makefile @@ -27,7 +27,8 @@ tests_x = hp_dof_handler \ mapping_collection_* \ fe_collection_* \ continuous_* \ - n_dofs + n_dofs \ + random # from above list of regular expressions, generate the real set of # tests diff --git a/tests/hp/crash_05.cc b/tests/hp/crash_05.cc new file mode 100644 index 0000000000..a9578f4bb8 --- /dev/null +++ b/tests/hp/crash_05.cc @@ -0,0 +1,89 @@ +//---------------------------- crash_05.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005, 2006 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. +// +//---------------------------- crash_05.cc --------------------------- + + +// a crash when using different fe's on different cells + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.refine_global (1); + + // use the same element, but with + // different indices + hp::FECollection fe_collection; + for (unsigned int i=0; i (1)); + + hp::DoFHandler dof_handler(tria); + + unsigned int fe_index = 0; + for (typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + cell != dof_handler.end(); ++cell, ++fe_index) + { + deallog << "Setting fe_index=" << fe_index << " on cell " << cell + << std::endl; + cell->set_active_fe_index (fe_index); + } + + dof_handler.distribute_dofs(fe_collection); + + std::vector local_dof_indices; + for (typename hp::DoFHandler::active_cell_iterator + cell=dof_handler.begin_active(); + cell!=dof_handler.end(); ++cell) + { + local_dof_indices.resize (cell->get_fe().dofs_per_cell); + cell->get_dof_indices (local_dof_indices); + + deallog << cell << std::endl; + for (unsigned int i=0; i (); + test<2> (); + test<3> (); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/random.cc b/tests/hp/random.cc new file mode 100644 index 0000000000..3f1a33b385 --- /dev/null +++ b/tests/hp/random.cc @@ -0,0 +1,88 @@ +//---------------------------- random.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005, 2006 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. +// +//---------------------------- random.cc --------------------------- + + +// see what happens if we distribute different finite elements +// randomly across the domain + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.refine_global (2); + tria.begin_active()->set_refine_flag (); + tria.execute_coarsening_and_refinement (); + tria.refine_global (2); + + hp::FECollection fe_collection; + fe_collection.push_back(FE_Q (1)); + fe_collection.push_back(FE_Q (2)); + fe_collection.push_back(FE_Q (3)); + fe_collection.push_back(FE_Q (4)); + + hp::DoFHandler dof_handler(tria); + + for (typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + cell != dof_handler.end(); ++cell) + cell->set_active_fe_index (rand() % fe_collection.size()); + + dof_handler.distribute_dofs(fe_collection); + + std::vector local_dof_indices; + for (typename hp::DoFHandler::active_cell_iterator + cell=dof_handler.begin_active(); + cell!=dof_handler.end(); ++cell) + { + local_dof_indices.resize (cell->get_fe().dofs_per_cell); + cell->get_dof_indices (local_dof_indices); + + deallog << cell << std::endl; + for (unsigned int i=0; i (); + test<2> (); + test<3> (); + + deallog << "OK" << std::endl; +} -- 2.39.5