Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
RunCommandMaterialEnumerate.h
Go to the documentation of this file.
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* RunCommandMaterialEnumerate.h (C) 2000-2026 */
9/* */
10/* Enumerating a loop over a list of constituents. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ACCELERATOR_RUNCOMMANDMATERIALENUMERATE_H
13#define ARCANE_ACCELERATOR_RUNCOMMANDMATERIALENUMERATE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18#include "arcane/core/materials/ComponentItemVectorView.h"
19#include "arcane/core/materials/MaterialsCoreGlobal.h"
20#include "arcane/core/materials/MatItem.h"
22#include "arcane/core/materials/ConstituentItemIndexedSelectionView.h"
23
24#include "arcane/accelerator/KernelLauncher.h"
25#include "arcane/accelerator/RunCommand.h"
26#include "arcane/accelerator/RunCommandLaunchInfo.h"
27
28#include "arccore/common/HostKernelRemainingArgsHelper.h"
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
34{
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
45template <typename ConstituentItemLocalIdType_>
46class ConstituentAndGlobalCellIteratorValue
47{
48 public:
49
50 using ConstituentItemLocalIdType = ConstituentItemLocalIdType_;
51 using ComponentItemLocalId = Arcane::Materials::ComponentItemLocalId;
52 using MatVarIndex = Arcane::Materials::MatVarIndex;
53
54 public:
55
57 struct Data
58 {
59 public:
60
61 constexpr ARCCORE_HOST_DEVICE Data(ConstituentItemLocalIdType mvi, CellLocalId cid)
62 : m_mvi(mvi)
63 , m_cid(cid)
64 {}
65
66 public:
67
68 ConstituentItemLocalIdType m_mvi;
69 CellLocalId m_cid;
70 };
71
72 public:
73
74 constexpr ARCCORE_HOST_DEVICE ConstituentAndGlobalCellIteratorValue(ConstituentItemLocalIdType mvi, CellLocalId cid, Int32 index)
75 : m_internal_data{ mvi, cid }
76 , m_index(index)
77 {
78 }
79
98 constexpr ARCCORE_HOST_DEVICE Data operator()()
99 {
100 return m_internal_data;
101 }
102
104 constexpr ARCCORE_HOST_DEVICE ConstituentItemLocalIdType varIndex() const { return m_internal_data.m_mvi; };
105
107 constexpr ARCCORE_HOST_DEVICE CellLocalId globalCellId() const { return m_internal_data.m_cid; }
108
110 constexpr ARCCORE_HOST_DEVICE Int32 index() const { return m_index; }
111
112 private:
113
114 Data m_internal_data;
115 Int32 m_index = -1;
116};
117
120
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
126
127} // namespace Arcane::Materials
128
129/*---------------------------------------------------------------------------*/
130/*---------------------------------------------------------------------------*/
131
132namespace Arcane::Accelerator::Impl
133{
134
135/*---------------------------------------------------------------------------*/
136/*---------------------------------------------------------------------------*/
137
141template <typename ContainerType_>
142class ConstituentRunCommandBase2
143{
144 public:
145
146 using ContainerType = ContainerType_;
147 using ThatClass = ConstituentRunCommandBase2<ContainerType_>;
148 using CommandType = ThatClass;
149
150 public:
151
152 static CommandType create(RunCommand& run_command, const ContainerType& items)
153 {
154 return CommandType(run_command, items);
155 }
156
157 private:
158
159 // Only callable from 'Container'
160 explicit ConstituentRunCommandBase2(RunCommand& command, const ContainerType& items)
161 : m_command(command)
162 , m_items(items)
163 {
164 }
165
166 public:
167
168 RunCommand& m_command;
169 ContainerType m_items;
170};
171
172/*---------------------------------------------------------------------------*/
173/*---------------------------------------------------------------------------*/
174
178class AllEnvCellRunCommandContainer
179{
180 public:
181
182 using ThatClass = AllEnvCellRunCommandContainer;
183 using AllEnvCellVectorView = Arcane::Materials::AllEnvCellVectorView;
184 using ContainerCreateViewType = AllEnvCellVectorView;
185 using IteratorValueType = Arcane::Materials::AllEnvCell;
186 using CommandType = ConstituentRunCommandBase2<ThatClass>;
187
188 public:
189
190 explicit AllEnvCellRunCommandContainer(ContainerCreateViewType view)
191 : m_view(view)
192 {
193 }
194
195 public:
196
197 constexpr ARCCORE_HOST_DEVICE Int32 size() const { return m_view.size(); }
198
200 ARCCORE_HOST_DEVICE IteratorValueType operator[](Int32 i) const
201 {
202 return m_view[i];
203 }
204
205 private:
206
208};
209
210/*---------------------------------------------------------------------------*/
211/*---------------------------------------------------------------------------*/
212
217class ConstituentCommandContainerBase
218{
219 protected:
220
221 using ComponentItemVectorView = Arcane::Materials::ComponentItemVectorView;
222 using ComponentItemLocalId = Arcane::Materials::ComponentItemLocalId;
223 using MatVarIndex = Arcane::Materials::MatVarIndex;
224
225 protected:
226
227 explicit ConstituentCommandContainerBase(ComponentItemVectorView view)
228 : m_items(view)
229 {
230 m_nb_item = m_items.nbItem();
231 m_matvar_indexes = m_items._matvarIndexes();
232 m_global_cells_local_id = m_items._internalLocalIds();
233 }
234
235 public:
236
237 constexpr ARCCORE_HOST_DEVICE Int32 size() const { return m_nb_item; }
238
239 protected:
240
241 ComponentItemVectorView m_items;
242 SmallSpan<const MatVarIndex> m_matvar_indexes;
243 SmallSpan<const Int32> m_global_cells_local_id;
244 Int32 m_nb_item = 0;
245};
246
247/*---------------------------------------------------------------------------*/
248/*---------------------------------------------------------------------------*/
249
254template <typename ConstituentItemLocalIdType_, typename ContainerCreateViewType_>
255class ConstituentRunCommandContainer
256: public ConstituentCommandContainerBase
257{
258 public:
259
260 using ThatClass = ConstituentRunCommandContainer;
261 using IteratorValueType = ConstituentItemLocalIdType_;
262 using CommandType = ConstituentRunCommandBase2<ThatClass>;
263 using ContainerCreateViewType = ContainerCreateViewType_;
264
265 public:
266
267 explicit ConstituentRunCommandContainer(ContainerCreateViewType view)
269 {
270 }
271
272 public:
273
275 constexpr ARCCORE_HOST_DEVICE IteratorValueType operator[](Int32 i) const
276 {
277 return { ComponentItemLocalId(m_matvar_indexes[i]) };
278 }
279};
280
281using EnvCellRunCommandContainer = ConstituentRunCommandContainer<Arcane::Materials::EnvItemLocalId, Arcane::Materials::EnvCellVectorView>;
282using MatCellRunCommandContainer = ConstituentRunCommandContainer<Arcane::Materials::MatItemLocalId, Arcane::Materials::MatCellVectorView>;
283
284/*---------------------------------------------------------------------------*/
285/*---------------------------------------------------------------------------*/
286
291template <typename ConstituentItemLocalIdType_, typename ContainerCreateViewType_>
292class ConstituentAndGlobalCellRunCommandContainer
293: public ConstituentCommandContainerBase
294{
295 public:
296
297 using ThatClass = ConstituentAndGlobalCellRunCommandContainer;
299 using CommandType = ConstituentRunCommandBase2<ThatClass>;
300 using ContainerCreateViewType = ContainerCreateViewType_;
301
302 public:
303
304 explicit ConstituentAndGlobalCellRunCommandContainer(ContainerCreateViewType_ view)
305 : ConstituentCommandContainerBase(view)
306 {
307 }
308
309 public:
310
312 constexpr ARCCORE_HOST_DEVICE IteratorValueType operator[](Int32 i) const
313 {
314 return { ComponentItemLocalId(m_matvar_indexes[i]), CellLocalId(m_global_cells_local_id[i]), i };
315 }
316};
317
318/*---------------------------------------------------------------------------*/
319/*---------------------------------------------------------------------------*/
320
321using EnvAndGlobalCellRunCommandContainer = ConstituentAndGlobalCellRunCommandContainer<Arcane::Materials::EnvItemLocalId, Arcane::Materials::EnvCellVectorView>;
322using MatAndGlobalCellRunCommandContainer = ConstituentAndGlobalCellRunCommandContainer<Arcane::Materials::MatItemLocalId, Arcane::Materials::MatCellVectorView>;
323
324/*---------------------------------------------------------------------------*/
325/*---------------------------------------------------------------------------*/
326
331template <typename ConstituentItemLocalIdType_, typename ContainerCreateViewType_>
332class ConstituentIndexedSelectionRunCommandContainer
333{
334 public:
335
336 using ThatClass = ConstituentIndexedSelectionRunCommandContainer;
337 using IteratorValueType = ConstituentItemLocalIdType_;
338 using CommandType = ConstituentRunCommandBase2<ThatClass>;
339 using ContainerCreateViewType = ContainerCreateViewType_;
340
341 public:
342
343 explicit ConstituentIndexedSelectionRunCommandContainer(ContainerCreateViewType view)
344 : m_view(view)
345 {
346 }
347
348 public:
349
351 constexpr ARCCORE_HOST_DEVICE IteratorValueType operator[](Int32 i) const
352 {
353 return { ComponentItemLocalId(m_view[i]) };
354 }
355
356 ARCCORE_HOST_DEVICE Int32 size() { return m_view.size(); }
357
358 private:
359
360 ContainerCreateViewType m_view;
361};
362
363/*---------------------------------------------------------------------------*/
364/*---------------------------------------------------------------------------*/
365
366using EnvIndexedSelectionRunCommandContainer = ConstituentIndexedSelectionRunCommandContainer<Arcane::Materials::EnvItemLocalId, Arcane::Materials::EnvCellVectorSelectionView>;
367
368/*---------------------------------------------------------------------------*/
369/*---------------------------------------------------------------------------*/
370
371#if defined(ARCANE_COMPILING_CUDA_OR_HIP)
372/*
373 * Kernel launch function overload for GPU for ComponentItemLocalId and CellLocalId
374 */
375template <typename ContainerType, typename Lambda, typename... RemainingArgs> __global__ void
376doMatContainerGPULambda(ContainerType items, Lambda func, RemainingArgs... remaining_args)
377{
378 auto privatizer = Impl::privatize(func);
379 auto& body = privatizer.privateCopy();
380 Int32 i = blockDim.x * blockIdx.x + threadIdx.x;
382 if (i < items.size()) {
383 body(items[i], remaining_args...);
384 }
386}
387
388#endif // ARCANE_COMPILING_CUDA_OR_HIP
389
390/*---------------------------------------------------------------------------*/
391/*---------------------------------------------------------------------------*/
392
393#if defined(ARCANE_COMPILING_SYCL)
394
395template <typename ContainerType, typename Lambda, typename... RemainingArgs>
396class DoMatContainerSYCLLambda
397{
398 public:
399
400 void operator()(sycl::nd_item<1> x, SmallSpan<std::byte> shm_view,
401 ContainerType items, Lambda func,
402 RemainingArgs... remaining_args) const
403 {
404 auto privatizer = Impl::privatize(func);
405 auto& body = privatizer.privateCopy();
406
407 Int32 i = static_cast<Int32>(x.get_global_id(0));
408 Impl::SyclKernelRemainingArgsHelper::applyAtBegin(x, shm_view, remaining_args...);
409 if (i < items.size()) {
410 body(items[i], remaining_args...);
411 }
412 Impl::SyclKernelRemainingArgsHelper::applyAtEnd(x, shm_view, remaining_args...);
413 }
414
415 void operator()(sycl::id<1> x, ContainerType items, Lambda func) const
416 {
417 auto privatizer = Impl::privatize(func);
418 auto& body = privatizer.privateCopy();
419
420 Int32 i = static_cast<Int32>(x);
421 if (i < items.size()) {
422 body(items[i]);
423 }
424 }
425};
426
427#endif
428
429/*---------------------------------------------------------------------------*/
430/*---------------------------------------------------------------------------*/
431
432template <typename ContainerType, typename Lambda, typename... RemainingArgs>
433void _doConstituentItemsLambda(Int32 base_index, Int32 size, ContainerType items,
434 const Lambda& func, RemainingArgs... remaining_args)
435{
436 auto privatizer = Impl::privatize(func);
437 auto& body = privatizer.privateCopy();
438
440 Int32 last_value = base_index + size;
441 for (Int32 i = base_index; i < last_value; ++i) {
442 body(items[i], remaining_args...);
443 }
445}
446
447/*---------------------------------------------------------------------------*/
448/*---------------------------------------------------------------------------*/
449
450template <typename ContainerType_, typename... RemainingArgs>
451class GenericConstituentCommandArgs
452{
453 public:
454
455 using ContainerType = ContainerType_;
456 using IteratorValueType = ContainerType::IteratorValueType;
457
458 public:
459
460 explicit GenericConstituentCommandArgs(const ContainerType& container, const RemainingArgs&... remaining_args)
461 : m_container(container)
462 , m_remaining_args(remaining_args...)
463 {}
464
465 public:
466
467 ContainerType m_container;
468 std::tuple<RemainingArgs...> m_remaining_args;
469};
470
471/*---------------------------------------------------------------------------*/
472/*---------------------------------------------------------------------------*/
473
474template <typename ContainerType_, typename... RemainingArgs>
475class GenericConstituentCommand
476{
477 public:
478
479 using ContainerType = ContainerType_;
480 using ConstituentCommandType = ContainerType::CommandType;
481
482 public:
483
484 explicit GenericConstituentCommand(const ConstituentCommandType& command)
485 : m_command(command)
486 {}
487 explicit GenericConstituentCommand(const ConstituentCommandType& command,
488 const std::tuple<RemainingArgs...>& remaining_args)
489 : m_command(command)
490 , m_remaining_args(remaining_args)
491 {}
492
493 public:
494
495 ConstituentCommandType m_command;
496 std::tuple<RemainingArgs...> m_remaining_args;
497};
498
499/*---------------------------------------------------------------------------*/
500/*---------------------------------------------------------------------------*/
501
511template <typename ContainerType, typename Lambda, typename... RemainingArgs> void
512_applyConstituentCells(RunCommand& command, ContainerType items, const Lambda& func, const RemainingArgs&... remaining_args)
513{
514 using namespace Arcane::Materials;
515 // TODO: merge the common part with 'applyLoop'
516 Int32 vsize = items.size();
517 if (vsize == 0)
518 return;
519
520 Impl::RunCommandLaunchInfo launch_info(command, vsize);
521 const eExecutionPolicy exec_policy = launch_info.executionPolicy();
522 launch_info.beginExecute();
523 switch (exec_policy) {
525 ARCCORE_KERNEL_CUDA_FUNC((doMatContainerGPULambda<ContainerType, Lambda, RemainingArgs...>),
526 launch_info, func, items, remaining_args...);
527 break;
529 ARCCORE_KERNEL_HIP_FUNC((doMatContainerGPULambda<ContainerType, Lambda, RemainingArgs...>),
530 launch_info, func, items, remaining_args...);
531 break;
533 ARCCORE_KERNEL_SYCL_FUNC((DoMatContainerSYCLLambda<ContainerType, Lambda, RemainingArgs...>{}),
534 launch_info, func, items, remaining_args...);
535 break;
537 _doConstituentItemsLambda(0, vsize, items, func, remaining_args...);
538 break;
540 arcaneParallelFor(0, vsize, launch_info.loopRunInfo(),
541 [&](Int32 begin, Int32 size) {
542 _doConstituentItemsLambda(begin, size, items, func, remaining_args...);
543 });
544 break;
545 default:
546 ARCCORE_FATAL("Invalid execution policy '{0}'", exec_policy);
547 }
548 launch_info.endExecute();
549}
550/*---------------------------------------------------------------------------*/
551/*---------------------------------------------------------------------------*/
552
553template <typename ConstituentCommandType, typename... RemainingArgs, typename Lambda>
554void operator<<(const GenericConstituentCommand<ConstituentCommandType, RemainingArgs...>& c, const Lambda& func)
555{
556 if constexpr (sizeof...(RemainingArgs) > 0) {
557 std::apply([&](auto... vs) {
558 Impl::_applyConstituentCells(c.m_command.m_command, c.m_command.m_items, func, vs...);
559 },
560 c.m_remaining_args);
561 }
562 else
563 Impl::_applyConstituentCells(c.m_command.m_command, c.m_command.m_items, func);
564}
565
566/*---------------------------------------------------------------------------*/
567/*---------------------------------------------------------------------------*/
568
569template <typename ConstituentItemType, typename ConstituentItemContainerType, typename... RemainingArgs> auto
570makeExtendedConstituentItemEnumeratorLoop(ConstituentItemType x,
571 const ConstituentItemContainerType& container,
572 const RemainingArgs&... remaining_args)
573{
574 auto container_instance = arcaneCreateRunCommandMaterialContainer(x, container);
575 using TraitsType = decltype(container_instance); //RunCommandConstituentItemEnumeratorTraitsT<ConstituentItemType>;
576 return GenericConstituentCommandArgs<TraitsType, RemainingArgs...>(container_instance, remaining_args...);
577}
578
579/*---------------------------------------------------------------------------*/
580/*---------------------------------------------------------------------------*/
581
582} // namespace Arcane::Accelerator::Impl
583
584/*---------------------------------------------------------------------------*/
585/*---------------------------------------------------------------------------*/
586
587namespace Arcane::Materials
588{
589
590/*---------------------------------------------------------------------------*/
591/*---------------------------------------------------------------------------*/
592
594inline Accelerator::Impl::EnvAndGlobalCellRunCommandContainer
596{
597 return Accelerator::Impl::EnvAndGlobalCellRunCommandContainer{ env->envView() };
598}
599inline Accelerator::Impl::EnvAndGlobalCellRunCommandContainer
601{
602 return Accelerator::Impl::EnvAndGlobalCellRunCommandContainer{ view };
603}
604
605/*---------------------------------------------------------------------------*/
606/*---------------------------------------------------------------------------*/
607
609inline Accelerator::Impl::MatAndGlobalCellRunCommandContainer
611{
612 return Accelerator::Impl::MatAndGlobalCellRunCommandContainer{ mat->matView() };
613}
614inline Accelerator::Impl::MatAndGlobalCellRunCommandContainer
616{
617 return Accelerator::Impl::MatAndGlobalCellRunCommandContainer{ mat };
618}
619
620/*---------------------------------------------------------------------------*/
621/*---------------------------------------------------------------------------*/
622
624inline Accelerator::Impl::AllEnvCellRunCommandContainer
629
630/*---------------------------------------------------------------------------*/
631/*---------------------------------------------------------------------------*/
632
634inline Accelerator::Impl::EnvCellRunCommandContainer
636{
637 return Accelerator::Impl::EnvCellRunCommandContainer(env->envView());
638}
639inline Accelerator::Impl::EnvCellRunCommandContainer
641{
642 return Accelerator::Impl::EnvCellRunCommandContainer(view);
643}
644
645/*---------------------------------------------------------------------------*/
646/*---------------------------------------------------------------------------*/
647
649inline Accelerator::Impl::MatCellRunCommandContainer
651{
652 return Accelerator::Impl::MatCellRunCommandContainer(mat->matView());
653}
654inline Accelerator::Impl::MatCellRunCommandContainer
656{
657 return Accelerator::Impl::MatCellRunCommandContainer(view);
658}
659
660/*---------------------------------------------------------------------------*/
661/*---------------------------------------------------------------------------*/
662
663inline Accelerator::Impl::EnvIndexedSelectionRunCommandContainer
665{
666 return Accelerator::Impl::EnvIndexedSelectionRunCommandContainer{ view };
667}
668
669/*---------------------------------------------------------------------------*/
670/*---------------------------------------------------------------------------*/
671
672} // namespace Arcane::Materials
673
674/*---------------------------------------------------------------------------*/
675/*---------------------------------------------------------------------------*/
676
677namespace Arcane::Accelerator
678{
679
680/*---------------------------------------------------------------------------*/
681/*---------------------------------------------------------------------------*/
682
683template <typename TraitsType, typename... RemainingArgs> auto
685{
686 using ContainerType = typename Impl::GenericConstituentCommandArgs<TraitsType, RemainingArgs...>::ContainerType;
687 using CommandType = typename ContainerType::CommandType;
688 using GenericCommandType = Impl::GenericConstituentCommand<CommandType, RemainingArgs...>;
689 return GenericCommandType(CommandType::create(command, args.m_container), args.m_remaining_args);
690}
691
692/*---------------------------------------------------------------------------*/
693/*---------------------------------------------------------------------------*/
694
695// TODO: deprecate (must use the generic version)
696inline auto
697operator<<(RunCommand& command, const Impl::MatAndGlobalCellRunCommandContainer& view)
698{
699 using CommandType = Impl::MatAndGlobalCellRunCommandContainer::CommandType;
700 return Impl::GenericConstituentCommand<CommandType>(CommandType::create(command, view));
701}
702
703/*---------------------------------------------------------------------------*/
704/*---------------------------------------------------------------------------*/
705
706// TODO: deprecate (must use the generic version)
707inline auto
708operator<<(RunCommand& command, const Impl::EnvAndGlobalCellRunCommandContainer& view)
709{
710 using CommandType = Impl::EnvAndGlobalCellRunCommandContainer::CommandType;
711 return Impl::GenericConstituentCommand<CommandType>(CommandType::create(command, view));
712}
713
714/*---------------------------------------------------------------------------*/
715/*---------------------------------------------------------------------------*/
716
717// TODO: deprecate (must use the generic version)
718inline auto
719operator<<(RunCommand& command, const Impl::EnvCellRunCommandContainer& view)
720{
721 using CommandType = Impl::EnvCellRunCommandContainer::CommandType;
722 return Impl::GenericConstituentCommand<CommandType>(CommandType::create(command, view));
723}
724
725/*---------------------------------------------------------------------------*/
726/*---------------------------------------------------------------------------*/
727
728// TODO: deprecate (must use the generic version)
729inline auto
730operator<<(RunCommand& command, const Impl::MatCellRunCommandContainer& view)
731{
732 using CommandType = Impl::MatCellRunCommandContainer::CommandType;
733 return Impl::GenericConstituentCommand<CommandType>(CommandType::create(command, view));
734}
735
736/*---------------------------------------------------------------------------*/
737/*---------------------------------------------------------------------------*/
738
739} // End namespace Arcane::Accelerator
740
741/*---------------------------------------------------------------------------*/
742/*---------------------------------------------------------------------------*/
743
744#define A_RUNCOMMAND_MAT_ENUMERATE_BUILDER_HELPER(ConstituentItemNameType, env_or_mat_container, ...) \
745 ::Arcane::Accelerator::Impl::makeExtendedConstituentItemEnumeratorLoop(ConstituentItemNameType{}, env_or_mat_container __VA_OPT__(, __VA_ARGS__))
746
767#define RUNCOMMAND_MAT_ENUMERATE(ConstituentItemNameType, iter_name, env_or_mat_container, ...) \
768 A_FUNCINFO << A_RUNCOMMAND_MAT_ENUMERATE_BUILDER_HELPER(ConstituentItemNameType, env_or_mat_container __VA_OPT__(, __VA_ARGS__)) \
769 << [=] ARCCORE_HOST_DEVICE(typename decltype(A_RUNCOMMAND_MAT_ENUMERATE_BUILDER_HELPER(ConstituentItemNameType, env_or_mat_container __VA_OPT__(, __VA_ARGS__)))::IteratorValueType iter_name \
770 __VA_OPT__(ARCCORE_RUNCOMMAND_REMAINING_FOR_EACH(__VA_ARGS__)))
771
772/*---------------------------------------------------------------------------*/
773/*---------------------------------------------------------------------------*/
774
775#endif
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
Classes, Types, and macros for managing concurrency.
void _applyConstituentCells(RunCommand &command, ContainerType items, const Lambda &func, const RemainingArgs &... remaining_args)
Applies the enumeration func over the entity list items.
__host__ __device__ IteratorValueType operator[](Int32 i) const
Accessor for the i-th element of the list.
constexpr __host__ __device__ IteratorValueType operator[](Int32 i) const
Accessor for the i-th element of the list.
Base class of containers for commands on constituents (except for AllEnvCell).
constexpr __host__ __device__ IteratorValueType operator[](Int32 i) const
Accessor for the i-th element of the list.
constexpr __host__ __device__ IteratorValueType operator[](Int32 i) const
Accessor for the i-th element of the list.
static ARCCORE_DEVICE void applyAtEnd(Int32 index, RemainingArgs &... remaining_args)
Applies the functors of additional arguments at the end of the kernel.
static ARCCORE_DEVICE void applyAtBegin(Int32 index, RemainingArgs &... remaining_args)
Applies the functors of additional arguments at the beginning of the kernel.
Temporary object to store the execution information of a command and group tests.
void beginExecute()
Indicates that command execution is starting.
static void applyAtEnd(RemainingArgs &... remaining_args)
Applies the functors of additional arguments at the end of the iteration.
static void applyAtBegin(RemainingArgs &... remaining_args)
Applies the functors of additional arguments at the beginning of the iteration.
View over a list of cells with environment information.
Arcane cell with material and environment information.
View over a vector of entities of a component.
Index of an accelerator loop over materials or media.
constexpr __host__ __device__ Int32 index() const
Index of the current iteration.
constexpr __host__ __device__ CellLocalId globalCellId() const
Accessor for the cell local id part.
constexpr __host__ __device__ Data operator()()
This operator allows returning the pair [ConstituentItemLocalIdType, CellLocalId].
constexpr __host__ __device__ ConstituentItemLocalIdType varIndex() const
Accessor for the MatVarIndex part.
Arcane cell of an environment.
virtual EnvItemVectorView envView() const =0
View associated with this environment.
virtual MatItemVectorView matView() const =0
View associated with this material.
Represents a material in a multi-material cell.
Represents an index on material and environment variables.
View of an array of elements of type T.
Definition Span.h:805
void arcaneParallelFor(Integer i0, Integer size, InstanceType *itype, void(InstanceType::*lambda_function)(Integer i0, Integer size))
Applies the lambda function lambda_function concurrently over the iteration range [i0,...
eExecutionPolicy
Execution policy for a Runner.
@ SYCL
Execution policy using the SYCL environment.
@ HIP
Execution policy using the HIP environment.
@ CUDA
Execution policy using the CUDA environment.
@ Thread
Multi-threaded execution policy.
Always enables tracing in Arcane parts concerning materials.
EnvItemVectorView EnvCellVectorView
View type for an EnvCellVector.
ConstituentAndGlobalCellIteratorValue< EnvItemLocalId > EnvAndGlobalCellIteratorValue
Type of the iterator value for RUNCOMMAND_MAT_ENUMERATE(EnvAndGlobalCell,...).
ConstituentAndGlobalCellIteratorValue< MatItemLocalId > MatAndGlobalCellIteratorValue
Type of the iterator value for RUNCOMMAND_MAT_ENUMERATE(MatAndGlobalCell,...).
MatItemVectorView MatCellVectorView
View type for a MatCellVector.
Accelerator::Impl::EnvAndGlobalCellRunCommandContainer arcaneCreateRunCommandMaterialContainer(Arcane::Materials::EnvAndGlobalCell, Arcane::Materials::IMeshEnvironment *env)
Specialization for a view on an environment and the associated global cell.
std::int32_t Int32
Signed integer type of 32 bits.