From 91da582f196212773bdd9de90636f7aabf5ce616 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 6 Apr 2017 10:46:33 -0600 Subject: [PATCH] Use lambdas to make some code simpler. --- source/fe/fe_system.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index 17b6d44a1e..c5ee6e9090 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -1468,27 +1468,27 @@ void FESystem::initialize (const std::vector0) this->base_to_block_indices.push_back( multiplicities[i] ); - std::vector*> > clone_base_elements; - - for (unsigned int i=0; i0) - clone_base_elements.push_back (Threads::new_task (&FiniteElement::clone, - *fes[i])); + { + Threads::TaskGroup<> clone_base_elements; - unsigned int ind=0; - for (unsigned int i=0; i0) { - base_elements[ind] = - std::make_pair (std::shared_ptr > - (clone_base_elements[ind].return_value()), - multiplicities[i]); + clone_base_elements += Threads::new_task ([ &,i,ind] () + { + base_elements[ind] + = std::make_pair (std::shared_ptr>(fes[i]->clone()), + multiplicities[i]); + }); ++ind; } - } + Assert(ind>0, ExcInternalError()); + + // wait for all of these clone operations to finish + clone_base_elements.join_all(); + } - Assert(ind>0, ExcInternalError()); { // If the system is not primitive, these have not been initialized by -- 2.39.5