From 623155e10863954e32ea6546745170b062491c50 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 5 Apr 2017 10:38:11 -0600 Subject: [PATCH] Implement FE::convert_generalized_support_point_values_to_nodal_values() for FE_Q, FE_DGQ, FE_DGQArbitraryNodes. --- doc/news/changes/minor/20170405Bangerth | 6 ++++ include/deal.II/fe/fe_dgq.h | 24 +++++++++++++ include/deal.II/fe/fe_q.h | 14 +++++++- include/deal.II/fe/fe_q_base.h | 2 +- source/fe/fe_dgq.cc | 48 +++++++++++++++++++++++++ source/fe/fe_q.cc | 26 +++++++++++++- 6 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 doc/news/changes/minor/20170405Bangerth diff --git a/doc/news/changes/minor/20170405Bangerth b/doc/news/changes/minor/20170405Bangerth new file mode 100644 index 0000000000..d9c9c347fd --- /dev/null +++ b/doc/news/changes/minor/20170405Bangerth @@ -0,0 +1,6 @@ +New: The classes FE_Q, FE_DGQ, and FE_DGQArbitraryNodes now implement +the +FiniteElement::convert_generalized_support_point_values_to_nodal_values() +interface. +
+(Wolfgang Bangerth, 2017/04/05) diff --git a/include/deal.II/fe/fe_dgq.h b/include/deal.II/fe/fe_dgq.h index 1c04563d41..693cc52bca 100644 --- a/include/deal.II/fe/fe_dgq.h +++ b/include/deal.II/fe/fe_dgq.h @@ -300,6 +300,18 @@ public: virtual std::pair, std::vector > get_constant_modes () const; + /** + * Implementation of the corresponding function in the FiniteElement + * class. Since the current element is interpolatory, the nodal + * values are exactly the support point values. Furthermore, since + * the current element is scalar, the support point values need to + * be vectors of length 1. + */ + virtual + void + convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const; + /** * Determine an estimate for the memory consumption (in bytes) of this * object. @@ -409,6 +421,18 @@ public: */ virtual std::string get_name () const; + /** + * Implementation of the corresponding function in the FiniteElement + * class. Since the current element is interpolatory, the nodal + * values are exactly the support point values. Furthermore, since + * the current element is scalar, the support point values need to + * be vectors of length 1. + */ + virtual + void + convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const; + protected: /** * @p clone function instead of a copy constructor. diff --git a/include/deal.II/fe/fe_q.h b/include/deal.II/fe/fe_q.h index a19aa9bf4e..7c08e61e45 100644 --- a/include/deal.II/fe/fe_q.h +++ b/include/deal.II/fe/fe_q.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2000 - 2016 by the deal.II authors +// Copyright (C) 2000 - 2017 by the deal.II authors // // This file is part of the deal.II library. // @@ -586,6 +586,18 @@ public: */ virtual std::string get_name () const; + /** + * Implementation of the corresponding function in the FiniteElement + * class. Since the current element is interpolatory, the nodal + * values are exactly the support point values. Furthermore, since + * the current element is scalar, the support point values need to + * be vectors of length 1. + */ + virtual + void + convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const; + protected: /** diff --git a/include/deal.II/fe/fe_q_base.h b/include/deal.II/fe/fe_q_base.h index 2a39e81e90..4b9e35e82e 100644 --- a/include/deal.II/fe/fe_q_base.h +++ b/include/deal.II/fe/fe_q_base.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2000 - 2016 by the deal.II authors +// Copyright (C) 2000 - 2017 by the deal.II authors // // This file is part of the deal.II library. // diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index af344ba3fb..bc9159982d 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -102,6 +103,29 @@ FE_DGQ::get_name () const +template +void +FE_DGQ:: +convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const +{ + AssertDimension (support_point_values.size(), + this->get_unit_support_points().size()); + AssertDimension (support_point_values.size(), + nodal_values.size()); + AssertDimension (this->dofs_per_cell, + nodal_values.size()); + + for (unsigned int i=0; idofs_per_cell; ++i) + { + AssertDimension (support_point_values[i].size(), 1); + + nodal_values[i] = support_point_values[i](0); + } +} + + + template FiniteElement * FE_DGQ::clone() const @@ -759,6 +783,30 @@ FE_DGQArbitraryNodes::get_name () const +template +void +FE_DGQArbitraryNodes:: +convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const +{ + AssertDimension (support_point_values.size(), + this->get_unit_support_points().size()); + AssertDimension (support_point_values.size(), + nodal_values.size()); + AssertDimension (this->dofs_per_cell, + nodal_values.size()); + + for (unsigned int i=0; idofs_per_cell; ++i) + { + AssertDimension (support_point_values[i].size(), 1); + + nodal_values[i] = support_point_values[i](0); + } +} + + + + template FiniteElement * FE_DGQArbitraryNodes::clone() const diff --git a/source/fe/fe_q.cc b/source/fe/fe_q.cc index af64fe48c6..f0e272f4a4 100644 --- a/source/fe/fe_q.cc +++ b/source/fe/fe_q.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2000 - 2016 by the deal.II authors +// Copyright (C) 2000 - 2017 by the deal.II authors // // This file is part of the deal.II library. // @@ -15,6 +15,7 @@ #include +#include #include #include @@ -132,6 +133,29 @@ FE_Q::get_name () const +template +void +FE_Q:: +convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const +{ + AssertDimension (support_point_values.size(), + this->get_unit_support_points().size()); + AssertDimension (support_point_values.size(), + nodal_values.size()); + AssertDimension (this->dofs_per_cell, + nodal_values.size()); + + for (unsigned int i=0; idofs_per_cell; ++i) + { + AssertDimension (support_point_values[i].size(), 1); + + nodal_values[i] = support_point_values[i](0); + } +} + + + template FiniteElement * FE_Q::clone() const -- 2.39.5