From cd0dba7e8b6e2648da190073496b53432e822704 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 6 Jul 2017 10:49:25 -0600 Subject: [PATCH] Run some operations in parallel. --- source/dofs/dof_handler_policy.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 7e6bb2fa3f..88acf722ce 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -1044,12 +1044,30 @@ namespace internal unify_dof_indices (hp::DoFHandler &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 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 -- 2.39.5