]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Run some operations in parallel.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 6 Jul 2017 16:49:25 +0000 (10:49 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 6 Jul 2017 18:43:31 +0000 (12:43 -0600)
source/dofs/dof_handler_policy.cc

index 7e6bb2fa3f3ba843fb015138fe3347b0a644352e..88acf722ced505a0bf932ad2b1320598bcd5428f 100644 (file)
@@ -1044,12 +1044,30 @@ namespace internal
         unify_dof_indices (hp::DoFHandler<dim,spacedim> &dof_handler,
                            const unsigned int            n_dofs_before_identification)
         {
+          // compute the constraints that correspond to unifying
+          // dof indices on vertices, lines, and quads. do so
+          // in parallel
           std::map<types::global_dof_index, types::global_dof_index>
           constrained_vertex_indices, constrained_line_indices, constrained_quad_indices;
 
-          constrained_vertex_indices = compute_vertex_dof_identities (dof_handler);
-          constrained_line_indices = compute_line_dof_identities (dof_handler);
-          constrained_quad_indices = compute_quad_dof_identities (dof_handler);
+          {
+            Threads::TaskGroup<> tasks;
+
+            tasks += Threads::new_task ([&]()
+            {
+              constrained_vertex_indices = compute_vertex_dof_identities (dof_handler);
+            });
+            tasks += Threads::new_task ([&]()
+            {
+              constrained_line_indices = compute_line_dof_identities (dof_handler);
+            });
+            tasks += Threads::new_task ([&]()
+            {
+              constrained_quad_indices = compute_quad_dof_identities (dof_handler);
+            });
+
+            tasks.join_all ();
+          }
 
           // create a vector that contains the new DoF indices; first preset the
           // ones that are identities as determined above, then enumerate the rest

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.