From 615731133405cc5c7edc22085c4eaf3af62e328f Mon Sep 17 00:00:00 2001 From: Jonathan Robey Date: Tue, 30 Aug 2016 15:00:10 -0700 Subject: [PATCH] Set conditions on updating mapping data --- include/deal.II/fe/fe_update_flags.h | 26 ++++++++++++++++++++++- source/fe/fe_values.cc | 31 +++++++++++++++++----------- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/include/deal.II/fe/fe_update_flags.h b/include/deal.II/fe/fe_update_flags.h index eaa7e27ef8..5477216581 100644 --- a/include/deal.II/fe/fe_update_flags.h +++ b/include/deal.II/fe/fe_update_flags.h @@ -207,7 +207,31 @@ enum UpdateFlags /** * Combination of the flags needed for Piola transform of Hdiv elements. */ - update_piola = update_volume_elements | update_contravariant_transformation + update_piola = update_volume_elements | update_contravariant_transformation, + /** + * Combination of the flags that require a mapping calculation + */ + update_mapping = + // Direct data + update_quadrature_points | + update_JxW_values | + update_jacobians | + update_jacobian_grads | + update_jacobian_pushed_forward_grads | + update_jacobian_2nd_derivatives | + update_jacobian_pushed_forward_2nd_derivatives | + update_jacobian_3rd_derivatives | + update_jacobian_pushed_forward_3rd_derivatives | + update_inverse_jacobians | + update_boundary_forms | + update_normal_vectors | + // Transformation dependence + update_covariant_transformation | + update_contravariant_transformation | + update_transformation_values | + update_transformation_gradients | + // Volume data + update_volume_elements }; diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 5274b76bf9..7ddb230907 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -3653,7 +3653,8 @@ FEValues::initialize (const UpdateFlags update_flags) const UpdateFlags flags = this->compute_update_flags (update_flags); // initialize the base classes - this->mapping_output.initialize(this->n_quadrature_points, flags); + if (flags & update_mapping) + this->mapping_output.initialize(this->n_quadrature_points, flags); this->finite_element_output.initialize(this->n_quadrature_points, *this->fe, flags); // then get objects into which the FE and the Mapping can store @@ -3666,16 +3667,19 @@ FEValues::initialize (const UpdateFlags update_flags) quadrature, this->finite_element_output); Threads::Task::InternalDataBase *> - mapping_get_data = Threads::new_task (&Mapping::get_data, - *this->mapping, - flags, - quadrature); + mapping_get_data; + if (flags & update_mapping) + mapping_get_data = Threads::new_task (&Mapping::get_data, + *this->mapping, + flags, + quadrature); this->update_flags = flags; // then collect answers from the two task above this->fe_data.reset (fe_get_data.return_value()); - this->mapping_data.reset (mapping_get_data.return_value()); + if (flags & update_mapping) + this->mapping_data.reset (mapping_get_data.return_value()); } @@ -3772,12 +3776,15 @@ void FEValues::do_reinit () // specific to the mapping. also let it inspect the // cell similarity flag and, if necessary, update // it - this->cell_similarity - = this->get_mapping().fill_fe_values(*this->present_cell, - this->cell_similarity, - quadrature, - *this->mapping_data, - this->mapping_output); + if (this->update_flags & update_mapping) + { + this->cell_similarity + = this->get_mapping().fill_fe_values(*this->present_cell, + this->cell_similarity, + quadrature, + *this->mapping_data, + this->mapping_output); + } // then call the finite element and, with the data // already filled by the mapping, let it compute the -- 2.39.5