From 9d5488fb845e28a14a851d5d1cc667b75cc7dd00 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 3 Mar 2020 14:52:34 +0100 Subject: [PATCH] Add test case --- tests/matrix_free/matrix_vector_faces_27.cc | 54 +++++++++++++++++++ .../matrix_free/matrix_vector_faces_27.output | 13 +++++ .../matrix_free/matrix_vector_faces_common.h | 5 ++ 3 files changed, 72 insertions(+) create mode 100644 tests/matrix_free/matrix_vector_faces_27.cc create mode 100644 tests/matrix_free/matrix_vector_faces_27.output diff --git a/tests/matrix_free/matrix_vector_faces_27.cc b/tests/matrix_free/matrix_vector_faces_27.cc new file mode 100644 index 0000000000..360eea7b74 --- /dev/null +++ b/tests/matrix_free/matrix_vector_faces_27.cc @@ -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 + +#include + +#include + +#include "../tests.h" + +std::ofstream logfile("output"); + +#include "matrix_vector_faces_common.h" + +template +void +test() +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.begin()->face(0)->set_boundary_id(1); + tria.refine_global(5 - dim); + + FE_Q fe(fe_degree); + DoFHandler dof(tria); + dof.distribute_dofs(fe); + AffineConstraints constraints; + VectorTools::interpolate_boundary_values(dof, + 0, + Functions::ZeroFunction(), + constraints); + constraints.close(); + + do_test(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 index 0000000000..52f68efa16 --- /dev/null +++ b/tests/matrix_free/matrix_vector_faces_27.output @@ -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:: diff --git a/tests/matrix_free/matrix_vector_faces_common.h b/tests/matrix_free/matrix_vector_faces_common.h index 1d93b0a7c2..b2e8e1334d 100644 --- a/tests/matrix_free/matrix_vector_faces_common.h +++ b/tests/matrix_free/matrix_vector_faces_common.h @@ -815,6 +815,11 @@ do_test(const DoFHandler & 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 mf_data; const QGauss<1> quad(n_q_points_1d > 0 ? n_q_points_1d : dof.get_fe().degree + 1); -- 2.39.5