From 7e8042e5965ca790b6c819a23e071446c57b1eeb Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 21 Jan 2014 06:44:34 +0000 Subject: [PATCH] Another test. git-svn-id: https://svn.dealii.org/trunk@32272 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/hp/solution_transfer_08.cc | 107 +++++++++++++++++++++++++++ tests/hp/solution_transfer_08.output | 4 + 2 files changed, 111 insertions(+) create mode 100644 tests/hp/solution_transfer_08.cc create mode 100644 tests/hp/solution_transfer_08.output diff --git a/tests/hp/solution_transfer_08.cc b/tests/hp/solution_transfer_08.cc new file mode 100644 index 0000000000..ba3285f6ce --- /dev/null +++ b/tests/hp/solution_transfer_08.cc @@ -0,0 +1,107 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2011 - 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. +// +// --------------------------------------------------------------------- + + + +// like _07 but do it the other way around: start with a fine mesh, then +// coarsen + +#include "../tests.h" +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include + +using namespace dealii; + + +template +void test () +{ + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation); + triangulation.refine_global (1); + + hp::FECollection fe_collection; + fe_collection.push_back(FE_Q(1)); + fe_collection.push_back(FE_Q(2)); + + hp::DoFHandler dof_handler(triangulation); + for (unsigned int c=0; cn_children(); ++c) + dof_handler.begin(0)->child(c)->set_active_fe_index(1); + dof_handler.distribute_dofs (fe_collection); + + // Init solution + Vector solution(dof_handler.n_dofs()); + solution = 1.0; + + // coarsen everything away + SolutionTransfer, hp::DoFHandler > + solution_trans(dof_handler); + for (unsigned int c=0; cn_children(); ++c) + dof_handler.begin(0)->child(c)->set_coarsen_flag (); + + solution_trans.prepare_for_coarsening_and_refinement(solution); + triangulation.execute_coarsening_and_refinement (); + + // now set the active_fe_index flags on the only remaining cell + dof_handler.begin_active()->set_active_fe_index(0); + + // distribute dofs and transfer solution there + dof_handler.distribute_dofs (fe_collection); + + Vector new_solution(dof_handler.n_dofs()); + solution_trans.interpolate(solution, new_solution); + + // we should now have only 1s in the new_solution vector + for (unsigned int i=0; i (); + test<2> (); + test<3> (); +} diff --git a/tests/hp/solution_transfer_08.output b/tests/hp/solution_transfer_08.output new file mode 100644 index 0000000000..fb71de2867 --- /dev/null +++ b/tests/hp/solution_transfer_08.output @@ -0,0 +1,4 @@ + +DEAL::OK +DEAL::OK +DEAL::OK -- 2.39.5