From 8930f60a6e19060fe79b4d80cd61854a996f44c0 Mon Sep 17 00:00:00 2001 From: Maximilian Bergbauer Date: Fri, 28 Apr 2023 13:28:57 +0200 Subject: [PATCH] Fix bug in integrate_add_tensor_product_value_and_gradient_linear() --- .../matrix_free/tensor_product_kernels.h | 4 +- tests/matrix_free/point_evaluation_22.cc | 1 + tests/matrix_free/point_evaluation_22.output | 49 ++++++++++++++++--- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/include/deal.II/matrix_free/tensor_product_kernels.h b/include/deal.II/matrix_free/tensor_product_kernels.h index 1c13afb9bf..29af641639 100644 --- a/include/deal.II/matrix_free/tensor_product_kernels.h +++ b/include/deal.II/matrix_free/tensor_product_kernels.h @@ -3613,8 +3613,8 @@ namespace internal { const auto x0 = 1. - p[0], x1 = p[0]; - values[0] = value * x0 - gradient[0]; - values[1] = value * x1 + gradient[0]; + values[0] += value * x0 - gradient[0]; + values[1] += value * x1 + gradient[0]; } else if (dim == 2) { diff --git a/tests/matrix_free/point_evaluation_22.cc b/tests/matrix_free/point_evaluation_22.cc index 816e7c16ce..bf4480a202 100644 --- a/tests/matrix_free/point_evaluation_22.cc +++ b/tests/matrix_free/point_evaluation_22.cc @@ -164,6 +164,7 @@ main() initlog(); deallog << std::setprecision(10); + test<1>(1); test<1>(3); test<2>(1); test<2>(2); diff --git a/tests/matrix_free/point_evaluation_22.output b/tests/matrix_free/point_evaluation_22.output index 605e73e5c5..2cf39e2ec5 100644 --- a/tests/matrix_free/point_evaluation_22.output +++ b/tests/matrix_free/point_evaluation_22.output @@ -1,20 +1,53 @@ -DEAL::Mapping of degree 3 +DEAL::Mapping of degree 1 DEAL::Cell with center 0.2500000000 -DEAL::0.000000000: 0.000000000 error value 0.000000000 error grad 4.440892099e-16 +DEAL::0.000000000: 0.000000000 error value 0.000000000 error grad 0.000000000 DEAL::0.02941176471: 0.02941176471 error value 0.000000000 error grad 0.000000000 -DEAL::0.05882352941: 0.05882352941 error value -6.938893904e-18 error grad 2.220446049e-16 +DEAL::0.05882352941: 0.05882352941 error value 0.000000000 error grad 0.000000000 DEAL::0.08823529412: 0.08823529412 error value 0.000000000 error grad 0.000000000 -DEAL::0.1176470588: 0.1176470588 error value 1.387778781e-17 error grad 2.220446049e-16 -DEAL::0.1470588235: 0.1470588235 error value 2.775557562e-17 error grad 3.330669074e-16 +DEAL::0.1176470588: 0.1176470588 error value 0.000000000 error grad 0.000000000 +DEAL::0.1470588235: 0.1470588235 error value 0.000000000 error grad 0.000000000 DEAL::0.1764705882: 0.1764705882 error value 0.000000000 error grad 0.000000000 -DEAL::0.2058823529: 0.2058823529 error value -2.775557562e-17 error grad 1.110223025e-16 -DEAL::0.2352941176: 0.2352941176 error value 0.000000000 error grad 1.110223025e-16 -DEAL::0.2647058824: 0.2647058824 error value 0.000000000 error grad 2.220446049e-16 +DEAL::0.2058823529: 0.2058823529 error value 0.000000000 error grad 0.000000000 +DEAL::0.2352941176: 0.2352941176 error value 0.000000000 error grad 0.000000000 +DEAL::0.2647058824: 0.2647058824 error value 0.000000000 error grad 0.000000000 DEAL::0.2941176471: 0.2941176471 error value 0.000000000 error grad 0.000000000 DEAL::0.3235294118: 0.3235294118 error value 0.000000000 error grad 0.000000000 DEAL::0.3529411765: 0.3529411765 error value 0.000000000 error grad 0.000000000 DEAL:: +DEAL::-24.83044983 27.12456747 +DEAL::Cell with center 0.7500000000 +DEAL::0.5000000000: 0.5000000000 error value 0.000000000 error grad 0.000000000 +DEAL::0.5294117647: 0.5294117647 error value 0.000000000 error grad 0.000000000 +DEAL::0.5588235294: 0.5588235294 error value 0.000000000 error grad 0.000000000 +DEAL::0.5882352941: 0.5882352941 error value 0.000000000 error grad 0.000000000 +DEAL::0.6176470588: 0.6176470588 error value 0.000000000 error grad 0.000000000 +DEAL::0.6470588235: 0.6470588235 error value 0.000000000 error grad 0.000000000 +DEAL::0.6764705882: 0.6764705882 error value 0.000000000 error grad 0.000000000 +DEAL::0.7058823529: 0.7058823529 error value 0.000000000 error grad 0.000000000 +DEAL::0.7352941176: 0.7352941176 error value 0.000000000 error grad 0.000000000 +DEAL::0.7647058824: 0.7647058824 error value 0.000000000 error grad 0.000000000 +DEAL::0.7941176471: 0.7941176471 error value 0.000000000 error grad 0.000000000 +DEAL::0.8235294118: 0.8235294118 error value 0.000000000 error grad 0.000000000 +DEAL::0.8529411765: 0.8529411765 error value 0.000000000 error grad 0.000000000 +DEAL:: +DEAL::-20.62456747 29.41868512 +DEAL::Mapping of degree 3 +DEAL::Cell with center 0.2500000000 +DEAL::0.000000000: 0.000000000 error value 0.000000000 error grad 0.000000000 +DEAL::0.02941176471: 0.02941176471 error value 0.000000000 error grad 0.000000000 +DEAL::0.05882352941: 0.05882352941 error value -1.387778781e-17 error grad 0.000000000 +DEAL::0.08823529412: 0.08823529412 error value 0.000000000 error grad 2.220446049e-16 +DEAL::0.1176470588: 0.1176470588 error value 1.387778781e-17 error grad 2.220446049e-16 +DEAL::0.1470588235: 0.1470588235 error value 0.000000000 error grad 0.000000000 +DEAL::0.1764705882: 0.1764705882 error value 0.000000000 error grad 2.220446049e-16 +DEAL::0.2058823529: 0.2058823529 error value 0.000000000 error grad 2.220446049e-16 +DEAL::0.2352941176: 0.2352941176 error value 2.775557562e-17 error grad 0.000000000 +DEAL::0.2647058824: 0.2647058824 error value 0.000000000 error grad 2.220446049e-16 +DEAL::0.2941176471: 0.2941176471 error value 0.000000000 error grad 0.000000000 +DEAL::0.3235294118: 0.3235294118 error value 0.000000000 error grad 2.220446049e-16 +DEAL::0.3529411765: 0.3529411765 error value -5.551115123e-17 error grad 2.220446049e-16 +DEAL:: DEAL::-40.02339531 1.555249578 8.779994658 31.98226872 DEAL::Cell with center 0.7500000000 DEAL::0.5000000000: 0.5000000000 error value 0.000000000 error grad 5.551115123e-16 -- 2.39.5