From cd365f6bc810dbfbe2e3c8a971101dde8fbfbcc5 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sat, 27 Aug 2016 15:48:05 +0200 Subject: [PATCH] Enable computations with different numbers of quadrature points and degrees of freedom per cell. Cleanup manifolds. --- tests/matrix_free/assemble_matrix_01.cc | 16 ++++++-- tests/matrix_free/assemble_matrix_02.cc | 16 ++++++-- tests/matrix_free/assemble_matrix_03.cc | 16 ++++++-- tests/matrix_free/copy_feevaluation.cc | 17 ++++---- tests/matrix_free/get_functions_circle.cc | 13 ++++-- tests/matrix_free/get_functions_common.h | 18 +++++++-- tests/matrix_free/get_functions_gl.cc | 13 ++++-- tests/matrix_free/get_functions_mappingq.cc | 13 ++++-- .../get_functions_q_hierarchical.cc | 13 ++++-- tests/matrix_free/get_functions_rect.cc | 13 ++++-- tests/matrix_free/get_values_plain.cc | 9 ++--- tests/matrix_free/integrate_functions.cc | 13 ++++-- .../integrate_functions_multife.cc | 13 ++++-- tests/matrix_free/inverse_mass_01.cc | 20 ++++++---- tests/matrix_free/inverse_mass_03.cc | 18 ++++++--- tests/matrix_free/matrix_vector_01.cc | 2 +- tests/matrix_free/matrix_vector_02.cc | 2 +- tests/matrix_free/matrix_vector_03.cc | 2 +- tests/matrix_free/matrix_vector_04.cc | 10 ++--- tests/matrix_free/matrix_vector_05.cc | 2 +- tests/matrix_free/matrix_vector_06.cc | 2 +- tests/matrix_free/matrix_vector_07.cc | 15 ++++--- tests/matrix_free/matrix_vector_08.cc | 2 +- tests/matrix_free/matrix_vector_09.cc | 2 +- tests/matrix_free/matrix_vector_14.cc | 20 ++++++---- tests/matrix_free/matrix_vector_15.cc | 18 ++++++--- tests/matrix_free/matrix_vector_16.cc | 18 ++++++--- tests/matrix_free/matrix_vector_17.cc | 22 +++++----- tests/matrix_free/matrix_vector_common.h | 32 ++++++++++----- tests/matrix_free/matrix_vector_curl.cc | 18 ++++++--- tests/matrix_free/matrix_vector_float.cc | 2 +- tests/matrix_free/matrix_vector_hp.cc | 40 +++++++++++-------- tests/matrix_free/matrix_vector_mf.h | 24 +++++++---- tests/matrix_free/matrix_vector_mg.cc | 21 ++++++---- .../matrix_vector_stokes_noflux.cc | 16 +++++--- tests/matrix_free/no_index_initialize.cc | 14 +++++-- tests/matrix_free/quadrature_points.cc | 14 +++++-- tests/matrix_free/thread_correctness_hp.cc | 3 +- 38 files changed, 347 insertions(+), 175 deletions(-) diff --git a/tests/matrix_free/assemble_matrix_01.cc b/tests/matrix_free/assemble_matrix_01.cc index 6ea1ed12a5..87f91b72a1 100644 --- a/tests/matrix_free/assemble_matrix_01.cc +++ b/tests/matrix_free/assemble_matrix_01.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2014 - 2015 by the deal.II authors +// Copyright (C) 2014 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -122,10 +122,18 @@ void do_test (const DoFHandler &dof) template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); diff --git a/tests/matrix_free/assemble_matrix_02.cc b/tests/matrix_free/assemble_matrix_02.cc index 23b5c5dae8..04ae529d6e 100644 --- a/tests/matrix_free/assemble_matrix_02.cc +++ b/tests/matrix_free/assemble_matrix_02.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2014 - 2015 by the deal.II authors +// Copyright (C) 2014 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -174,10 +174,18 @@ void do_test (const DoFHandler &dof) template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + if (dim == 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); diff --git a/tests/matrix_free/assemble_matrix_03.cc b/tests/matrix_free/assemble_matrix_03.cc index dbb7b86082..33da884da5 100644 --- a/tests/matrix_free/assemble_matrix_03.cc +++ b/tests/matrix_free/assemble_matrix_03.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2014 - 2015 by the deal.II authors +// Copyright (C) 2014 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -162,10 +162,18 @@ void do_test (const DoFHandler &dof) template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + tria.refine_global(5-dim); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); diff --git a/tests/matrix_free/copy_feevaluation.cc b/tests/matrix_free/copy_feevaluation.cc index dbd843b64c..51079726cf 100644 --- a/tests/matrix_free/copy_feevaluation.cc +++ b/tests/matrix_free/copy_feevaluation.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2015 by the deal.II authors +// Copyright (C) 2013 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -32,6 +32,7 @@ std::ofstream logfile("output"); #include #include #include +#include #include #include #include @@ -124,12 +125,16 @@ private: template void test () { + SphericalManifold manifold; + HyperShellBoundary boundary; Triangulation triangulation; GridGenerator::hyper_shell (triangulation, Point(), 0.5, 1., 96, true); - static HyperShellBoundary boundary; - triangulation.set_boundary (0, boundary); - triangulation.set_boundary (1, boundary); + triangulation.set_all_manifold_ids(0); + triangulation.set_all_manifold_ids_on_boundary(1); + triangulation.set_manifold (0, manifold); + triangulation.set_manifold (1, boundary); + triangulation.begin_active()->set_refine_flag(); triangulation.last()->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); @@ -164,8 +169,7 @@ void test () stokes_sub_blocks[dim] = 1; DoFRenumbering::component_wise (dof_handler, stokes_sub_blocks); - std::set no_normal_flux_boundaries; - no_normal_flux_boundaries.insert (0); + std::set no_normal_flux_boundaries; no_normal_flux_boundaries.insert (1); DoFTools::make_hanging_node_constraints (dof_handler, constraints); @@ -345,4 +349,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/get_functions_circle.cc b/tests/matrix_free/get_functions_circle.cc index 2a59f228c6..d2fe6fd060 100644 --- a/tests/matrix_free/get_functions_circle.cc +++ b/tests/matrix_free/get_functions_circle.cc @@ -31,10 +31,18 @@ std::ofstream logfile("output"); template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + // refine first and last cell tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); @@ -51,4 +59,3 @@ void test () do_test (dof, constraints); } - diff --git a/tests/matrix_free/get_functions_common.h b/tests/matrix_free/get_functions_common.h index b33b521ae0..039dd4bf8d 100644 --- a/tests/matrix_free/get_functions_common.h +++ b/tests/matrix_free/get_functions_common.h @@ -1,7 +1,17 @@ -//------------------ get_functions_common.h ------------------------ -// Version: $Name$ +// --------------------------------------------------------------------- // -//------------------ get_functions_common.h ------------------------ +// Copyright (C) 2011 - 2016 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. +// +// --------------------------------------------------------------------- // this is a template for getting the function values and comparing them with @@ -19,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/matrix_free/get_functions_gl.cc b/tests/matrix_free/get_functions_gl.cc index b1df4522a7..43ceb7b845 100644 --- a/tests/matrix_free/get_functions_gl.cc +++ b/tests/matrix_free/get_functions_gl.cc @@ -34,10 +34,18 @@ template void test () { typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + // refine first and last cell tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); @@ -82,4 +90,3 @@ void test () MatrixFreeTest mf (mf_data, mapping); mf.test_functions (solution); } - diff --git a/tests/matrix_free/get_functions_mappingq.cc b/tests/matrix_free/get_functions_mappingq.cc index 377fa92907..9b7f97d792 100644 --- a/tests/matrix_free/get_functions_mappingq.cc +++ b/tests/matrix_free/get_functions_mappingq.cc @@ -32,10 +32,18 @@ template void test () { typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + // refine first and last cell tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); @@ -85,4 +93,3 @@ void test () mf.test_functions(solution); deallog << std::endl; } - diff --git a/tests/matrix_free/get_functions_q_hierarchical.cc b/tests/matrix_free/get_functions_q_hierarchical.cc index 0a875a996f..3434d2fba8 100644 --- a/tests/matrix_free/get_functions_q_hierarchical.cc +++ b/tests/matrix_free/get_functions_q_hierarchical.cc @@ -37,10 +37,18 @@ template void test () { typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + // refine first and last cell tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); @@ -85,4 +93,3 @@ void test () MatrixFreeTest mf (mf_data, mapping); mf.test_functions (solution); } - diff --git a/tests/matrix_free/get_functions_rect.cc b/tests/matrix_free/get_functions_rect.cc index 7697a79724..e875f40f6f 100644 --- a/tests/matrix_free/get_functions_rect.cc +++ b/tests/matrix_free/get_functions_rect.cc @@ -53,10 +53,18 @@ template void test () { typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + // refine first and last cell tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); @@ -105,4 +113,3 @@ void test () sub_test (dof, constraints, mf_data, solution); } - diff --git a/tests/matrix_free/get_values_plain.cc b/tests/matrix_free/get_values_plain.cc index df50452263..8623ce0b78 100644 --- a/tests/matrix_free/get_values_plain.cc +++ b/tests/matrix_free/get_values_plain.cc @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -140,11 +140,11 @@ void do_test (const DoFHandler &dof, template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_shell (tria, Point(), 1., 2., 96, true); - static const HyperShellBoundary boundary; - tria.set_boundary (0, boundary); - tria.set_boundary (1, boundary); + tria.set_all_manifold_ids(0); + tria.set_manifold (0, manifold); // refine a few cells for (unsigned int i=0; i<11-3*dim; ++i) @@ -191,4 +191,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/integrate_functions.cc b/tests/matrix_free/integrate_functions.cc index 071b473bce..4e6255b8ec 100644 --- a/tests/matrix_free/integrate_functions.cc +++ b/tests/matrix_free/integrate_functions.cc @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -145,13 +145,19 @@ template void test () { typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); typename Triangulation::active_cell_iterator cell = tria.begin_active (), endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); @@ -231,4 +237,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/integrate_functions_multife.cc b/tests/matrix_free/integrate_functions_multife.cc index 82a42cfdb2..a3a025954e 100644 --- a/tests/matrix_free/integrate_functions_multife.cc +++ b/tests/matrix_free/integrate_functions_multife.cc @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -226,13 +226,19 @@ void test () { // create hyper ball geometry and refine some // cells + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); typename Triangulation::active_cell_iterator cell = tria.begin_active (), endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); @@ -354,4 +360,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/inverse_mass_01.cc b/tests/matrix_free/inverse_mass_01.cc index b86f057fc7..a410d4b0ce 100644 --- a/tests/matrix_free/inverse_mass_01.cc +++ b/tests/matrix_free/inverse_mass_01.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2014 - 2015 by the deal.II authors +// Copyright (C) 2014 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -163,18 +163,24 @@ void do_test (const DoFHandler &dof) template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.execute_coarsening_and_refinement(); - typename Triangulation::active_cell_iterator - cell = tria.begin_active (), - endc = tria.end(); + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); diff --git a/tests/matrix_free/inverse_mass_03.cc b/tests/matrix_free/inverse_mass_03.cc index ce00f04911..b80bb3170e 100644 --- a/tests/matrix_free/inverse_mass_03.cc +++ b/tests/matrix_free/inverse_mass_03.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -174,18 +174,24 @@ void do_test (const DoFHandler &dof) template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.execute_coarsening_and_refinement(); - typename Triangulation::active_cell_iterator - cell = tria.begin_active (), - endc = tria.end(); + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); diff --git a/tests/matrix_free/matrix_vector_01.cc b/tests/matrix_free/matrix_vector_01.cc index 47341f1ce4..d6abb70ad0 100644 --- a/tests/matrix_free/matrix_vector_01.cc +++ b/tests/matrix_free/matrix_vector_01.cc @@ -40,6 +40,6 @@ void test () ConstraintMatrix constraints; constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_02.cc b/tests/matrix_free/matrix_vector_02.cc index 48b687e51f..b849526104 100644 --- a/tests/matrix_free/matrix_vector_02.cc +++ b/tests/matrix_free/matrix_vector_02.cc @@ -43,5 +43,5 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_03.cc b/tests/matrix_free/matrix_vector_03.cc index bf3bcd94a6..3628e2e687 100644 --- a/tests/matrix_free/matrix_vector_03.cc +++ b/tests/matrix_free/matrix_vector_03.cc @@ -71,5 +71,5 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_04.cc b/tests/matrix_free/matrix_vector_04.cc index 9980560637..8cdd4b82cf 100644 --- a/tests/matrix_free/matrix_vector_04.cc +++ b/tests/matrix_free/matrix_vector_04.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2014 by the deal.II authors +// Copyright (C) 2013 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -30,12 +30,12 @@ std::ofstream logfile("output"); template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_shell (tria, Point(), 0.5, 1., 96, true); - static const HyperShellBoundary boundary; - tria.set_boundary (0, boundary); - tria.set_boundary (1, boundary); + tria.set_all_manifold_ids(0); + tria.set_manifold (0, manifold); if (dim == 2) tria.refine_global (2); @@ -46,5 +46,5 @@ void test () DoFTools::make_hanging_node_constraints(dof, constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_05.cc b/tests/matrix_free/matrix_vector_05.cc index 707daa7304..86b1d196c7 100644 --- a/tests/matrix_free/matrix_vector_05.cc +++ b/tests/matrix_free/matrix_vector_05.cc @@ -76,5 +76,5 @@ void test () DoFTools::make_hanging_node_constraints(dof, constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_06.cc b/tests/matrix_free/matrix_vector_06.cc index 5579e49deb..140b6ce6eb 100644 --- a/tests/matrix_free/matrix_vector_06.cc +++ b/tests/matrix_free/matrix_vector_06.cc @@ -70,5 +70,5 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_07.cc b/tests/matrix_free/matrix_vector_07.cc index dca48f3223..b2c39699c8 100644 --- a/tests/matrix_free/matrix_vector_07.cc +++ b/tests/matrix_free/matrix_vector_07.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2014-2014 by the deal.II authors +// Copyright (C) 2013 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -35,13 +35,18 @@ std::ofstream logfile("output"); template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); typename Triangulation::active_cell_iterator cell = tria.begin_active (), endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + cell = tria.begin_active(); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); @@ -83,8 +88,8 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); // test with coloring only as well - do_test (dof, constraints, 2); + do_test (dof, constraints, 2); } diff --git a/tests/matrix_free/matrix_vector_08.cc b/tests/matrix_free/matrix_vector_08.cc index 847dd82cb9..397b905c73 100644 --- a/tests/matrix_free/matrix_vector_08.cc +++ b/tests/matrix_free/matrix_vector_08.cc @@ -69,5 +69,5 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_09.cc b/tests/matrix_free/matrix_vector_09.cc index 32fb47501c..da5333a707 100644 --- a/tests/matrix_free/matrix_vector_09.cc +++ b/tests/matrix_free/matrix_vector_09.cc @@ -68,5 +68,5 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_14.cc b/tests/matrix_free/matrix_vector_14.cc index f4a69aeaa9..8c098f4615 100644 --- a/tests/matrix_free/matrix_vector_14.cc +++ b/tests/matrix_free/matrix_vector_14.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2014 by the deal.II authors +// Copyright (C) 2014 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -34,18 +34,23 @@ std::ofstream logfile("output"); template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.execute_coarsening_and_refinement(); - typename Triangulation::active_cell_iterator - cell = tria.begin_active (), - endc = tria.end(); + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); @@ -56,6 +61,5 @@ void test () dof.distribute_dofs(fe); ConstraintMatrix constraints; - do_test (dof, constraints); + do_test (dof, constraints); } - diff --git a/tests/matrix_free/matrix_vector_15.cc b/tests/matrix_free/matrix_vector_15.cc index 46df5d9db6..6df35b9ebf 100644 --- a/tests/matrix_free/matrix_vector_15.cc +++ b/tests/matrix_free/matrix_vector_15.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -177,18 +177,24 @@ void do_test (const DoFHandler &dof, template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.execute_coarsening_and_refinement(); - typename Triangulation::active_cell_iterator - cell = tria.begin_active (), - endc = tria.end(); + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); diff --git a/tests/matrix_free/matrix_vector_16.cc b/tests/matrix_free/matrix_vector_16.cc index b2a87daec8..ad6f4cbeba 100644 --- a/tests/matrix_free/matrix_vector_16.cc +++ b/tests/matrix_free/matrix_vector_16.cc @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -181,18 +181,24 @@ void do_test (const DoFHandler &dof, template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.execute_coarsening_and_refinement(); - typename Triangulation::active_cell_iterator - cell = tria.begin_active (), - endc = tria.end(); + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); diff --git a/tests/matrix_free/matrix_vector_17.cc b/tests/matrix_free/matrix_vector_17.cc index 2e6d4785cf..50ba2cb34e 100644 --- a/tests/matrix_free/matrix_vector_17.cc +++ b/tests/matrix_free/matrix_vector_17.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2014 by the deal.II authors +// Copyright (C) 2014 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -33,18 +33,23 @@ std::ofstream logfile("output"); template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); if (dim < 3 || fe_degree < 2) tria.refine_global(1); tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); tria.execute_coarsening_and_refinement(); - typename Triangulation::active_cell_iterator - cell = tria.begin_active (), - endc = tria.end(); + cell = tria.begin_active (); for (; cell!=endc; ++cell) if (cell->center().norm()<1e-8) cell->set_refine_flag(); @@ -59,8 +64,5 @@ void test () constraints); constraints.close(); - do_test (dof, constraints); + do_test (dof, constraints); } - - - diff --git a/tests/matrix_free/matrix_vector_common.h b/tests/matrix_free/matrix_vector_common.h index 55271faff7..87c97352c3 100644 --- a/tests/matrix_free/matrix_vector_common.h +++ b/tests/matrix_free/matrix_vector_common.h @@ -1,7 +1,17 @@ -//------------------ matrix_vector_common.h ------------------------ -// Version: $Name$ +// --------------------------------------------------------------------- // -//------------------ matrix_vector_common.h ------------------------ +// Copyright (C) 2013 - 2016 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. +// +// --------------------------------------------------------------------- // this is a template for matrix-vector products with the Helmholtz equation @@ -18,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,7 +48,7 @@ void test (); -template +template void do_test (const DoFHandler &dof, const ConstraintMatrix &constraints, const unsigned int parallel_option = 0) @@ -51,9 +61,10 @@ void do_test (const DoFHandler &dof, //std::cout << "Number of degrees of freedom: " << dof.n_dofs() << std::endl; //std::cout << "Number of constraints: " << constraints.n_constraints() << std::endl; + MappingQGeneric mapping(fe_degree); MatrixFree mf_data; { - const QGauss<1> quad (fe_degree+1); + const QGauss<1> quad (n_q_points_1d); typename MatrixFree::AdditionalData data; if (parallel_option == 1) data.tasks_parallel_scheme = @@ -69,10 +80,10 @@ void do_test (const DoFHandler &dof, } data.tasks_block_size = 7; - mf_data.reinit (dof, constraints, quad, data); + mf_data.reinit (mapping, dof, constraints, quad, data); } - MatrixFreeTest mf (mf_data); + MatrixFreeTest,n_q_points_1d> mf (mf_data); Vector in (dof.n_dofs()), out (dof.n_dofs()); Vector in_dist (dof.n_dofs()); Vector out_dist (in_dist); @@ -98,9 +109,9 @@ void do_test (const DoFHandler &dof, } SparseMatrix sparse_matrix (sparsity); { - QGauss quadrature_formula(fe_degree+1); + QGauss quadrature_formula(n_q_points_1d); - FEValues fe_values (dof.get_fe(), quadrature_formula, + FEValues fe_values (mapping, dof.get_fe(), quadrature_formula, update_values | update_gradients | update_JxW_values); @@ -165,4 +176,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/matrix_vector_curl.cc b/tests/matrix_free/matrix_vector_curl.cc index c1783108ec..a465ed80a0 100644 --- a/tests/matrix_free/matrix_vector_curl.cc +++ b/tests/matrix_free/matrix_vector_curl.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2015 by the deal.II authors +// Copyright (C) 2013 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -33,7 +33,7 @@ std::ofstream logfile("output"); #include #include #include -#include +#include #include #include #include @@ -104,10 +104,17 @@ private: template void test () { - Triangulation tria; + const SphericalManifold manifold; + Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); tria.refine_global(4-dim); // refine a few cells @@ -286,4 +293,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/matrix_vector_float.cc b/tests/matrix_free/matrix_vector_float.cc index b38dade5ec..30652b5eeb 100644 --- a/tests/matrix_free/matrix_vector_float.cc +++ b/tests/matrix_free/matrix_vector_float.cc @@ -69,5 +69,5 @@ void test () constraints.close(); deallog.threshold_double (5e-6); - do_test (dof, constraints); + do_test (dof, constraints); } diff --git a/tests/matrix_free/matrix_vector_hp.cc b/tests/matrix_free/matrix_vector_hp.cc index 2a458bbad2..8a01488468 100644 --- a/tests/matrix_free/matrix_vector_hp.cc +++ b/tests/matrix_free/matrix_vector_hp.cc @@ -48,32 +48,32 @@ public: std::pair subrange_deg = data.create_cell_subrange_hp (cell_range, 1); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,2> (data, dst, src, + subrange_deg); subrange_deg = data.create_cell_subrange_hp (cell_range, 2); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,3> (data, dst, src, + subrange_deg); subrange_deg = data.create_cell_subrange_hp (cell_range, 3); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,4> (data, dst, src, + subrange_deg); subrange_deg = data.create_cell_subrange_hp (cell_range, 4); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,5> (data, dst, src, + subrange_deg); subrange_deg = data.create_cell_subrange_hp (cell_range, 5); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,6> (data, dst, src, + subrange_deg); subrange_deg = data.create_cell_subrange_hp (cell_range, 6); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,7> (data, dst, src, + subrange_deg); subrange_deg = data.create_cell_subrange_hp (cell_range, 7); if (subrange_deg.second > subrange_deg.first) - helmholtz_operator > (data, dst, src, - subrange_deg); + helmholtz_operator,8> (data, dst, src, + subrange_deg); } void vmult (Vector &dst, @@ -96,10 +96,17 @@ void test () return; typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); tria.refine_global(1); // refine a few cells @@ -233,4 +240,3 @@ void test () const double diff_norm = result_mf.linfty_norm(); deallog << "Norm of difference: " << diff_norm << std::endl << std::endl; } - diff --git a/tests/matrix_free/matrix_vector_mf.h b/tests/matrix_free/matrix_vector_mf.h index 3b713a16e6..461e74f4e4 100644 --- a/tests/matrix_free/matrix_vector_mf.h +++ b/tests/matrix_free/matrix_vector_mf.h @@ -1,7 +1,17 @@ -//------------------ matrix_vector_common.h ------------------------ -// Version: $Name$ +// --------------------------------------------------------------------- // -//------------------ matrix_vector_common.h ------------------------ +// Copyright (C) 2013 - 2016 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. +// +// --------------------------------------------------------------------- // this is a template for matrix-vector products with the Helmholtz equation @@ -18,7 +28,7 @@ #include -template +template void helmholtz_operator (const MatrixFree &data, VectorType &dst, @@ -26,7 +36,7 @@ helmholtz_operator (const MatrixFree &data, const std::pair &cell_range) { typedef typename VectorType::value_type Number; - FEEvaluation fe_eval (data); + FEEvaluation fe_eval (data); const unsigned int n_q_points = fe_eval.n_q_points; for (unsigned int cell=cell_range.first; cell &data, -template > +template , int n_q_points_1d=fe_degree+1> class MatrixFreeTest { public: @@ -64,7 +74,7 @@ public: VectorType &, const VectorType &, const std::pair &)> - wrap = helmholtz_operator; + wrap = helmholtz_operator; data.cell_loop (wrap, dst, src); }; diff --git a/tests/matrix_free/matrix_vector_mg.cc b/tests/matrix_free/matrix_vector_mg.cc index aefd1a87f7..1f84da8844 100644 --- a/tests/matrix_free/matrix_vector_mg.cc +++ b/tests/matrix_free/matrix_vector_mg.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2015 by the deal.II authors +// Copyright (C) 2013 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -34,10 +34,17 @@ std::ofstream logfile("output"); template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); tria.refine_global(5-dim); FE_Q fe (fe_degree); @@ -57,9 +64,10 @@ void test () //std::cout << "Number of degrees of freedom: " << dof.n_dofs() << std::endl; // set up MatrixFree + MappingQGeneric mapping(fe_degree); QGauss<1> quad (fe_degree+1); MatrixFree mf_data; - mf_data.reinit (dof, constraints, quad); + mf_data.reinit (mapping, dof, constraints, quad); SparsityPattern sparsity; SparseMatrix system_matrix; { @@ -95,7 +103,7 @@ void test () mg_constraints[level].close(); typename MatrixFree::AdditionalData data; data.level_mg_handler = level; - mg_matrices[level].reinit(dof, mg_constraints[level], quad, data); + mg_matrices[level].reinit(mapping, dof, mg_constraints[level], quad, data); DynamicSparsityPattern csp; csp.reinit (dof.n_dofs(level), dof.n_dofs(level)); @@ -109,7 +117,7 @@ void test () // discretization and on all levels { QGauss quad (fe_degree+1); - FEValues fe_values (fe, quad, + FEValues fe_values (mapping, fe, quad, update_values | update_gradients | update_JxW_values); const unsigned int n_quadrature_points = quad.size(); @@ -213,4 +221,3 @@ void test () } deallog << std::endl; } - diff --git a/tests/matrix_free/matrix_vector_stokes_noflux.cc b/tests/matrix_free/matrix_vector_stokes_noflux.cc index 45a3e19fe6..dcd2e5fb6e 100644 --- a/tests/matrix_free/matrix_vector_stokes_noflux.cc +++ b/tests/matrix_free/matrix_vector_stokes_noflux.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2013 - 2015 by the deal.II authors +// Copyright (C) 2013 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -33,6 +33,7 @@ std::ofstream logfile("output"); #include #include #include +#include #include #include #include @@ -122,12 +123,16 @@ private: template void test () { + SphericalManifold manifold; + HyperShellBoundary boundary; Triangulation triangulation; GridGenerator::hyper_shell (triangulation, Point(), 0.5, 1., 96, true); - static HyperShellBoundary boundary; - triangulation.set_boundary (0, boundary); - triangulation.set_boundary (1, boundary); + triangulation.set_all_manifold_ids(0); + triangulation.set_all_manifold_ids_on_boundary(1); + triangulation.set_manifold (0, manifold); + triangulation.set_manifold (1, boundary); + triangulation.begin_active()->set_refine_flag(); triangulation.last()->set_refine_flag(); triangulation.execute_coarsening_and_refinement(); @@ -162,7 +167,7 @@ void test () stokes_sub_blocks[dim] = 1; DoFRenumbering::component_wise (dof_handler, stokes_sub_blocks); - std::set no_normal_flux_boundaries; + std::set no_normal_flux_boundaries; no_normal_flux_boundaries.insert (0); no_normal_flux_boundaries.insert (1); DoFTools::make_hanging_node_constraints (dof_handler, @@ -343,4 +348,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/no_index_initialize.cc b/tests/matrix_free/no_index_initialize.cc index ee6d2f6985..462f2bac30 100644 --- a/tests/matrix_free/no_index_initialize.cc +++ b/tests/matrix_free/no_index_initialize.cc @@ -31,7 +31,7 @@ std::ofstream logfile("output"); #include #include #include -#include +#include #include #include #include @@ -170,10 +170,18 @@ int main () template void test () { + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); + // refine first and last cell tria.begin(tria.n_levels()-1)->set_refine_flag(); tria.last()->set_refine_flag(); diff --git a/tests/matrix_free/quadrature_points.cc b/tests/matrix_free/quadrature_points.cc index a86f7af117..137c1653bb 100644 --- a/tests/matrix_free/quadrature_points.cc +++ b/tests/matrix_free/quadrature_points.cc @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,10 +46,17 @@ template void test () { typedef double number; + const SphericalManifold manifold; Triangulation tria; GridGenerator::hyper_ball (tria); - static const HyperBallBoundary boundary; - tria.set_boundary (0, boundary); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + cell->face(f)->set_all_manifold_ids(0); + tria.set_manifold (0, manifold); tria.refine_global(5-dim); MappingQ mapping (4); @@ -119,4 +126,3 @@ int main () deallog.pop(); } } - diff --git a/tests/matrix_free/thread_correctness_hp.cc b/tests/matrix_free/thread_correctness_hp.cc index feb4e27210..8041caf366 100644 --- a/tests/matrix_free/thread_correctness_hp.cc +++ b/tests/matrix_free/thread_correctness_hp.cc @@ -52,7 +52,7 @@ public: #define CALL_METHOD(degree) \ subrange_deg = data.create_cell_subrange_hp(cell_range, degree); \ if (subrange_deg.second > subrange_deg.first) \ - helmholtz_operator > (data, dst, src, subrange_deg) + helmholtz_operator,degree+1> (data, dst, src, subrange_deg) CALL_METHOD(1); CALL_METHOD(2); @@ -226,4 +226,3 @@ void test () do_test(parallel_option); deallog.pop(); } - -- 2.39.5