From: Wolfgang Bangerth Date: Wed, 5 Apr 2017 21:45:27 +0000 (-0600) Subject: Implement FE::convert_generalized_support_point_values_to_nodal_values for FESystem. X-Git-Tag: v9.0.0-rc1~1733^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4187%2Fhead;p=dealii.git Implement FE::convert_generalized_support_point_values_to_nodal_values for FESystem. --- diff --git a/doc/news/changes/minor/20170405Bangerth-2 b/doc/news/changes/minor/20170405Bangerth-2 new file mode 100644 index 0000000000..68f53321c7 --- /dev/null +++ b/doc/news/changes/minor/20170405Bangerth-2 @@ -0,0 +1,6 @@ +New: The class FESystem now implements +the +FiniteElement::convert_generalized_support_point_values_to_nodal_values() +interface. +
+(Wolfgang Bangerth, 2017/04/05) diff --git a/include/deal.II/fe/fe_system.h b/include/deal.II/fe/fe_system.h index 2b8f9b515f..4fd5c8e6bd 100644 --- a/include/deal.II/fe/fe_system.h +++ b/include/deal.II/fe/fe_system.h @@ -840,6 +840,18 @@ public: compare_for_face_domination (const FiniteElement &fe_other) const; //@} + /** + * Implementation of the + * FiniteElement::convert_generalized_support_point_values_to_nodal_values() + * function. The current function simply takes the input argument apart, + * passes the pieces to the base elements, and then re-assembles everything + * into the output argument. + */ + 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. diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index f88f90ffa4..1bf683f0fb 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -2200,6 +2200,73 @@ FESystem::get_constant_modes () const +template +void +FESystem:: +convert_generalized_support_point_values_to_nodal_values (const std::vector > &support_point_values, + std::vector &nodal_values) const +{ + // we currently only support the case where each base element has exactly + // as many generalized support points as there are dofs in that element. + // + // in the more general case, if there are more generalized support + // points than dofs, we don't have the infrastructure at the time of + // writing this to tease apart which support point value + // belongs to which element + AssertDimension (support_point_values.size(), this->dofs_per_cell); + AssertDimension (nodal_values.size(), this->dofs_per_cell); + + // loop over the bases and let them do the work on their + // share of the input argument + std::vector> base_support_point_values; + std::vector base_nodal_values; + unsigned int current_vector_component = 0; + for (unsigned int base=0; baseelement_multiplicity(base); + for (unsigned int m=0; + mdofs_per_cell; ++i) + if (this->system_to_base_index(i).first == std::make_pair(base,m)) + { + const unsigned int base_n_components = base_element(base).n_components(); + base_support_point_values[this->system_to_base_index(i).second] + .reinit (base_n_components, false); + for (unsigned int c=0; csystem_to_base_index(i).second][c] + = support_point_values[i][current_vector_component+c]; + } + + // then call the base element to get its version of the + // nodal values + base_nodal_values.resize (base_element(base).dofs_per_cell); + base_element(base).convert_generalized_support_point_values_to_nodal_values + (base_support_point_values, base_nodal_values); + + // finally put these nodal values back into global nodal + // values vector. use the same reverse loop as above + for (unsigned int i=0; idofs_per_cell; ++i) + if (this->system_to_base_index(i).first == std::make_pair(base,m)) + nodal_values[i] = base_nodal_values[this->system_to_base_index(i).second]; + } + } +} + + + template std::size_t FESystem::memory_consumption () const