From 86cc0429445b9e3eeeb0398c111e52cb16f9f1e7 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 21 Nov 2010 02:40:21 +0000 Subject: [PATCH] Add comment. git-svn-id: https://svn.dealii.org/trunk@22833 0785d39b-7218-0410-832d-ea1e28bc413d --- .../interpolate_boundary_values_02.cc | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 tests/codim_one/interpolate_boundary_values_02.cc diff --git a/tests/codim_one/interpolate_boundary_values_02.cc b/tests/codim_one/interpolate_boundary_values_02.cc new file mode 100644 index 0000000000..2ae1b2e18b --- /dev/null +++ b/tests/codim_one/interpolate_boundary_values_02.cc @@ -0,0 +1,93 @@ + +//---------------------------- template.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005, 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. +// +//---------------------------- template.cc --------------------------- + + +// test VectorTools::interpolate_boundary_values for codim=1. like _01 +// but for 1d triangulations + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +std::ofstream logfile("interpolate_boundary_values_02/output"); + +void test() { + const int dim = 1; + const int spacedim = 2; + + Triangulation tria; + GridGenerator::hyper_cube (tria); + deallog << tria.n_active_cells() << " active cells" << std::endl; + + FE_Q fe(2); + DoFHandler dof_handler (tria); + dof_handler.distribute_dofs (fe); + + deallog << dof_handler.n_dofs() << " degrees of freedom" << std::endl; + + // test left and right boundary + // separatel + for (unsigned int boundary_id=0; boundary_id<2; ++boundary_id) + { + std::map bv; + VectorTools::interpolate_boundary_values (dof_handler, + boundary_id, + Functions::SquareFunction(), + bv); + deallog << bv.size() << " boundary degrees of freedom" << std::endl; + + for (std::map::const_iterator i = bv.begin(); + i != bv.end(); ++i) + deallog << i->first << ' ' << i->second << std::endl; + + for (DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); cell != dof_handler.end(); ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f) && + (cell->face(f)->boundary_indicator() == boundary_id)) + for (unsigned int v=0; v::vertices_per_face; ++v) + for (unsigned int i=0; iface(f)->vertex_dof_index(v,i)) + != bv.end(), + ExcInternalError()); + Assert (bv[cell->face(f)->vertex_dof_index(v,i)] + == + Functions::SquareFunction() + .value(cell->face(f)->vertex(v),i), + ExcInternalError()); + } + } +} + + + +int main () +{ + deallog.attach(logfile); + deallog.depth_console(0); + + test(); + + return 0; +} + -- 2.39.5