From 93c5b9308b446237d5fdc70571bf84d2847b9a5b Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 19 Aug 2015 13:58:32 -0500 Subject: [PATCH] Call Mapping::get_data() and FE::get_Data() in parallel. These two function calls are both (potentially) expensive but independent. Run them in parallel. --- source/fe/fe_values.cc | 43 +++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 8fd7bbf613..b944dfffec 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -3401,12 +3401,16 @@ FEValues::initialize (const UpdateFlags update_flags) const UpdateFlags flags = this->compute_update_flags (update_flags); - // then get objects into which the - // FE and the Mapping can store - // intermediate data used across - // calls to reinit - this->mapping_data.reset (this->mapping->get_data(flags, quadrature)); + // then get objects into which the FE and the Mapping can store + // intermediate data used across calls to reinit. we can do this in parallel + Threads::Task::InternalDataBase *> + mapping_get_data = Threads::new_task (&Mapping::get_data, + *this->mapping, + flags, + quadrature); + this->fe_data.reset (this->fe->get_data(flags, *this->mapping, quadrature)); + this->mapping_data.reset (mapping_get_data.return_value()); // initialize the base classes internal::FEValues::MappingRelatedData::initialize(this->n_quadrature_points, flags); @@ -3630,12 +3634,16 @@ FEFaceValues::initialize (const UpdateFlags update_flags) { const UpdateFlags flags = this->compute_update_flags (update_flags); - // then get objects into which the - // FE and the Mapping can store - // intermediate data used across - // calls to reinit - this->mapping_data.reset (this->mapping->get_face_data(flags, this->quadrature)); + // then get objects into which the FE and the Mapping can store + // intermediate data used across calls to reinit. this can be done in parallel + Threads::Task::InternalDataBase *> + mapping_get_data = Threads::new_task (&Mapping::get_face_data, + *this->mapping, + flags, + this->quadrature); + this->fe_data.reset (this->fe->get_face_data(flags, *this->mapping, this->quadrature)); + this->mapping_data.reset (mapping_get_data.return_value()); // initialize the base classes internal::FEValues::MappingRelatedData::initialize(this->n_quadrature_points, flags); @@ -3775,14 +3783,19 @@ FESubfaceValues::initialize (const UpdateFlags update_flags) { const UpdateFlags flags = this->compute_update_flags (update_flags); - // then get objects into which the - // FE and the Mapping can store - // intermediate data used across - // calls to reinit - this->mapping_data.reset (this->mapping->get_subface_data(flags, this->quadrature)); + // then get objects into which the FE and the Mapping can store + // intermediate data used across calls to reinit. this can be done + // in parallel + Threads::Task::InternalDataBase *> + mapping_get_data = Threads::new_task (&Mapping::get_subface_data, + *this->mapping, + flags, + this->quadrature); + this->fe_data.reset (this->fe->get_subface_data(flags, *this->mapping, this->quadrature)); + this->mapping_data.reset (mapping_get_data.return_value()); // initialize the base classes internal::FEValues::MappingRelatedData::initialize(this->n_quadrature_points, flags); -- 2.39.5