]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test case
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 3 Mar 2020 13:52:34 +0000 (14:52 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 3 Mar 2020 13:52:34 +0000 (14:52 +0100)
tests/matrix_free/matrix_vector_faces_27.cc [new file with mode: 0644]
tests/matrix_free/matrix_vector_faces_27.output [new file with mode: 0644]
tests/matrix_free/matrix_vector_faces_common.h

diff --git a/tests/matrix_free/matrix_vector_faces_27.cc b/tests/matrix_free/matrix_vector_faces_27.cc
new file mode 100644 (file)
index 0000000..360eea7
--- /dev/null
@@ -0,0 +1,54 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Matrix-free face evaluation with continuous elements. Same test as
+// matrix_vector_faces_05 but also using Dirichlet constraints on a part of
+// the boundary.
+
+#include <deal.II/base/function.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/numerics/vector_tools.h>
+
+#include "../tests.h"
+
+std::ofstream logfile("output");
+
+#include "matrix_vector_faces_common.h"
+
+template <int dim, int fe_degree>
+void
+test()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_cube(tria);
+  tria.begin()->face(0)->set_boundary_id(1);
+  tria.refine_global(5 - dim);
+
+  FE_Q<dim>       fe(fe_degree);
+  DoFHandler<dim> dof(tria);
+  dof.distribute_dofs(fe);
+  AffineConstraints<double> constraints;
+  VectorTools::interpolate_boundary_values(dof,
+                                           0,
+                                           Functions::ZeroFunction<dim>(),
+                                           constraints);
+  constraints.close();
+
+  do_test<dim, fe_degree, fe_degree + 1, double>(dof, constraints, false);
+}
diff --git a/tests/matrix_free/matrix_vector_faces_27.output b/tests/matrix_free/matrix_vector_faces_27.output
new file mode 100644 (file)
index 0000000..52f68ef
--- /dev/null
@@ -0,0 +1,13 @@
+
+DEAL:2d::Testing FE_Q<2>(1)
+DEAL:2d::Norm of difference:          0
+DEAL:2d::
+DEAL:2d::Testing FE_Q<2>(2)
+DEAL:2d::Norm of difference:          0
+DEAL:2d::
+DEAL:3d::Testing FE_Q<3>(1)
+DEAL:3d::Norm of difference:          0
+DEAL:3d::
+DEAL:3d::Testing FE_Q<3>(2)
+DEAL:3d::Norm of difference:          0
+DEAL:3d::
index 1d93b0a7c2bc2dfc4d5cc6c77f162a0f8e6abc13..b2e8e1334dfa5a5df01874c1e5b0b31525f08511 100644 (file)
@@ -815,6 +815,11 @@ do_test(const DoFHandler<dim> &          dof,
 
   matrix.vmult(out, in);
 
+  // zero constrained dofs
+  for (unsigned int i = 0; i < dof.n_dofs(); ++i)
+    if (constraints.is_constrained(i))
+      out(i) = 0;
+
   MatrixFree<dim, number, VectorizedArrayType> mf_data;
   const QGauss<1> quad(n_q_points_1d > 0 ? n_q_points_1d :
                                            dof.get_fe().degree + 1);

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.