]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 4 Sep 2017 23:33:32 +0000 (01:33 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 11 Sep 2017 16:21:07 +0000 (18:21 +0200)
tests/fe/interpolate_system_3.cc [new file with mode: 0644]
tests/fe/interpolate_system_3.output [new file with mode: 0644]
tests/fe/system_03.cc [new file with mode: 0644]
tests/fe/system_03.output [new file with mode: 0644]

diff --git a/tests/fe/interpolate_system_3.cc b/tests/fe/interpolate_system_3.cc
new file mode 100644 (file)
index 0000000..bb72f8d
--- /dev/null
@@ -0,0 +1,58 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 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 "interpolate_common.h"
+#include <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/fe/fe_nedelec.h>
+#include <deal.II/fe/fe_raviart_thomas.h>
+#include <deal.II/fe/fe_system.h>
+
+
+// Same as interpolate_system_2.cc but using the new constructor:
+// Check convert_generalized_support_point_values_to_dof_values for systems
+// of non-Lagrangian elements.
+//
+
+template <int dim, typename T>
+void check(T function, const unsigned int degree)
+{
+  FESystem<dim> fe = {FE_RaviartThomas<dim>(degree)^2,
+                      FESystem<dim>(FE_RaviartThomas<dim>(degree), 2)^1
+                     };
+  deallog << fe.get_name() << std::endl;
+
+  std::vector<double> dofs(fe.dofs_per_cell);
+
+  std::vector<Vector<double>> values(fe.get_generalized_support_points().size(),
+                                     Vector<double>(4 * dim));
+  function.vector_value_list(fe.get_generalized_support_points(), values);
+
+  fe.convert_generalized_support_point_values_to_dof_values(values, dofs);
+  deallog << " vector " << vector_difference(fe, dofs, function, 0) << std::endl;
+}
+
+int main()
+{
+  initlog();
+
+  check<2>(Q1WedgeFunction<2, 1, 4 * 2>(), 1);
+  check<2>(Q1WedgeFunction<2, 2, 4 * 2>(), 2);
+  check<2>(Q1WedgeFunction<2, 3, 4 * 2>(), 3);
+  check<3>(Q1WedgeFunction<3, 1, 4 * 3>(), 1);
+  check<3>(Q1WedgeFunction<3, 2, 4 * 3>(), 2);
+  check<3>(Q1WedgeFunction<3, 3, 4 * 3>(), 3);
+}
diff --git a/tests/fe/interpolate_system_3.output b/tests/fe/interpolate_system_3.output
new file mode 100644 (file)
index 0000000..27edc81
--- /dev/null
@@ -0,0 +1,13 @@
+
+DEAL::FESystem<2>[FE_RaviartThomas<2>(1)^2-FESystem<2>[FE_RaviartThomas<2>(1)^2]]
+DEAL:: vector 1.66533e-16
+DEAL::FESystem<2>[FE_RaviartThomas<2>(2)^2-FESystem<2>[FE_RaviartThomas<2>(2)^2]]
+DEAL:: vector 2.39392e-16
+DEAL::FESystem<2>[FE_RaviartThomas<2>(3)^2-FESystem<2>[FE_RaviartThomas<2>(3)^2]]
+DEAL:: vector 1.87784e-16
+DEAL::FESystem<3>[FE_RaviartThomas<3>(1)^2-FESystem<3>[FE_RaviartThomas<3>(1)^2]]
+DEAL:: vector 1.59595e-16
+DEAL::FESystem<3>[FE_RaviartThomas<3>(2)^2-FESystem<3>[FE_RaviartThomas<3>(2)^2]]
+DEAL:: vector 5.22585e-16
+DEAL::FESystem<3>[FE_RaviartThomas<3>(3)^2-FESystem<3>[FE_RaviartThomas<3>(3)^2]]
+DEAL:: vector 3.52637e-16
diff --git a/tests/fe/system_03.cc b/tests/fe/system_03.cc
new file mode 100644 (file)
index 0000000..68833dd
--- /dev/null
@@ -0,0 +1,66 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2003 - 2015 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 the same as system_02 but using the variadic constructor:
+// check what happens with an FE_System if we hand it 0 components
+
+#include "../tests.h"
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/fe/fe_dgp.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_tools.h>
+
+#include <string>
+
+template <int dim>
+void
+check(FESystem<dim> &fe)
+{
+  deallog << fe.get_name() << std::endl;
+  deallog << "components: " << fe.n_components() << std::endl;
+  deallog << "blocks: " << fe.n_blocks() << std::endl;
+  deallog << "conforms H1: " << fe.conforms(FiniteElementData<dim>::H1) << std::endl;
+  deallog << "n_base_elements: " << fe.n_base_elements() << std::endl;
+}
+
+int
+main()
+{
+  initlog();
+
+  {
+    FESystem<2> fe = {FE_Q<2>(1)^2, FE_Q<2>(1)^1};
+    check<2>(fe);
+  }
+  {
+    FESystem<2> fe = {FE_Q<2>(1)^2, FE_DGQ<2>(2)^0, FE_Q<2>(1)^1};
+    check<2>(fe);
+  }
+  {
+    FESystem<2> fe = {FESystem<2>(FE_Q<2>(1)^2)^1, FE_Q<2>(1)^1};
+    check<2>(fe);
+  }
+  {
+    FESystem<2> fe = {FESystem<2>(FE_Q<2>(1)^2)^1, FE_DGQ<2>(2)^0, FE_Q<2>(1)^1};
+    check<2>(fe);
+  }
+
+  return 0;
+}
+
+
+
diff --git a/tests/fe/system_03.output b/tests/fe/system_03.output
new file mode 100644 (file)
index 0000000..bad0cea
--- /dev/null
@@ -0,0 +1,21 @@
+
+DEAL::FESystem<2>[FE_Q<2>(1)^2-FE_Q<2>(1)]
+DEAL::components: 3
+DEAL::blocks: 3
+DEAL::conforms H1: 1
+DEAL::n_base_elements: 2
+DEAL::FESystem<2>[FE_Q<2>(1)^2-FE_Q<2>(1)]
+DEAL::components: 3
+DEAL::blocks: 3
+DEAL::conforms H1: 1
+DEAL::n_base_elements: 2
+DEAL::FESystem<2>[FESystem<2>[FE_Q<2>(1)^2]-FE_Q<2>(1)]
+DEAL::components: 3
+DEAL::blocks: 2
+DEAL::conforms H1: 1
+DEAL::n_base_elements: 2
+DEAL::FESystem<2>[FESystem<2>[FE_Q<2>(1)^2]-FE_Q<2>(1)]
+DEAL::components: 3
+DEAL::blocks: 2
+DEAL::conforms H1: 1
+DEAL::n_base_elements: 2

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.