It is possible to use the Arcane accelerator API to manage constituents. Instances of the material manager IMeshMaterialMng use the execution manager (Runner) associated with the subdomain from which the mesh originates. Constituent management will therefore be handled automatically using the same execution environment as operations on classic mesh entities.
Using the accelerator API for materials is similar to using it for mesh entities. The macro RUNCOMMAND_MAT_ENUMERATE() allows iteration over an environment IMeshEnvironment or a material IMeshMaterial.
The possible values for this macro are:
| Iteration Type | Iterator Value | Container Type | Description |
|---|---|---|---|
| EnvAndGlobalCell | EnvAndGlobalCellIteratorValue | IMeshEnvironment EnvCellVectorView | Iteration over an environment allowing the retrieval of the local cell number of the environment, the iteration index, and the associated global cell number for each iteration. |
| MatAndGlobalCell | MatAndGlobalCellIteratorValue | IMeshMaterial MatCellVectorView | Iteration over a material allowing the retrieval of the local cell number of the material, the iteration index, and the associated global cell number for each iteration. |
| AllEnvCell | AllEnvCell | AllEnvCellVectorView | Iteration over the AllEnvCell |
| EnvCell | EnvCellLocalId | IMeshEnvironment EnvCellVectorView | Iteration over an environment allowing the retrieval of only the local cell number of the environment for each iteration. |
| MatCell | MatCellLocalId | IMeshMaterial MatCellVectorView | Iteration over a material allowing the retrieval of only the local cell number of the material for each iteration. |
If you only want to access the local numbers of material or environment cells, it is preferable for performance reasons to use the version with EnvCell or MatCell as the iterator type.
Here is a code example for iterating over an environment cell with the information of the iteration index and the associated global cell.
Here is another example for iterating over the AllEnvCell and retrieving information about the environments and materials present in each AllEnvCell.
The class ComponentCellVector and its derived classes (MatCellVector and EnvCellVector) are supported by the accelerator API, and their creation or modification uses the default execution environment.
Starting from version 3.16 of Arcane, if the default execution environment is an accelerator, it is possible to specify a host execution policy via the method IMeshComponent::setSpecificExecutionPolicy(). This policy will be used to create and modify instances of ComponentCellVector, MatCellVector, and EnvCellVector.