From: Wolfgang Bangerth Date: Sun, 9 Aug 2015 18:10:30 +0000 (-0500) Subject: Do initialization early. X-Git-Tag: v8.4.0-rc2~639^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1315%2Fhead;p=dealii.git Do initialization early. Previously, FESystem delayed initializing the base element's data objects until we first visited fill_fe_values(). Do this earlier: when the base element's data objects are first created. This involves a change in the update flags being used. I think that there is some confusion about update flags anyway, since we should always be using update_each. The change made here passes the testsuite, so I believe it is correct. It is likely also easier to understand than what the old code did. --- diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index cebb901600..c9d60cfda3 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -841,9 +841,17 @@ FESystem::get_data (const UpdateFlags flags_, // the base elements and store them for (unsigned int base_no=0; base_non_base_elements(); ++base_no) { + // create internal objects for base elements and initialize their + // respective output objects typename FiniteElement::InternalDataBase *base_fe_data = base_element(base_no).get_data(sub_flags, mapping, quadrature); + internal::FEValues::FiniteElementRelatedData &base_fe_output_object + = data->get_fe_output_object(base_no); + base_fe_output_object.initialize (quadrature.size(), base_element(base_no), + flags | base_fe_data->update_flags); + + // then store the pointer to the base internal object data->set_fe_data(base_no, base_fe_data); // make sure that *we* compute @@ -886,9 +894,17 @@ FESystem::get_face_data ( for (unsigned int base_no=0; base_non_base_elements(); ++base_no) { + // create internal objects for base elements and initialize their + // respective output objects typename FiniteElement::InternalDataBase *base_fe_data = base_element(base_no).get_face_data(sub_flags, mapping, quadrature); + internal::FEValues::FiniteElementRelatedData &base_fe_output_object + = data->get_fe_output_object(base_no); + base_fe_output_object.initialize (quadrature.size(), base_element(base_no), + flags | base_fe_data->update_flags); + + // then store the pointer to the base internal object data->set_fe_data(base_no, base_fe_data); Assert (!(base_fe_data->update_each & update_hessians), @@ -930,9 +946,17 @@ FESystem::get_subface_data ( for (unsigned int base_no=0; base_non_base_elements(); ++base_no) { + // create internal objects for base elements and initialize their + // respective output objects typename FiniteElement::InternalDataBase *base_fe_data = base_element(base_no).get_subface_data(sub_flags, mapping, quadrature); + internal::FEValues::FiniteElementRelatedData &base_fe_output_object + = data->get_fe_output_object(base_no); + base_fe_output_object.initialize (quadrature.size(), base_element(base_no), + flags | base_fe_data->update_flags); + + // then store the pointer to the base internal object data->set_fe_data(base_no, base_fe_data); Assert (!(base_fe_data->update_each & update_hessians), @@ -1182,26 +1206,6 @@ compute_fill (const Mapping &mapping, if (flags & (update_values | update_gradients)) { - if (fe_data.is_first_cell()) - { - // Initialize the internal FE objects for the base elements - for (unsigned int base_no=0; base_non_base_elements(); ++base_no) - { - // Pointer needed to get the update flags of the base element - typename FiniteElement::InternalDataBase & - base_fe_data = fe_data.get_fe_data(base_no); - - // compute update flags ... - const UpdateFlags base_update_flags - = mapping_internal.update_flags | base_fe_data.update_flags; - - // Initialize the output objects for the base elements. - internal::FEValues::FiniteElementRelatedData &base_data=fe_data.get_fe_output_object(base_no); - const FiniteElement &base_fe=base_element(base_no); - base_data.initialize (n_q_points, base_fe, base_update_flags); - } - } - // let base elements update the necessary data Threads::TaskGroup<> task_group; for (unsigned int base_no=0; base_non_base_elements(); ++base_no)