]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do the computations in parallel. 9986/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 28 Apr 2020 18:39:55 +0000 (12:39 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 30 Apr 2020 14:33:28 +0000 (08:33 -0600)
source/hp/fe_values.cc

index 04291740bbe7c42fc5c40abd857628277e04e72d..ec227e87b0f7128c30c2ea090a4a8e33feca7177 100644 (file)
@@ -80,6 +80,7 @@ namespace hp
     // We've already resized the `fe_values_table` correctly above, but right
     // now it just contains nullptrs. Create copies of the objects that
     // `other.fe_values_table` stores
+    Threads::TaskGroup<> task_group;
     for (unsigned int fe_index = 0; fe_index < fe_collection->size();
          ++fe_index)
       for (unsigned int m_index = 0; m_index < mapping_collection->size();
@@ -87,12 +88,16 @@ namespace hp
         for (unsigned int q_index = 0; q_index < q_collection.size(); ++q_index)
           if (other.fe_values_table[fe_index][m_index][q_index].get() !=
               nullptr)
-            fe_values_table[fe_index][m_index][q_index] =
-              std_cxx14::make_unique<FEValuesType>(
-                (*mapping_collection)[m_index],
-                (*fe_collection)[fe_index],
-                q_collection[q_index],
-                update_flags);
+            task_group += Threads::new_task([&, fe_index, m_index, q_index]() {
+              fe_values_table[fe_index][m_index][q_index] =
+                std_cxx14::make_unique<FEValuesType>(
+                  (*mapping_collection)[m_index],
+                  (*fe_collection)[fe_index],
+                  q_collection[q_index],
+                  update_flags);
+            });
+
+    task_group.join_all();
   }
 
 

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.