From: Bruno Turcksin Date: Tue, 3 Sep 2013 17:05:49 +0000 (+0000) Subject: Merge from mailine and convert new tests to ctest. X-Git-Tag: v8.1.0~570^2~387 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=340e4948e5078bb4d42d239f59abd5bff074e7ca;p=dealii.git Merge from mailine and convert new tests to ctest. git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30573 0785d39b-7218-0410-832d-ea1e28bc413d --- 340e4948e5078bb4d42d239f59abd5bff074e7ca diff --cc deal.II/include/deal.II/grid/grid_tools.h index cbdcbaf7a4,146fecf71c..eabd288760 --- a/deal.II/include/deal.II/grid/grid_tools.h +++ b/deal.II/include/deal.II/grid/grid_tools.h @@@ -1084,12 -1084,8 +1084,12 @@@ namespace GridTool * * This function tries to match all faces belonging to the first * boundary with faces belonging to the second boundary with the help - * of orthogonal_equality. + * of orthogonal_equality(). * + * The bitset that is returned together with the second face encodes the + * _relative_ orientation of the first face with respect to the second + * face, see the documentation of orthogonal_equality for further details. + * * The @p offset is a vector tangential to the faces that is added to the * location of vertices of the 'first' boundary when attempting to match * them to the corresponding vertices of the 'second' boundary. This can diff --cc tests/base/work_stream_04.cc index 0000000000,50a6cc662d..c760c2c523 mode 000000,100644..100644 --- a/tests/base/work_stream_04.cc +++ b/tests/base/work_stream_04.cc @@@ -1,0 -1,58 +1,58 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2008 - 2013 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. + // + // --------------------------------------------------------------------- + + + // test WorkStream with empty functions + + #include "../tests.h" + #include + #include + #include + #include + + #include + + + struct ScratchData + {}; + + + void test () + { + std::vector v; + for (unsigned int i=0; i<20; ++i) + v.push_back (i); + + WorkStream::run (v.begin(), v.end(), + std_cxx1x::function::iterator, + ScratchData&,unsigned int&)>(), + std_cxx1x::function(), + ScratchData(), + 0U); + } + + + + + int main() + { - std::ofstream logfile("work_stream_04/output"); ++ std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test (); + } diff --cc tests/base/work_stream_04.output index 0000000000,8b13789179..8b13789179 mode 000000,100644..100644 --- a/tests/base/work_stream_04.output +++ b/tests/base/work_stream_04.output diff --cc tests/bits/parameter_handler_2_read_from_string.cc index 0000000000,a30a129567..4da8ef64d0 mode 000000,100644..100644 --- a/tests/bits/parameter_handler_2_read_from_string.cc +++ b/tests/bits/parameter_handler_2_read_from_string.cc @@@ -1,0 -1,60 +1,60 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2003 - 2013 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 _02, but use the read_input_from_string function + + #include "../tests.h" + #include + #include + #include + + + int main () + { - std::ofstream logfile("parameter_handler_2_read_from_string/output"); ++ std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + ParameterHandler prm; + prm.enter_subsection ("Testing"); + prm.declare_entry ("Function", + "a", + Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h"))); + prm.leave_subsection (); + + std::string input; - std::ifstream in("parameter_handler_2_read_from_string/prm"); ++ std::ifstream in(SOURCE_DIR "/parameter_handler_2_read_from_string/prm"); + while (in) + { + std::string s; + std::getline (in, s); + input += s; + input += '\n'; + } + prm.read_input_from_string(input.c_str()); + + std::string list; + prm.enter_subsection ("Testing"); + list = prm.get ("Function"); + prm.leave_subsection (); + + deallog << list << std::endl; + + return 0; + } diff --cc tests/bits/parameter_handler_2_read_from_string.output index 0000000000,0000000000..9eb091f67d new file mode 100644 --- /dev/null +++ b/tests/bits/parameter_handler_2_read_from_string.output @@@ -1,0 -1,0 +1,2 @@@ ++ ++DEAL::a, b, c diff --cc tests/bits/step-10-high-order.cc index 0000000000,f4c9fa3bf7..c88304ad58 mode 000000,100644..100644 --- a/tests/bits/step-10-high-order.cc +++ b/tests/bits/step-10-high-order.cc @@@ -1,0 -1,193 +1,193 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2005 - 2013 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. + // + // --------------------------------------------------------------------- + + + + // step-10 with MappingQ(8) that shows pi with 14 digits already at the first + // iteration for the volume and MappingQ(20) for the boundary part that shows + // that things still work for very high order + + + #include "../tests.h" + #include + #include -std::ofstream logfile("step-10-high-order/output"); ++std::ofstream logfile("output"); + + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + + #include + #include + #include + + const long double pi = 3.141592653589793238462643; + + + + template + void compute_pi_by_area () + { + deallog << "Computation of Pi by the area:" << std::endl + << "==============================" << std::endl; + + const unsigned int degree = 10-dim; + deallog << "Degree = " << degree << std::endl; + + Triangulation triangulation; + GridGenerator::hyper_ball (triangulation); + + static const HyperBallBoundary boundary; + triangulation.set_boundary (0, boundary); + + MappingQ mapping(degree); + const FE_Q dummy_fe (1); + const QGauss quadrature (degree+3); + + DoFHandler dof_handler (triangulation); + + FEValues x_fe_values (mapping, dummy_fe, quadrature, + update_JxW_values); + + // in 3D, we obtain many digits only on a finer mesh + if (dim == 3) + triangulation.refine_global(1); + for (int refinement=0; refinement<4-dim; + ++refinement, triangulation.refine_global (1)) + { + dof_handler.distribute_dofs (dummy_fe); + + long double area = 0; + + typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + for (; cell!=endc; ++cell) + { + x_fe_values.reinit (cell); + const FEValues &fe_values = x_fe_values.get_present_fe_values(); + for (unsigned int i=0; i + void compute_pi_by_perimeter () + { + deallog << "Computation of Pi by the perimeter:" << std::endl + << "===================================" << std::endl; + + + const unsigned int degree = 20; + deallog << "Degree = " << degree << std::endl; + Triangulation triangulation; + GridGenerator::hyper_ball (triangulation); + + static const HyperBallBoundary boundary; + triangulation.set_boundary (0, boundary); + + const MappingQ mapping (degree); + const FE_Q fe (1); + const QGauss quadrature (degree); + + DoFHandler dof_handler (triangulation); + + FEFaceValues x_fe_face_values (mapping, fe, quadrature, + update_JxW_values); + for (unsigned int refinement=0; refinement<2; + ++refinement, triangulation.refine_global (1)) + { + dof_handler.distribute_dofs (fe); + + typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + long double perimeter = 0; + for (; cell!=endc; ++cell) + for (unsigned int face_no=0; face_no::faces_per_cell; ++face_no) + if (cell->face(face_no)->at_boundary()) + { + x_fe_face_values.reinit (cell, face_no); + const FEFaceValues &fe_face_values + = x_fe_face_values.get_present_fe_values (); + + for (unsigned int i=0; i (); + compute_pi_by_perimeter<2> (); + + compute_pi_by_area<3> (); + + return 0; + } diff --cc tests/bits/step-10-high-order.output index 0000000000,eb1d6ebe43..eb1d6ebe43 mode 000000,100644..100644 --- a/tests/bits/step-10-high-order.output +++ b/tests/bits/step-10-high-order.output diff --cc tests/deal.II/normal_flux_01.cc index 0000000000,b0ec01d7f8..ca82a91f75 mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_01.cc +++ b/tests/deal.II/normal_flux_01.cc @@@ -1,0 -1,94 +1,94 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2007 - 2013 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. + // + // --------------------------------------------------------------------- + + + + // check the creation of normal flux boundary conditions for a finite + // element that consists of only a single set of vector components + // (i.e. it has dim components). Similar as the no-flux test in no_flux_01.cc + + #include "../tests.h" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + + + template + void test (const Triangulation &tr, + const FiniteElement &fe) + { + DoFHandler dof(tr); + dof.distribute_dofs(fe); + + for (unsigned int i=0; i::faces_per_cell; ++i) + { + deallog << "FE=" << fe.get_name() + << ", case=" << i + << std::endl; + + std::set boundary_ids; + for (unsigned int j=0; j<=i; ++j) + boundary_ids.insert (j); + + ConstraintMatrix cm; + VectorTools::compute_normal_flux_constraints (dof, 0, boundary_ids, cm); + + cm.print (deallog.get_file_stream ()); + } + } + + + template + void test_hyper_cube() + { + Triangulation tr; + GridGenerator::hyper_cube(tr); + + for (unsigned int i=0; i::faces_per_cell; ++i) + tr.begin_active()->face(i)->set_boundary_indicator (i); + + tr.refine_global(2); + + for (unsigned int degree=1; degree<4; ++degree) + { + FESystem fe (FE_Q(degree), dim); + test(tr, fe); + } + } + + + int main() + { - std::ofstream logfile ("normal_flux_01/output"); ++ std::ofstream logfile ("output"); + deallog << std::setprecision (2); + deallog << std::fixed; + deallog.attach(logfile); + deallog.depth_console (0); + deallog.threshold_double(1.e-12); + + test_hyper_cube<2>(); + test_hyper_cube<3>(); + } diff --cc tests/deal.II/normal_flux_01.output index 0000000000,5c92d628f6..5c92d628f6 mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_01.output +++ b/tests/deal.II/normal_flux_01.output diff --cc tests/deal.II/normal_flux_02.cc index 0000000000,adb5611821..dbfe809679 mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_02.cc +++ b/tests/deal.II/normal_flux_02.cc @@@ -1,0 -1,98 +1,98 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2007 - 2013 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. + // + // --------------------------------------------------------------------- + + + // check the creation of normal flux boundary conditions for a finite + // element that consists of more than dim components and where + // therefore we have to pick the vector components from somewhere in + // the middle (opposite constraints as no_flux_02.cc does). + + + #include "../tests.h" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + + + + template + void test (const Triangulation &tr, + const FiniteElement &fe) + { + DoFHandler dof(tr); + dof.distribute_dofs(fe); + + for (unsigned int i=0; i::faces_per_cell; ++i) + { + deallog << "FE=" << fe.get_name() + << ", case=" << i + << std::endl; + + std::set boundary_ids; + for (unsigned int j=0; j<=i; ++j) + boundary_ids.insert (j); + + ConstraintMatrix cm; + VectorTools::compute_normal_flux_constraints (dof, 1, boundary_ids, cm); + + cm.print (deallog.get_file_stream ()); + } + } + + + template + void test_hyper_cube() + { + Triangulation tr; + GridGenerator::hyper_cube(tr); + + for (unsigned int i=0; i::faces_per_cell; ++i) + tr.begin_active()->face(i)->set_boundary_indicator (i); + + tr.refine_global(2); + + for (unsigned int degree=1; degree<4; ++degree) + { + FESystem fe (FE_Q(degree+1), 1, + FE_Q(degree), dim, + FE_Q(degree+1), 1); + test(tr, fe); + } + } + + + int main() + { - std::ofstream logfile ("normal_flux_02/output"); ++ std::ofstream logfile ("output"); + deallog << std::setprecision (2); + deallog << std::fixed; + deallog.attach(logfile); + deallog.depth_console (0); + deallog.threshold_double(1.e-12); + + test_hyper_cube<2>(); + test_hyper_cube<3>(); + } diff --cc tests/deal.II/normal_flux_02.output index 0000000000,200db51a0f..200db51a0f mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_02.output +++ b/tests/deal.II/normal_flux_02.output diff --cc tests/deal.II/normal_flux_03.cc index 0000000000,db6adaa995..152aef1b23 mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_03.cc +++ b/tests/deal.II/normal_flux_03.cc @@@ -1,0 -1,88 +1,88 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2007 - 2013 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 normal_flux_01 but check on a hyper_sphere geometry + + #include "../tests.h" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + + + template + void test (const Triangulation &tr, + const FiniteElement &fe) + { + DoFHandler dof(tr); + dof.distribute_dofs(fe); + + deallog << "FE=" << fe.get_name() + << std::endl; + + std::set boundary_ids; + boundary_ids.insert (0); + + ConstraintMatrix cm; + VectorTools::compute_normal_flux_constraints (dof, 0, boundary_ids, cm); + + cm.print (deallog.get_file_stream ()); + } + + + + template + void test_hyper_sphere() + { + Triangulation tr; + GridGenerator::hyper_ball(tr); + + static const HyperBallBoundary boundary; + tr.set_boundary (0, boundary); + + tr.refine_global(2); + + for (unsigned int degree=1; degree<4; ++degree) + { + FESystem fe (FE_Q(degree), dim); + test(tr, fe); + } + } + + + int main() + { - std::ofstream logfile ("normal_flux_03/output"); ++ std::ofstream logfile ("output"); + deallog << std::setprecision (2); + + deallog.attach(logfile); + deallog.depth_console (0); + deallog.threshold_double(1.e-12); + + test_hyper_sphere<2>(); + test_hyper_sphere<3>(); + } diff --cc tests/deal.II/normal_flux_03.output index 0000000000,5776716535..5776716535 mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_03.output +++ b/tests/deal.II/normal_flux_03.output diff --cc tests/deal.II/normal_flux_hp_01.cc index 0000000000,9885b54fec..552094f53a mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_hp_01.cc +++ b/tests/deal.II/normal_flux_hp_01.cc @@@ -1,0 -1,95 +1,95 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2013 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. + // + // --------------------------------------------------------------------- + + + #include "../tests.h" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + + + template + void test (const Triangulation &tr, + const hp::FECollection &fe) + { + hp::DoFHandler dof(tr); + for (typename hp::DoFHandler::active_cell_iterator + cell = dof.begin_active(); cell != dof.end(); ++cell) + cell->set_active_fe_index (cell->index() % 2); + dof.distribute_dofs(fe); + + for (unsigned int i=0; i::faces_per_cell; ++i) + { + deallog << "FE=" << fe[0].get_name() + << ", case=" << i + << std::endl; + + std::set boundary_ids; + for (unsigned int j=0; j<=i; ++j) + boundary_ids.insert (j); + + ConstraintMatrix cm; + VectorTools::compute_normal_flux_constraints (dof, 0, boundary_ids, cm); + + cm.print (deallog.get_file_stream ()); + } + } + + + template + void test_hyper_cube() + { + Triangulation tr; + GridGenerator::hyper_cube(tr); + + for (unsigned int i=0; i::faces_per_cell; ++i) + tr.begin_active()->face(i)->set_boundary_indicator (i); + + tr.refine_global(2); + + for (unsigned int degree=1; degree<2; ++degree) + { + hp::FECollection fe; + for (unsigned int deg=degree; deg (FE_Q(deg), dim)); + test(tr, fe); + } + } + + + int main() + { - std::ofstream logfile ("normal_flux_hp_01/output"); ++ std::ofstream logfile ("output"); + deallog << std::setprecision (2); + deallog << std::fixed; + deallog.attach(logfile); + deallog.depth_console (0); + deallog.threshold_double(1.e-12); + + test_hyper_cube<2>(); + test_hyper_cube<3>(); + } diff --cc tests/deal.II/normal_flux_hp_01.output index 0000000000,1d1dc4dfa5..1d1dc4dfa5 mode 000000,100644..100644 --- a/tests/deal.II/normal_flux_hp_01.output +++ b/tests/deal.II/normal_flux_hp_01.output diff --cc tests/fe/fe_tools_block_renumbering.cc index 0000000000,26bec83710..1047eaea28 mode 000000,100644..100644 --- a/tests/fe/fe_tools_block_renumbering.cc +++ b/tests/fe/fe_tools_block_renumbering.cc @@@ -1,0 -1,100 +1,100 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 1998 - 2013 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. + // + // --------------------------------------------------------------------- + + + // Test the cell matrices generated in FETools and the local renumbering vector. + + #include "../tests.h" + #include + #include + #include + + #include + + #include + #include + #include + #include + #include + #include + + #include + + void logvec (const std::vector& v, const std::vector& w) + { + deallog << '['; + for (unsigned int i=0; i + void test_renumbering(const FiniteElement &fe) + { + std::vector v(fe.dofs_per_cell); + std::vector w(fe.n_blocks()); + + deallog << fe.get_name() << std::endl; + + FETools::compute_block_renumbering(fe, v, w, false); + logvec(v,w); + FETools::compute_block_renumbering(fe, v, w, true); + logvec(v,w); + } + + + template + void test_renumbering() + { + deallog.push("Renumber"); + + FE_Q q1(1); + FE_Q q3(3); + FE_DGQ dg1(1); + FE_RaviartThomas rt1(1); + FE_Nedelec n1(1); + test_renumbering(q1); + test_renumbering(q3); + test_renumbering(dg1); + test_renumbering(rt1); + test_renumbering(n1); + + FESystem q1_3(q1,3); + test_renumbering(q1_3); + FESystem q3_3(q3,3); + test_renumbering(q3_3); + FESystem q3_2_q1_3(q3, 2, q1, 3); + test_renumbering(q3_2_q1_3); + test_renumbering(FESystem(rt1,1,dg1,1)); + test_renumbering(FESystem(rt1,1,q1,1)); + test_renumbering(FESystem(rt1,2,q1,2)); + test_renumbering(FESystem(n1,1,q1,1)); + + deallog.pop(); + } + + + int main() + { - initlog(__FILE__); ++ initlog(); + // test_renumbering<1>(); + test_renumbering<2>(); + test_renumbering<3>(); + } diff --cc tests/fe/fe_tools_block_renumbering.output index 0000000000,00fcbe30cf..00fcbe30cf mode 000000,100644..100644 --- a/tests/fe/fe_tools_block_renumbering.output +++ b/tests/fe/fe_tools_block_renumbering.output diff --cc tests/integrators/assembler_simple_mgmatrix_04.cc index 0000000000,a342138935..d89ee8ff5a mode 000000,100644..100644 --- a/tests/integrators/assembler_simple_mgmatrix_04.cc +++ b/tests/integrators/assembler_simple_mgmatrix_04.cc @@@ -1,0 -1,216 +1,216 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2012 - 2013 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. + // + // --------------------------------------------------------------------- + + + /** + * @file Test whether + */ + + #include "../tests.h" + #include + #include + #include + #include + + #include + + #include + #include + #include + #include + + #include + + #include + #include + #include + #include + #include + + #include + + using namespace dealii; + using namespace LocalIntegrators; + + + template + class LaplaceMatrix : public MeshWorker::LocalIntegrator + { + public: + LaplaceMatrix(); + virtual void cell(MeshWorker::DoFInfo& dinfo, MeshWorker::IntegrationInfo& info) const; + virtual void boundary(MeshWorker::DoFInfo& dinfo, MeshWorker::IntegrationInfo& info) const; + virtual void face(MeshWorker::DoFInfo& dinfo1, MeshWorker::DoFInfo& dinfo2, + MeshWorker::IntegrationInfo& info1, MeshWorker::IntegrationInfo& info2) const; + }; + + + template + LaplaceMatrix::LaplaceMatrix() + {} + + + template + void LaplaceMatrix::cell(MeshWorker::DoFInfo& dinfo, MeshWorker::IntegrationInfo& info) const + { + Laplace::cell_matrix(dinfo.matrix(0,false).matrix, info.fe_values()); + } + + + template + void LaplaceMatrix::boundary(MeshWorker::DoFInfo& dinfo, + typename MeshWorker::IntegrationInfo& info) const + { + const unsigned int deg = info.fe_values().get_fe().tensor_degree(); + Laplace::nitsche_matrix(dinfo.matrix(0,false).matrix, info.fe_values(), + Laplace::compute_penalty(dinfo, dinfo, deg, deg)); + } + + + template + void LaplaceMatrix::face( + MeshWorker::DoFInfo& dinfo1, MeshWorker::DoFInfo& dinfo2, + MeshWorker::IntegrationInfo& info1, MeshWorker::IntegrationInfo& info2) const + { + if (info1.fe_values().get_fe().conforms(FiniteElementData::H1)) + return; + + const unsigned int deg = info1.fe_values().get_fe().tensor_degree(); + + if (info1.fe_values().get_fe().conforms(FiniteElementData::Hdiv) && + !info1.fe_values().get_fe().conforms(FiniteElementData::Hcurl)) + Laplace::ip_tangential_matrix(dinfo1.matrix(0,false).matrix, dinfo1.matrix(0,true).matrix, + dinfo2.matrix(0,true).matrix, dinfo2.matrix(0,false).matrix, + info1.fe_values(), info2.fe_values(), + Laplace::compute_penalty(dinfo1, dinfo2, deg, deg)); + else + Laplace::ip_matrix(dinfo1.matrix(0,false).matrix, dinfo1.matrix(0,true).matrix, + dinfo2.matrix(0,true).matrix, dinfo2.matrix(0,false).matrix, + info1.fe_values(), info2.fe_values(), + Laplace::compute_penalty(dinfo1, dinfo2, deg, deg)); + } + + + template + void assemble_mg_matrix(DoFHandler& dof_handler, + MeshWorker::LocalIntegrator& matrix_integrator, mg::SparseMatrixCollection& mg) + { + MGConstrainedDoFs mg_constraints; + mg_constraints.clear(); + mg_constraints.initialize(dof_handler); + + mg.set_zero(); + + MappingQ1 mapping; + + MeshWorker::IntegrationInfoBox info_box; + UpdateFlags update_flags = update_values | update_gradients | update_hessians; + info_box.add_update_flags_all(update_flags); + info_box.initialize(dof_handler.get_fe(), mapping); + + MeshWorker::DoFInfo dof_info(dof_handler); + + MeshWorker::Assembler::MGMatrixSimple > assembler; + assembler.initialize(mg_constraints); + assembler.initialize(mg.matrix); + assembler.initialize_interfaces(mg.matrix_in, mg.matrix_out); + assembler.initialize_fluxes(mg.matrix_up, mg.matrix_down); + + MeshWorker::integration_loop ( + dof_handler.begin_mg(), dof_handler.end_mg(), + dof_info, info_box, matrix_integrator, assembler); + + const unsigned int nlevels = dof_handler.get_tria().n_levels(); + for (unsigned int level=0;level + void test(FiniteElement &fe) + { + deallog << fe.get_name() << std::endl; + + Triangulation tr; + std::vector repititions (dim, 1); + repititions[0] = 2; + const Point p1 = (dim == 1 ? Point (-1.) : (dim == 2 ? Point(-1.,-1.) : Point (-1.,-1.,-1.))); + const Point p2 = (dim == 1 ? Point (1.) : (dim == 2 ? Point(1.,1.) : Point (1.,1.,1.))); + GridGenerator::subdivided_hyper_rectangle(tr, repititions, p1, p2); + tr.begin_active()->set_refine_flag(); + tr.execute_coarsening_and_refinement(); + + LaplaceMatrix matrix_integrator; + + MGDoFHandler dof(tr); + dof.distribute_dofs(fe); + mg::SparseMatrixCollection mg; + mg.resize(0,tr.n_levels()-1); + mg.reinit(dof); + assemble_mg_matrix(dof, matrix_integrator, mg); + + for (unsigned int level=0;level0) + { + deallog << "in" << std::endl; + mg.matrix_in[level].print_formatted(deallog.get_file_stream(), prec, false, wd, "0."); + deallog << "out" << std::endl; + mg.matrix_out[level].print_formatted(deallog.get_file_stream(), prec, false, wd, "0."); + deallog << "up" << std::endl; + mg.matrix_up[level].print_formatted(deallog.get_file_stream(), prec, false, wd, "0."); + deallog << "down" << std::endl; + mg.matrix_down[level].print_formatted(deallog.get_file_stream(), prec, false, wd, "0."); + } + } + } + + + int main() + { - const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); ++ const std::string logname("output"); + std::ofstream logfile(logname.c_str()); + deallog.attach(logfile); + deallog.depth_console (0); + + FE_DGP<2> p0(0); + FE_DGP<2> p1(1); + FE_RaviartThomas<2> rt0(0); + FE_RaviartThomas<2> rt1(1); + FE_Q<2> q2(2); + + FESystem<2> sys1(p0, 2, p1, 1); + FESystem<2> sys2(p0, 2, rt0, 1); + FESystem<2> sys3(rt0, 1, p0, 2); + FESystem<2> sys4(p1, 2, q2, 2); + FESystem<2> sys5(q2, 2, p1, 2); + + test(rt0); + test(rt1); + // test(sys2); + // test(sys3); + // test(sys4); + // test(sys5); + } diff --cc tests/integrators/assembler_simple_mgmatrix_04.output index 0000000000,133bc55e48..133bc55e48 mode 000000,100644..100644 --- a/tests/integrators/assembler_simple_mgmatrix_04.output +++ b/tests/integrators/assembler_simple_mgmatrix_04.output diff --cc tests/multigrid/sparse_matrix_collection_01.cc index 0000000000,8acdd24022..c6fc793922 mode 000000,100644..100644 --- a/tests/multigrid/sparse_matrix_collection_01.cc +++ b/tests/multigrid/sparse_matrix_collection_01.cc @@@ -1,0 -1,42 +1,42 @@@ + // --------------------------------------------------------------------- + // $Id$ + // + // Copyright (C) 2000 - 2013 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. + // + // --------------------------------------------------------------------- + + #include "../tests.h" + #include + #include + + #include + #include + #include + #include + + using namespace std; + + + + int main() + { - initlog(__FILE__); ++ initlog(); + + mg::SparseMatrixCollection smc; + smc.resize(0, 5); + + deallog << "matrix " << smc.matrix.min_level() << '-' << smc.matrix.max_level() << std::endl; + deallog << "matrix_in " << smc.matrix_in.min_level() << '-' << smc.matrix_in.max_level() << std::endl; + deallog << "matrix_out " << smc.matrix_out.min_level() << '-' << smc.matrix_out.max_level() << std::endl; + deallog << "matrix_up " << smc.matrix_up.min_level() << '-' << smc.matrix_up.max_level() << std::endl; + deallog << "matrix_down " << smc.matrix_down.min_level() << '-' << smc.matrix_down.max_level() << std::endl; + } diff --cc tests/multigrid/sparse_matrix_collection_01.output index 0000000000,ff05a075c6..ff05a075c6 mode 000000,100644..100644 --- a/tests/multigrid/sparse_matrix_collection_01.output +++ b/tests/multigrid/sparse_matrix_collection_01.output