12#ifndef ARCANE_MATERIALS_COMPONENTSIMD_H
13#define ARCANE_MATERIALS_COMPONENTSIMD_H
27#include "arcane/materials/MatItem.h"
28#include "arcane/materials/MatItemEnumerator.h"
29#include "arcane/materials/ComponentPartItemVectorView.h"
34#ifdef __INTEL_COMPILER
35#define A_ALIGNED_64 __attribute__((align_value(64)))
56 typedef SimdEnumeratorBase::SimdIndexType SimdIndexType;
60 SimdMatVarIndex(
Int32 array_index, SimdIndexType value_index)
61 : m_value_index(value_index)
62 , m_array_index(array_index)
70 Int32 arrayIndex()
const {
return m_array_index; }
73 const SimdIndexType& valueIndex()
const {
return m_value_index; }
77 SimdIndexType m_value_index;
89:
public SimdEnumeratorBase
95 : SimdEnumeratorBase(item_indexes)
96 , m_component_part_index(component_part_index)
97 , m_component(component)
110 SimdMatVarIndex _varIndex()
const {
return SimdMatVarIndex(m_component_part_index, *_currentSimdIndex()); }
112 operator SimdMatVarIndex()
const
119 Integer m_component_part_index;
126 return ComponentPartSimdCellEnumerator::create(v);
132#define ENUMERATE_SIMD_COMPONENTCELL(iname, env) \
133 A_ENUMERATE_COMPONENTCELL(ComponentPartSimdCell, iname, env)
138template <
typename Lambda>
void
141 const Lambda& lambda)
146 ENUMERATE_SIMD_COMPONENTCELL(mvi, impure_items)
159 typedef const SimdMatVarIndex& IterType;
165 : m_pure_items(pure_items)
166 , m_impure_items(impure_items)
171 static LoopFunctorEnvPartSimdCell create(
const EnvCellVector& env);
176 template <
typename Lambda>
177 void operator<<(Lambda&& lambda)
179 simple_simd_env_loop(m_pure_items, m_impure_items, lambda);
210#define ENUMERATE_COMPONENTITEM_LAMBDA(iter_type, iter, container) \
211 Arcane::Materials::LoopFunctor##iter_type ::create((container)) << [=](Arcane::Materials::LoopFunctor##iter_type ::IterType iter)
219class MatVariableViewBase
243template <
typename ItemType,
typename DataType>
244class MatItemVariableScalarInViewT
245:
public MatVariableViewBase
250 typedef A_ALIGNED_64 DataType* DataTypeAlignedPtr;
255 : MatVariableViewBase(var)
257 , m_value0(v[0].unguardedBasePointer())
261 typename SimdTypeTraits<DataType>::SimdType
264 typedef typename SimdTypeTraits<DataType>::SimdType
SimdType;
265 return SimdType(m_value[mvi.arrayIndex()].data(), mvi.valueIndex());
283 return this->m_value0[pmvi.valueIndex()];
287 DataType
value(ItemIndexType mvi)
const
294 return this->m_value0[idx.valueIndex()];
312 DataTypeAlignedPtr m_value0;
321template <
typename ItemType,
typename DataType>
322class MatItemVariableScalarOutViewT
323:
public MatVariableViewBase
328 typedef A_ALIGNED_64 DataType* DataTypeAlignedPtr;
333 : MatVariableViewBase(var)
335 , m_value0(v[0].unguardedBasePointer())
358 return this->m_value0[pmvi.valueIndex()];
362 DataType&
value(ItemIndexType mvi)
const
369 return this->m_value0[idx.valueIndex()];
387 DataTypeAlignedPtr m_value0;
396template <
typename DataType>
409template <
typename DataType>
#define ARCANE_ALIGNAS(value)
Macro to guarantee the alignment of a class to value bytes.
Declarations of Arcane's general types.
Read view on a scalar mesh variable.
Write view on a scalar mesh variable.
Modifiable view of an array of type T.
Enumerator over the constituents of a cell.
Scalar variable on the cells of a mesh material.
View over pure or partial entities of a component.
IMeshComponent * component() const
Associated component.
Int32ConstArrayView valueIndexes() const
List of valueIndex() of the part.
SIMD enumerator on a sub-part (pure or partial) of a subset of the cells of a component (material or ...
constexpr __host__ __device__ MatVarIndex localId() const
Generic index to access variable values.
Enumerator over the cells of an environment.
Vector over the entities of an environment.
Interface of a component (material or environment) of a mesh.
Interface of a mesh environment.
Interface of a material variable on a mesh.
Read view on a scalar mesh variable.
SimdTypeTraits< DataType >::SimdType operator[](const SimdMatVarIndex &mvi) const
Vector access operator with indirection.
DataType operator[](PureMatVarIndex pmvi) const
Access operator for the item entity.
DataType operator[](ItemIndexType mvi) const
Access operator for the item entity.
DataType operator[](CellComponentCellEnumerator mc) const
Partial value of the variable for the mc iterator.
DataType operator[](ComponentItemLocalId lid) const
Access operator for the item entity.
DataType operator[](EnvCellEnumerator mc) const
Partial value of the variable for the mc iterator.
DataType value(ItemIndexType mvi) const
Access operator for the item entity.
Read view on a scalar mesh variable.
SimdSetter< DataType > operator[](const SimdMatVarIndex &mvi) const
Vector access operator with indirection.
DataType & value(ItemIndexType mvi) const
Access operator for the item entity.
DataType & operator[](ItemIndexType mvi) const
Access operator for the item entity.
DataType & operator[](ComponentItemLocalId lid) const
Access operator for the item entity.
DataType & operator[](CellComponentCellEnumerator mc) const
Partial value of the variable for the mc iterator.
DataType & operator[](EnvCellEnumerator mc) const
Partial value of the variable for the mc iterator.
Represents an index on material and environment variables.
constexpr __host__ __device__ Int32 arrayIndex() const
Returns the index of the value array in the list of variables.
constexpr __host__ __device__ Int32 valueIndex() const
Returns the index in the value array.
IMeshMaterialVariable * materialVariable() const
Associated material variable.
Index of a pure material item in a variable.
Always enables tracing in Arcane parts concerning materials.
ConstituentItemIndexedSelectionEnumerator< ComponentCellVectorView > arcaneImplCreateConstituentEnumerator(ComponentCell, ComponentCellVectorSelectionView container)
Enumerator over a constituent selection.
MatItemVariableScalarOutViewT< Cell, DataType > viewOut(CellMaterialVariableScalarRef< DataType > &var)
Write view.
MatItemVariableScalarInViewT< Cell, DataType > viewIn(const CellMaterialVariableScalarRef< DataType > &var)
Read view.
class ARCANE_MATERIALS_EXPORT(64) SimdMatVarIndex
SIMD indexer on a component.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.