From: Wolfgang Bangerth Date: Tue, 24 Nov 2015 00:08:58 +0000 (-0600) Subject: Revert order of loops and if statements. X-Git-Tag: v8.4.0-rc2~203^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1902%2Fhead;p=dealii.git Revert order of loops and if statements. This is in analogy to what was already done in #1821. --- diff --git a/source/fe/fe_poly.cc b/source/fe/fe_poly.cc index 583c23a5fc..8af7c2b330 100644 --- a/source/fe/fe_poly.cc +++ b/source/fe/fe_poly.cc @@ -47,40 +47,42 @@ fill_fe_values (const Triangulation<1,2>::cell_iterator &, Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); - for (unsigned int k=0; kdofs_per_cell; ++k) + // transform gradients and higher derivatives. there is nothing to do + // for values since we already emplaced them into output_data when + // we were in get_data() + if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_gradients[k], + mapping_covariant, + mapping_internal, + output_data.shape_gradients[k]); + + if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { - // transform gradients and higher derivatives. there is nothing to do - // for values since we already emplaced them into output_data when - // we were in get_data() - if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) - mapping.transform (fe_data.shape_gradients[k], - mapping_covariant, + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_hessians[k], + mapping_covariant_gradient, mapping_internal, - output_data.shape_gradients[k]); - - if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) - { - mapping.transform (fe_data.shape_hessians[k], - mapping_covariant_gradient, - mapping_internal, - output_data.shape_hessians[k]); - - for (unsigned int i=0; idofs_per_cell; ++k) + for (unsigned int i=0; idofs_per_cell; ++k) + mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping_covariant_hessian, + mapping_internal, + output_data.shape_3rd_derivatives[k]); + + for (unsigned int k=0; kdofs_per_cell; ++k) + correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); } } @@ -104,40 +106,42 @@ fill_fe_values (const Triangulation<2,3>::cell_iterator &, Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); - for (unsigned int k=0; kdofs_per_cell; ++k) + // transform gradients and higher derivatives. there is nothing to do + // for values since we already emplaced them into output_data when + // we were in get_data() + if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_gradients[k], + mapping_covariant, + mapping_internal, + output_data.shape_gradients[k]); + + if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { - // transform gradients and higher derivatives. there is nothing to do - // for values since we already emplaced them into output_data when - // we were in get_data() - if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) - mapping.transform (fe_data.shape_gradients[k], - mapping_covariant, + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_hessians[k], + mapping_covariant_gradient, mapping_internal, - output_data.shape_gradients[k]); - - if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) - { - mapping.transform (fe_data.shape_hessians[k], - mapping_covariant_gradient, - mapping_internal, - output_data.shape_hessians[k]); - - for (unsigned int i=0; idofs_per_cell; ++k) + for (unsigned int i=0; idofs_per_cell; ++k) + mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping_covariant_hessian, + mapping_internal, + output_data.shape_3rd_derivatives[k]); + + for (unsigned int k=0; kdofs_per_cell; ++k) + correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); } } @@ -162,40 +166,42 @@ fill_fe_values (const Triangulation<1,2>::cell_iterator &, Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); - for (unsigned int k=0; kdofs_per_cell; ++k) + // transform gradients and higher derivatives. there is nothing to do + // for values since we already emplaced them into output_data when + // we were in get_data() + if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_gradients[k], + mapping_covariant, + mapping_internal, + output_data.shape_gradients[k]); + + if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { - // transform gradients and higher derivatives. there is nothing to do - // for values since we already emplaced them into output_data when - // we were in get_data() - if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) - mapping.transform (fe_data.shape_gradients[k], - mapping_covariant, + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_hessians[k], + mapping_covariant_gradient, mapping_internal, - output_data.shape_gradients[k]); - - if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) - { - mapping.transform (fe_data.shape_hessians[k], - mapping_covariant_gradient, - mapping_internal, - output_data.shape_hessians[k]); - - for (unsigned int i=0; idofs_per_cell; ++k) + for (unsigned int i=0; idofs_per_cell; ++k) + mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping_covariant_hessian, + mapping_internal, + output_data.shape_3rd_derivatives[k]); + + for (unsigned int k=0; kdofs_per_cell; ++k) + correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); } } @@ -215,40 +221,42 @@ fill_fe_values (const Triangulation<2,3>::cell_iterator &, Assert (dynamic_cast (&fe_internal) != 0, ExcInternalError()); const InternalData &fe_data = static_cast (fe_internal); - for (unsigned int k=0; kdofs_per_cell; ++k) + // transform gradients and higher derivatives. there is nothing to do + // for values since we already emplaced them into output_data when + // we were in get_data() + if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_gradients[k], + mapping_covariant, + mapping_internal, + output_data.shape_gradients[k]); + + if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { - // transform gradients and higher derivatives. there is nothing to do - // for values since we already emplaced them into output_data when - // we were in get_data() - if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) - mapping.transform (fe_data.shape_gradients[k], - mapping_covariant, + for (unsigned int k=0; kdofs_per_cell; ++k) + mapping.transform (fe_data.shape_hessians[k], + mapping_covariant_gradient, mapping_internal, - output_data.shape_gradients[k]); - - if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) - { - mapping.transform (fe_data.shape_hessians[k], - mapping_covariant_gradient, - mapping_internal, - output_data.shape_hessians[k]); - - for (unsigned int i=0; idofs_per_cell; ++k) + for (unsigned int i=0; idofs_per_cell; ++k) + mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping_covariant_hessian, + mapping_internal, + output_data.shape_3rd_derivatives[k]); + + for (unsigned int k=0; kdofs_per_cell; ++k) + correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); } }