]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add more tests. 12690/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 24 Aug 2021 20:02:18 +0000 (14:02 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 24 Aug 2021 20:40:45 +0000 (14:40 -0600)
tests/hp/hp_line_dof_identities_q_equidistant_multiway.cc [new file with mode: 0644]
tests/hp/hp_line_dof_identities_q_equidistant_multiway.output [new file with mode: 0644]
tests/hp/hp_quad_dof_identities_q_equidistant_multiway.cc [new file with mode: 0644]
tests/hp/hp_quad_dof_identities_q_equidistant_multiway.output [new file with mode: 0644]

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 (file)
index 0000000..10bca71
--- /dev/null
@@ -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 <deal.II/fe/fe_q.h>
+
+#include <deal.II/hp/fe_collection.h>
+
+#include "../tests.h"
+
+
+
+template <int dim>
+void
+test()
+{
+  deallog << "dim=" << dim << std::endl;
+
+  hp::FECollection<dim> fe_collection;
+  for (unsigned int i = 1; i <= 8; ++i)
+    {
+      const double dx = 1. / i;
+
+      std::vector<Point<1>> 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<dim>(q_equidistant));
+    }
+
+  // construct the complete set of fe indices
+  std::set<unsigned int> 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 (file)
index 0000000..a1870b1
--- /dev/null
@@ -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 (file)
index 0000000..4a0f25d
--- /dev/null
@@ -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 <deal.II/fe/fe_q.h>
+
+#include <deal.II/hp/fe_collection.h>
+
+#include "../tests.h"
+
+
+
+template <int dim>
+void
+test()
+{
+  deallog << "dim=" << dim << std::endl;
+
+  hp::FECollection<dim> fe_collection;
+  for (unsigned int i = 1; i <= 8; ++i)
+    {
+      const double dx = 1. / i;
+
+      std::vector<Point<1>> 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<dim>(q_equidistant));
+    }
+
+  // construct the complete set of fe indices
+  std::set<unsigned int> 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 (file)
index 0000000..f56508c
--- /dev/null
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.