From 46e0b42f7a56fa02e7c8cf46bc138304c4eba4b6 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 16 Feb 2017 13:43:15 +0100 Subject: [PATCH] Add test case for large polynomial degree --- .../matrix_free/matrix_vector_large_degree.cc | 96 +++++++++++++++++++ .../matrix_vector_large_degree.output | 11 +++ 2 files changed, 107 insertions(+) create mode 100644 tests/matrix_free/matrix_vector_large_degree.cc create mode 100644 tests/matrix_free/matrix_vector_large_degree.output diff --git a/tests/matrix_free/matrix_vector_large_degree.cc b/tests/matrix_free/matrix_vector_large_degree.cc new file mode 100644 index 0000000000..b327043175 --- /dev/null +++ b/tests/matrix_free/matrix_vector_large_degree.cc @@ -0,0 +1,96 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + + +// test that FEEvaluation can correctly handle large polynomial degrees of 20 +// in 3D. The old implementation of FEEvaluation that allocated all data +// needed by the kernel on the stack ran into stack overflows in that case +// since degree 20 needs around 3.5 MB of data. Since we cannot compare with +// matrix-based results in this case, this test simply checks that the +// matrix-vector product runs without error + +#include "../tests.h" + +std::ofstream logfile("output"); + +#include "matrix_vector_mf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube (tria); + tria.refine_global(1); + + FE_Q fe (fe_degree); + DoFHandler dof (tria); + dof.distribute_dofs(fe); + ConstraintMatrix constraints; + constraints.close(); + + deallog << "Testing " << dof.get_fe().get_name() << std::endl; + + MatrixFree mf_data; + { + const QGauss<1> quad (fe_degree+2); + typename MatrixFree::AdditionalData data; + data.tasks_parallel_scheme = MatrixFree::AdditionalData::none; + mf_data.reinit (dof, constraints, quad, data); + } + + MatrixFreeTest,fe_degree+2> mf (mf_data); + Vector in (dof.n_dofs()), out (dof.n_dofs()); + + for (unsigned int i=0; i(); + test<2,15>(); + test<2,35>(); + deallog.pop(); + deallog.push("3d"); + test<3,10>(); + test<3,20>(); + deallog.pop(); + } +} diff --git a/tests/matrix_free/matrix_vector_large_degree.output b/tests/matrix_free/matrix_vector_large_degree.output new file mode 100644 index 0000000000..dc5e78dc50 --- /dev/null +++ b/tests/matrix_free/matrix_vector_large_degree.output @@ -0,0 +1,11 @@ + +DEAL:2d::Testing FE_Q<2>(5) +DEAL:2d::Result norm: 1.14444 +DEAL:2d::Testing FE_Q<2>(15) +DEAL:2d::Result norm: 0.399128 +DEAL:2d::Testing FE_Q<2>(35) +DEAL:2d::Result norm: 0.173861 +DEAL:3d::Testing FE_Q<3>(10) +DEAL:3d::Result norm: 0.143708 +DEAL:3d::Testing FE_Q<3>(20) +DEAL:3d::Result norm: 0.0523289 -- 2.39.5