From 1cb5c9bc26a3c56d8d60438118846efb4d32b743 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 4 May 2010 19:37:54 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@21067 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/hp/crash_19.cc | 149 ++++++++++++++++++++++++++++++++++ tests/hp/crash_19/cmp/generic | 126 ++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+) create mode 100644 tests/hp/crash_19.cc create mode 100644 tests/hp/crash_19/cmp/generic diff --git a/tests/hp/crash_19.cc b/tests/hp/crash_19.cc new file mode 100644 index 0000000000..0032ee49a9 --- /dev/null +++ b/tests/hp/crash_19.cc @@ -0,0 +1,149 @@ +//---------------------------- crash_19.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005, 2006, 2007, 2008, 2010 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_19.cc --------------------------- + + +// VectorTools::interpolate_boundary_values produced an exception when +// used with hp::DoFHandler in 1d. Test that this is no longer the case + + +#include "../tests.h" +#include +#include +std::ofstream logfile("crash_19/output"); + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +template +class ExactSolution: public Function { + public: + ExactSolution () {} + virtual double value (const Point& p, const unsigned int) const + { + return p (0); + } + }; + + +template +void test () +{ + Triangulation triangulation; + hp::FECollection fe; + fe.push_back (FE_Q (1)); + + hp::DoFHandler dof_handler (triangulation); + + GridGenerator::hyper_cube (triangulation); + triangulation.refine_global (2); + deallog << "Number of active cells: " + << triangulation.n_active_cells() + << std::endl; + deallog << "Total number of cells: " + << triangulation.n_cells() + << std::endl; + + dof_handler.distribute_dofs (fe); + deallog << "Number of degrees of freedom: " + << dof_handler.n_dofs() + << std::endl; + + ExactSolution exact_solution; + std::map boundary_values; + VectorTools::interpolate_boundary_values (dof_handler, + 0, + exact_solution, + boundary_values); + if (dim == 1) + VectorTools::interpolate_boundary_values (dof_handler, + 1, + exact_solution, + boundary_values); + + for (std::map::iterator i=boundary_values.begin(); + i != boundary_values.end(); ++i) + deallog << i->first << ' ' << i->second << std::endl; +} + + +int main () +{ + try + { + logfile.precision(2); + deallog << std::setprecision(2); + + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1> (); + test<2> (); + test<3> (); + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; + + return 0; +} diff --git a/tests/hp/crash_19/cmp/generic b/tests/hp/crash_19/cmp/generic new file mode 100644 index 0000000000..053a7cfbf9 --- /dev/null +++ b/tests/hp/crash_19/cmp/generic @@ -0,0 +1,126 @@ + +DEAL::Number of active cells: 4 +DEAL::Total number of cells: 7 +DEAL::Number of degrees of freedom: 5 +DEAL::0 0 +DEAL::4 1.0 +DEAL::Number of active cells: 16 +DEAL::Total number of cells: 21 +DEAL::Number of degrees of freedom: 25 +DEAL::0 0 +DEAL::1 0.25 +DEAL::2 0 +DEAL::4 0.50 +DEAL::6 0 +DEAL::9 0.75 +DEAL::11 1.0 +DEAL::12 1.0 +DEAL::14 1.0 +DEAL::15 0 +DEAL::18 0 +DEAL::19 0.25 +DEAL::20 0.50 +DEAL::22 1.0 +DEAL::23 0.75 +DEAL::24 1.0 +DEAL::Number of active cells: 64 +DEAL::Total number of cells: 73 +DEAL::Number of degrees of freedom: 125 +DEAL::0 0 +DEAL::1 0.25 +DEAL::2 0 +DEAL::3 0.25 +DEAL::4 0 +DEAL::5 0.25 +DEAL::6 0 +DEAL::8 0.50 +DEAL::9 0.50 +DEAL::10 0.50 +DEAL::12 0 +DEAL::13 0.25 +DEAL::14 0 +DEAL::16 0.50 +DEAL::18 0 +DEAL::19 0.25 +DEAL::20 0 +DEAL::22 0.50 +DEAL::24 0 +DEAL::27 0.75 +DEAL::28 0.75 +DEAL::29 0.75 +DEAL::31 1.0 +DEAL::32 1.0 +DEAL::33 1.0 +DEAL::34 1.0 +DEAL::35 0.75 +DEAL::37 1.0 +DEAL::38 1.0 +DEAL::39 0.75 +DEAL::41 1.0 +DEAL::42 1.0 +DEAL::44 1.0 +DEAL::45 0 +DEAL::46 0.25 +DEAL::47 0 +DEAL::49 0.50 +DEAL::51 0 +DEAL::52 0.25 +DEAL::53 0 +DEAL::54 0.25 +DEAL::55 0.50 +DEAL::56 0.50 +DEAL::57 0 +DEAL::60 0 +DEAL::61 0.25 +DEAL::62 0.50 +DEAL::63 0.75 +DEAL::65 1.0 +DEAL::66 1.0 +DEAL::67 0.75 +DEAL::68 0.75 +DEAL::69 1.0 +DEAL::70 1.0 +DEAL::72 1.0 +DEAL::73 0.75 +DEAL::74 1.0 +DEAL::75 0 +DEAL::76 0.25 +DEAL::77 0 +DEAL::79 0.50 +DEAL::81 0 +DEAL::84 0 +DEAL::85 0.25 +DEAL::86 0 +DEAL::87 0.25 +DEAL::88 0.50 +DEAL::89 0.50 +DEAL::90 0 +DEAL::91 0.25 +DEAL::92 0.50 +DEAL::93 0.75 +DEAL::95 1.0 +DEAL::96 1.0 +DEAL::98 1.0 +DEAL::99 0.75 +DEAL::100 0.75 +DEAL::101 1.0 +DEAL::102 1.0 +DEAL::103 0.75 +DEAL::104 1.0 +DEAL::105 0 +DEAL::108 0 +DEAL::109 0.25 +DEAL::110 0.50 +DEAL::111 0 +DEAL::112 0.25 +DEAL::113 0.50 +DEAL::114 0 +DEAL::115 0.25 +DEAL::116 0.50 +DEAL::118 1.0 +DEAL::119 0.75 +DEAL::120 1.0 +DEAL::121 0.75 +DEAL::122 1.0 +DEAL::123 0.75 +DEAL::124 1.0 -- 2.39.5