Skip to content

Commit 4b0b03a

Browse files
[arcane,materials] Utilise 'CopyBetweenPartialAndGlobalArgs' pour initiliser les nouvelles mailles constituants avec la valeur globale.
Cela permet de faire l'opération avec un seul noyau de calcul.
1 parent cf2ab2b commit 4b0b03a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Diff for: arcane/src/arcane/materials/IncrementalComponentModifier.cc

+15-10
Original file line numberDiff line numberDiff line change
@@ -355,19 +355,24 @@ _addItemsToIndexer(MeshMaterialVariableIndexer* var_indexer,
355355
IMeshMaterialMng* mm = m_material_mng;
356356
bool init_with_zero = mm->isDataInitialisationWithZero();
357357

358-
// TODO: Comme tout est indépendant par variable, on pourrait
359-
// éventuellement utiliser plusieurs files.
360358
Accelerator::ProfileRegion ps(m_queue, "InitializeNewItems", 0xFFFF00);
361-
RunQueue::ScopedAsync sc(&m_queue);
362359

363-
auto func = [&](IMeshMaterialVariable* mv) {
364-
if (init_with_zero)
360+
if (init_with_zero) {
361+
RunQueue::ScopedAsync sc(&m_queue);
362+
auto func_zero = [&](IMeshMaterialVariable* mv) {
365363
mv->_internalApi()->initializeNewItemsWithZero(list_builder, m_queue);
366-
else
367-
mv->_internalApi()->initializeNewItemsWithPureValues(list_builder, m_queue);
368-
};
369-
functor::apply(mm, &IMeshMaterialMng::visitVariables, func);
370-
m_queue.barrier();
364+
};
365+
functor::apply(mm, &IMeshMaterialMng::visitVariables, func_zero);
366+
m_queue.barrier();
367+
}
368+
else {
369+
SmallSpan<Int32> partial_indexes = list_builder.partialIndexes();
370+
SmallSpan<Int32> partial_local_ids = list_builder.partialLocalIds();
371+
372+
CopyBetweenPartialAndGlobalArgs args(var_indexer->index(), partial_local_ids,
373+
partial_indexes, true, true, m_queue);
374+
_copyBetweenPartialsAndGlobals(args);
375+
}
371376
}
372377
}
373378

0 commit comments

Comments
 (0)