]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Call Mapping::get_data() and FE::get_Data() in parallel.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 19 Aug 2015 18:58:32 +0000 (13:58 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 19 Aug 2015 18:58:32 +0000 (13:58 -0500)
These two function calls are both (potentially) expensive but
independent. Run them in parallel.

source/fe/fe_values.cc

index 8fd7bbf61346b7bab17ecea259578f41d671ec80..b944dfffec5500adfc2abc31c114ccafee72cd13 100644 (file)
@@ -3401,12 +3401,16 @@ FEValues<dim,spacedim>::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<typename Mapping<dim,spacedim>::InternalDataBase *>
+  mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::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<dim,spacedim>::initialize(this->n_quadrature_points, flags);
@@ -3630,12 +3634,16 @@ FEFaceValues<dim,spacedim>::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<typename Mapping<dim,spacedim>::InternalDataBase *>
+  mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::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<dim,spacedim>::initialize(this->n_quadrature_points, flags);
@@ -3775,14 +3783,19 @@ FESubfaceValues<dim,spacedim>::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<typename Mapping<dim,spacedim>::InternalDataBase *>
+  mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::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<dim,spacedim>::initialize(this->n_quadrature_points, flags);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.