From cecd2c67aace55a58a758963a42825f19f21849d Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 26 Mar 2017 17:44:07 +0200 Subject: [PATCH] Fix FE_ABF::convert_generalized_support_point_values_to_nodal_values --- source/fe/fe_abf.cc | 6 ++-- tests/fe/abf_03.cc | 80 ++++++++++++++++++++++++++++++++++++++++++ tests/fe/abf_03.output | 5 +++ 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 tests/fe/abf_03.cc create mode 100644 tests/fe/abf_03.output diff --git a/source/fe/fe_abf.cc b/source/fe/fe_abf.cc index 86d0b0b8ac..4ad9967d18 100644 --- a/source/fe/fe_abf.cc +++ b/source/fe/fe_abf.cc @@ -558,7 +558,7 @@ convert_generalized_support_point_values_to_nodal_values (const std::vector::DataSetDescriptor::face (face, false, false, false, n_face_points); for (unsigned int i=0; i::unit_normal_direction[face]]; + * support_point_values[face*n_face_points+fp][GeometryInfo::unit_normal_direction[face]]; } } @@ -632,7 +632,7 @@ FE_ABF::interpolate( unsigned int k = QProjector::DataSetDescriptor::face (face, false, false, false, n_face_points); for (unsigned int i=0; i::unit_normal_direction[face]+offset); + * values[face*n_face_points+fp](GeometryInfo::unit_normal_direction[face]+offset); } } @@ -694,7 +694,7 @@ FE_ABF::interpolate( unsigned int k = QProjector::DataSetDescriptor::face (face, false, false, false, n_face_points); for (unsigned int i=0; i::unit_normal_direction[face]][k + fp]; + * values[GeometryInfo::unit_normal_direction[face]][face*n_face_points+fp]; } } diff --git a/tests/fe/abf_03.cc b/tests/fe/abf_03.cc new file mode 100644 index 0000000000..a49feb04c0 --- /dev/null +++ b/tests/fe/abf_03.cc @@ -0,0 +1,80 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + + +// Check that convert_generalized_support_point_values_to_nodal_values +// gives the correct when asking for we the nodal values for a +// function in the FE_ABF + + + +template +void test (const unsigned int degree) +{ + FE_ABF fe(degree); + + std::vector dof_values (fe.dofs_per_cell); + for (unsigned int i=0; i > &generalized_support_points = fe.get_generalized_support_points(); + std::vector > real_values (generalized_support_points.size(), Vector(dim)); + + for (unsigned int i=0; i compare_values (fe.dofs_per_cell); + fe.convert_generalized_support_point_values_to_nodal_values(real_values, compare_values); + + for (unsigned int i=0; i std::abs(dof_values[i])*1.e-6) + { + deallog << i << ": " << dof_values[i] << " vs. " << compare_values[i] << std::endl; + AssertThrow(false, ExcInternalError()); + } + deallog << "OK" << std::endl; +} + +int main() +{ + initlog(); + + deallog.push("2d"); + deallog.push("0"); + test<2>(0); + deallog.pop(); + deallog.push("1"); + test<2>(1); + deallog.pop(); + deallog.push("2"); + test<2>(2); + deallog.pop(); + deallog.pop(); + + deallog.push("3d"); + deallog.push("0"); + test<3>(0); + deallog.pop(); + //deallog.push("1"); + //test<3>(1); + //deallog.pop(); + deallog.pop(); +} diff --git a/tests/fe/abf_03.output b/tests/fe/abf_03.output new file mode 100644 index 0000000000..b698ee2304 --- /dev/null +++ b/tests/fe/abf_03.output @@ -0,0 +1,5 @@ + +DEAL:2d:0::OK +DEAL:2d:1::OK +DEAL:2d:2::OK +DEAL:3d:0::OK -- 2.39.5