From: Wolfgang Bangerth Date: Tue, 24 Aug 2021 20:02:18 +0000 (-0600) Subject: Add more tests. X-Git-Tag: v9.4.0-rc1~1037^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1e90062e8cd11a4e8d8b4390b6bed747777ffc5;p=dealii.git Add more tests. --- diff --git a/tests/hp/hp_line_dof_identities_q_equidistant_multiway.cc b/tests/hp/hp_line_dof_identities_q_equidistant_multiway.cc new file mode 100644 index 0000000000..10bca7137b --- /dev/null +++ b/tests/hp/hp_line_dof_identities_q_equidistant_multiway.cc @@ -0,0 +1,82 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2005 - 2018 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// Check FE_Collection::hp_line_dof_identities with multiway +// identities for the FE_Q element. For this particular test, we use +// equidistant support points for the the FE_Q element since that adds +// additional identities between FE_Q(4) and FE_Q(8). + + +#include + +#include + +#include "../tests.h" + + + +template +void +test() +{ + deallog << "dim=" << dim << std::endl; + + hp::FECollection fe_collection; + for (unsigned int i = 1; i <= 8; ++i) + { + const double dx = 1. / i; + + std::vector> equidistant; + for (unsigned int j = 0; j <= i; ++j) + equidistant.emplace_back(Point<1>(j * dx)); + Quadrature<1> q_equidistant(equidistant); + fe_collection.push_back(FE_Q(q_equidistant)); + } + + // construct the complete set of fe indices + std::set fe_indices; + for (unsigned int i = 0; i < fe_collection.size(); ++i) + fe_indices.emplace(i); + + const auto identities = fe_collection.hp_line_dof_identities(fe_indices); + + for (unsigned int i = 0; i < identities.size(); ++i) + { + deallog << "Identity set #" << i << std::endl; + for (const auto &p : identities[i]) + { + deallog << " " << fe_collection[p.first].get_name() + << ": line dof index " << p.second << std::endl; + } + } + + deallog << std::endl; +} + + + +int +main() +{ + initlog(); + deallog.get_file_stream().precision(2); + + test<2>(); + test<3>(); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/hp_line_dof_identities_q_equidistant_multiway.output b/tests/hp/hp_line_dof_identities_q_equidistant_multiway.output new file mode 100644 index 0000000000..a1870b111e --- /dev/null +++ b/tests/hp/hp_line_dof_identities_q_equidistant_multiway.output @@ -0,0 +1,40 @@ + +DEAL::dim=2 +DEAL::Identity set #0 +DEAL:: FE_Q<2>(2): line dof index 0 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): line dof index 1 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): line dof index 2 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): line dof index 3 +DEAL::Identity set #1 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),3)): line dof index 0 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): line dof index 1 +DEAL::Identity set #2 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),3)): line dof index 1 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): line dof index 3 +DEAL::Identity set #3 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): line dof index 0 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): line dof index 1 +DEAL::Identity set #4 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): line dof index 2 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): line dof index 5 +DEAL:: +DEAL::dim=3 +DEAL::Identity set #0 +DEAL:: FE_Q<3>(2): line dof index 0 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): line dof index 1 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): line dof index 2 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): line dof index 3 +DEAL::Identity set #1 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),3)): line dof index 0 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): line dof index 1 +DEAL::Identity set #2 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),3)): line dof index 1 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): line dof index 3 +DEAL::Identity set #3 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): line dof index 0 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): line dof index 1 +DEAL::Identity set #4 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): line dof index 2 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): line dof index 5 +DEAL:: +DEAL::OK diff --git a/tests/hp/hp_quad_dof_identities_q_equidistant_multiway.cc b/tests/hp/hp_quad_dof_identities_q_equidistant_multiway.cc new file mode 100644 index 0000000000..4a0f25d5b5 --- /dev/null +++ b/tests/hp/hp_quad_dof_identities_q_equidistant_multiway.cc @@ -0,0 +1,82 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2005 - 2018 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// Check FE_Collection::hp_quad_dof_identities with multiway +// identities for the FE_Q element. For this particular test, we use +// equidistant support points for the the FE_Q element since that adds +// additional identities between FE_Q(4) and FE_Q(8). + + +#include + +#include + +#include "../tests.h" + + + +template +void +test() +{ + deallog << "dim=" << dim << std::endl; + + hp::FECollection fe_collection; + for (unsigned int i = 1; i <= 8; ++i) + { + const double dx = 1. / i; + + std::vector> equidistant; + for (unsigned int j = 0; j <= i; ++j) + equidistant.emplace_back(Point<1>(j * dx)); + Quadrature<1> q_equidistant(equidistant); + fe_collection.push_back(FE_Q(q_equidistant)); + } + + // construct the complete set of fe indices + std::set fe_indices; + for (unsigned int i = 0; i < fe_collection.size(); ++i) + fe_indices.emplace(i); + + const auto identities = fe_collection.hp_quad_dof_identities(fe_indices); + + for (unsigned int i = 0; i < identities.size(); ++i) + { + deallog << "Identity set #" << i << std::endl; + for (const auto &p : identities[i]) + { + deallog << " " << fe_collection[p.first].get_name() + << ": quad dof index " << p.second << std::endl; + } + } + + deallog << std::endl; +} + + + +int +main() +{ + initlog(); + deallog.get_file_stream().precision(2); + + test<2>(); + test<3>(); + + deallog << "OK" << std::endl; +} diff --git a/tests/hp/hp_quad_dof_identities_q_equidistant_multiway.output b/tests/hp/hp_quad_dof_identities_q_equidistant_multiway.output new file mode 100644 index 0000000000..f56508c494 --- /dev/null +++ b/tests/hp/hp_quad_dof_identities_q_equidistant_multiway.output @@ -0,0 +1,88 @@ + +DEAL::dim=2 +DEAL::Identity set #0 +DEAL:: FE_Q<2>(2): quad dof index 0 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 4 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): quad dof index 12 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 24 +DEAL::Identity set #1 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),3)): quad dof index 0 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): quad dof index 6 +DEAL::Identity set #2 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),3)): quad dof index 1 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): quad dof index 8 +DEAL::Identity set #3 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),3)): quad dof index 2 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): quad dof index 16 +DEAL::Identity set #4 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),3)): quad dof index 3 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),6)): quad dof index 18 +DEAL::Identity set #5 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 0 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 8 +DEAL::Identity set #6 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 1 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 10 +DEAL::Identity set #7 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 2 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 12 +DEAL::Identity set #8 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 3 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 22 +DEAL::Identity set #9 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 5 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 26 +DEAL::Identity set #10 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 6 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 36 +DEAL::Identity set #11 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 7 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 38 +DEAL::Identity set #12 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),4)): quad dof index 8 +DEAL:: FE_Q<2>(QIterated(QTrapezoid(),8)): quad dof index 40 +DEAL:: +DEAL::dim=3 +DEAL::Identity set #0 +DEAL:: FE_Q<3>(2): quad dof index 0 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 4 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): quad dof index 12 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 24 +DEAL::Identity set #1 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),3)): quad dof index 0 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): quad dof index 6 +DEAL::Identity set #2 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),3)): quad dof index 1 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): quad dof index 8 +DEAL::Identity set #3 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),3)): quad dof index 2 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): quad dof index 16 +DEAL::Identity set #4 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),3)): quad dof index 3 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),6)): quad dof index 18 +DEAL::Identity set #5 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 0 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 8 +DEAL::Identity set #6 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 1 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 10 +DEAL::Identity set #7 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 2 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 12 +DEAL::Identity set #8 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 3 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 22 +DEAL::Identity set #9 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 5 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 26 +DEAL::Identity set #10 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 6 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 36 +DEAL::Identity set #11 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 7 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 38 +DEAL::Identity set #12 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),4)): quad dof index 8 +DEAL:: FE_Q<3>(QIterated(QTrapezoid(),8)): quad dof index 40 +DEAL:: +DEAL::OK