From: Martin Kronbichler Date: Mon, 6 Aug 2018 15:52:22 +0000 (+0200) Subject: Test case. X-Git-Tag: v9.1.0-rc1~841^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16d1f2c9edabf36ad0f17100577db8949672e3a8;p=dealii.git Test case. --- diff --git a/tests/matrix_free/inverse_mass_04.cc b/tests/matrix_free/inverse_mass_04.cc new file mode 100644 index 0000000000..4b1f0aa7a9 --- /dev/null +++ b/tests/matrix_free/inverse_mass_04.cc @@ -0,0 +1,109 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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. +// +// --------------------------------------------------------------------- + + + +// Tests CellwiseInverseMassMatrix::transform_from_q_points_to_basis + +#include + +#include + +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +#include "../tests.h" + + + +template +void +test() +{ + Triangulation tria; + GridGenerator::hyper_cube(tria, 0.2, 0.8); + + const unsigned int degree = fe_degree; + FE_DGQ fe(degree); + deallog << "Testing " << fe.get_name() << std::endl; + DoFHandler dof(tria); + dof.distribute_dofs(fe); + + Vector vec(dof.n_dofs()); + Functions::SquareFunction function; + VectorTools::interpolate(dof, function, vec); + + MatrixFree matrix_free; + AffineConstraints dummy; + typename MatrixFree::AdditionalData additional_data; + additional_data.mapping_update_flags |= update_quadrature_points; + matrix_free.reinit(dof, dummy, QGauss<1>(degree + 1), additional_data); + + FEEvaluation fe_eval(matrix_free); + FEEvaluation fe_eval_default(matrix_free); + MatrixFreeOperators::CellwiseInverseMassMatrix inverse_mass( + fe_eval); + + fe_eval.reinit(0); + fe_eval_default.reinit(0); + fe_eval_default.read_dof_values(vec); + for (unsigned int q = 0; q < fe_eval.n_q_points; ++q) + { + Point p; + for (unsigned int d = 0; d < dim; ++d) + p[d] = fe_eval.quadrature_point(q)[d][0]; + fe_eval.begin_values()[q] = function.value(p); + } + inverse_mass.transform_from_q_points_to_basis(1, + fe_eval.begin_values(), + fe_eval.begin_dof_values()); + for (unsigned int q = 0; q < fe_eval.dofs_per_cell; ++q) + deallog << "Value reference / actual: " + << fe_eval_default.begin_dof_values()[q][0] << " / " + << fe_eval.begin_dof_values()[q][0] << std::endl; + + deallog << std::endl; +} + + + +int +main() +{ + initlog(); + + deallog << std::setprecision(10); + + { + deallog.push("2d"); + test<2, 2>(); + test<2, 4>(); + deallog.pop(); + deallog.push("3d"); + test<3, 2>(); + test<3, 3>(); + deallog.pop(); + } +} diff --git a/tests/matrix_free/inverse_mass_04.output b/tests/matrix_free/inverse_mass_04.output new file mode 100644 index 0000000000..40be8c6189 --- /dev/null +++ b/tests/matrix_free/inverse_mass_04.output @@ -0,0 +1,134 @@ + +DEAL:2d::Testing FE_DGQ<2>(2) +DEAL:2d::Value reference / actual: 0.08000000000 / 0.08000000000 +DEAL:2d::Value reference / actual: 0.2900000000 / 0.2900000000 +DEAL:2d::Value reference / actual: 0.6800000000 / 0.6800000000 +DEAL:2d::Value reference / actual: 0.2900000000 / 0.2900000000 +DEAL:2d::Value reference / actual: 0.5000000000 / 0.5000000000 +DEAL:2d::Value reference / actual: 0.8900000000 / 0.8900000000 +DEAL:2d::Value reference / actual: 0.6800000000 / 0.6800000000 +DEAL:2d::Value reference / actual: 0.8900000000 / 0.8900000000 +DEAL:2d::Value reference / actual: 1.280000000 / 1.280000000 +DEAL:2d:: +DEAL:2d::Testing FE_DGQ<2>(4) +DEAL:2d::Value reference / actual: 0.08000000000 / 0.08000000000 +DEAL:2d::Value reference / actual: 0.1321753274 / 0.1321753274 +DEAL:2d::Value reference / actual: 0.2900000000 / 0.2900000000 +DEAL:2d::Value reference / actual: 0.5249675298 / 0.5249675298 +DEAL:2d::Value reference / actual: 0.6800000000 / 0.6800000000 +DEAL:2d::Value reference / actual: 0.1321753274 / 0.1321753274 +DEAL:2d::Value reference / actual: 0.1843506547 / 0.1843506547 +DEAL:2d::Value reference / actual: 0.3421753274 / 0.3421753274 +DEAL:2d::Value reference / actual: 0.5771428571 / 0.5771428571 +DEAL:2d::Value reference / actual: 0.7321753274 / 0.7321753274 +DEAL:2d::Value reference / actual: 0.2900000000 / 0.2900000000 +DEAL:2d::Value reference / actual: 0.3421753274 / 0.3421753274 +DEAL:2d::Value reference / actual: 0.5000000000 / 0.5000000000 +DEAL:2d::Value reference / actual: 0.7349675298 / 0.7349675298 +DEAL:2d::Value reference / actual: 0.8900000000 / 0.8900000000 +DEAL:2d::Value reference / actual: 0.5249675298 / 0.5249675298 +DEAL:2d::Value reference / actual: 0.5771428571 / 0.5771428571 +DEAL:2d::Value reference / actual: 0.7349675298 / 0.7349675298 +DEAL:2d::Value reference / actual: 0.9699350596 / 0.9699350596 +DEAL:2d::Value reference / actual: 1.124967530 / 1.124967530 +DEAL:2d::Value reference / actual: 0.6800000000 / 0.6800000000 +DEAL:2d::Value reference / actual: 0.7321753274 / 0.7321753274 +DEAL:2d::Value reference / actual: 0.8900000000 / 0.8900000000 +DEAL:2d::Value reference / actual: 1.124967530 / 1.124967530 +DEAL:2d::Value reference / actual: 1.280000000 / 1.280000000 +DEAL:2d:: +DEAL:3d::Testing FE_DGQ<3>(2) +DEAL:3d::Value reference / actual: 0.1200000000 / 0.1200000000 +DEAL:3d::Value reference / actual: 0.3300000000 / 0.3300000000 +DEAL:3d::Value reference / actual: 0.7200000000 / 0.7200000000 +DEAL:3d::Value reference / actual: 0.3300000000 / 0.3300000000 +DEAL:3d::Value reference / actual: 0.5400000000 / 0.5400000000 +DEAL:3d::Value reference / actual: 0.9300000000 / 0.9300000000 +DEAL:3d::Value reference / actual: 0.7200000000 / 0.7200000000 +DEAL:3d::Value reference / actual: 0.9300000000 / 0.9300000000 +DEAL:3d::Value reference / actual: 1.320000000 / 1.320000000 +DEAL:3d::Value reference / actual: 0.3300000000 / 0.3300000000 +DEAL:3d::Value reference / actual: 0.5400000000 / 0.5400000000 +DEAL:3d::Value reference / actual: 0.9300000000 / 0.9300000000 +DEAL:3d::Value reference / actual: 0.5400000000 / 0.5400000000 +DEAL:3d::Value reference / actual: 0.7500000000 / 0.7500000000 +DEAL:3d::Value reference / actual: 1.140000000 / 1.140000000 +DEAL:3d::Value reference / actual: 0.9300000000 / 0.9300000000 +DEAL:3d::Value reference / actual: 1.140000000 / 1.140000000 +DEAL:3d::Value reference / actual: 1.530000000 / 1.530000000 +DEAL:3d::Value reference / actual: 0.7200000000 / 0.7200000000 +DEAL:3d::Value reference / actual: 0.9300000000 / 0.9300000000 +DEAL:3d::Value reference / actual: 1.320000000 / 1.320000000 +DEAL:3d::Value reference / actual: 0.9300000000 / 0.9300000000 +DEAL:3d::Value reference / actual: 1.140000000 / 1.140000000 +DEAL:3d::Value reference / actual: 1.530000000 / 1.530000000 +DEAL:3d::Value reference / actual: 1.320000000 / 1.320000000 +DEAL:3d::Value reference / actual: 1.530000000 / 1.530000000 +DEAL:3d::Value reference / actual: 1.920000000 / 1.920000000 +DEAL:3d:: +DEAL:3d::Testing FE_DGQ<3>(3) +DEAL:3d::Value reference / actual: 0.1200000000 / 0.1200000000 +DEAL:3d::Value reference / actual: 0.2138359214 / 0.2138359214 +DEAL:3d::Value reference / actual: 0.4821640786 / 0.4821640786 +DEAL:3d::Value reference / actual: 0.7200000000 / 0.7200000000 +DEAL:3d::Value reference / actual: 0.2138359214 / 0.2138359214 +DEAL:3d::Value reference / actual: 0.3076718427 / 0.3076718427 +DEAL:3d::Value reference / actual: 0.5760000000 / 0.5760000000 +DEAL:3d::Value reference / actual: 0.8138359214 / 0.8138359214 +DEAL:3d::Value reference / actual: 0.4821640786 / 0.4821640786 +DEAL:3d::Value reference / actual: 0.5760000000 / 0.5760000000 +DEAL:3d::Value reference / actual: 0.8443281573 / 0.8443281573 +DEAL:3d::Value reference / actual: 1.082164079 / 1.082164079 +DEAL:3d::Value reference / actual: 0.7200000000 / 0.7200000000 +DEAL:3d::Value reference / actual: 0.8138359214 / 0.8138359214 +DEAL:3d::Value reference / actual: 1.082164079 / 1.082164079 +DEAL:3d::Value reference / actual: 1.320000000 / 1.320000000 +DEAL:3d::Value reference / actual: 0.2138359214 / 0.2138359214 +DEAL:3d::Value reference / actual: 0.3076718427 / 0.3076718427 +DEAL:3d::Value reference / actual: 0.5760000000 / 0.5760000000 +DEAL:3d::Value reference / actual: 0.8138359214 / 0.8138359214 +DEAL:3d::Value reference / actual: 0.3076718427 / 0.3076718427 +DEAL:3d::Value reference / actual: 0.4015077641 / 0.4015077641 +DEAL:3d::Value reference / actual: 0.6698359214 / 0.6698359214 +DEAL:3d::Value reference / actual: 0.9076718427 / 0.9076718427 +DEAL:3d::Value reference / actual: 0.5760000000 / 0.5760000000 +DEAL:3d::Value reference / actual: 0.6698359214 / 0.6698359214 +DEAL:3d::Value reference / actual: 0.9381640786 / 0.9381640786 +DEAL:3d::Value reference / actual: 1.176000000 / 1.176000000 +DEAL:3d::Value reference / actual: 0.8138359214 / 0.8138359214 +DEAL:3d::Value reference / actual: 0.9076718427 / 0.9076718427 +DEAL:3d::Value reference / actual: 1.176000000 / 1.176000000 +DEAL:3d::Value reference / actual: 1.413835921 / 1.413835921 +DEAL:3d::Value reference / actual: 0.4821640786 / 0.4821640786 +DEAL:3d::Value reference / actual: 0.5760000000 / 0.5760000000 +DEAL:3d::Value reference / actual: 0.8443281573 / 0.8443281573 +DEAL:3d::Value reference / actual: 1.082164079 / 1.082164079 +DEAL:3d::Value reference / actual: 0.5760000000 / 0.5760000000 +DEAL:3d::Value reference / actual: 0.6698359214 / 0.6698359214 +DEAL:3d::Value reference / actual: 0.9381640786 / 0.9381640786 +DEAL:3d::Value reference / actual: 1.176000000 / 1.176000000 +DEAL:3d::Value reference / actual: 0.8443281573 / 0.8443281573 +DEAL:3d::Value reference / actual: 0.9381640786 / 0.9381640786 +DEAL:3d::Value reference / actual: 1.206492236 / 1.206492236 +DEAL:3d::Value reference / actual: 1.444328157 / 1.444328157 +DEAL:3d::Value reference / actual: 1.082164079 / 1.082164079 +DEAL:3d::Value reference / actual: 1.176000000 / 1.176000000 +DEAL:3d::Value reference / actual: 1.444328157 / 1.444328157 +DEAL:3d::Value reference / actual: 1.682164079 / 1.682164079 +DEAL:3d::Value reference / actual: 0.7200000000 / 0.7200000000 +DEAL:3d::Value reference / actual: 0.8138359214 / 0.8138359214 +DEAL:3d::Value reference / actual: 1.082164079 / 1.082164079 +DEAL:3d::Value reference / actual: 1.320000000 / 1.320000000 +DEAL:3d::Value reference / actual: 0.8138359214 / 0.8138359214 +DEAL:3d::Value reference / actual: 0.9076718427 / 0.9076718427 +DEAL:3d::Value reference / actual: 1.176000000 / 1.176000000 +DEAL:3d::Value reference / actual: 1.413835921 / 1.413835921 +DEAL:3d::Value reference / actual: 1.082164079 / 1.082164079 +DEAL:3d::Value reference / actual: 1.176000000 / 1.176000000 +DEAL:3d::Value reference / actual: 1.444328157 / 1.444328157 +DEAL:3d::Value reference / actual: 1.682164079 / 1.682164079 +DEAL:3d::Value reference / actual: 1.320000000 / 1.320000000 +DEAL:3d::Value reference / actual: 1.413835921 / 1.413835921 +DEAL:3d::Value reference / actual: 1.682164079 / 1.682164079 +DEAL:3d::Value reference / actual: 1.920000000 / 1.920000000 +DEAL:3d::