12#ifndef ARCANE_VARIABLEVIEW_H
13#define ARCANE_VARIABLEVIEW_H
19#include "arcane/core/DataView.h"
20#include "arcane/core/ItemLocalId.h"
48template <
typename DataType>
50template <
typename DataType>
74template <
typename DataType>
79 using ValueType = DataType;
89template <
typename DataType>
94 using ValueType = DataType;
95 using DataTypeReturnReference = View1DSetter<DataType>;
115template <
typename ItemType,
typename Accessor>
116class ItemVariableScalarOutViewT
117:
public VariableViewBase
121 using DataType =
typename Accessor::ValueType;
122 using DataTypeReturnReference = DataType&;
128 : VariableViewBase(var)
148 ARCANE_CHECK_AT(i.localId(), m_size);
149 return Accessor(this->m_values + i.localId());
153 Accessor
value(ItemIndexType i)
const
155 ARCANE_CHECK_AT(i.localId(), m_size);
156 return Accessor(this->m_values + i.localId());
160 void setValue(ItemIndexType i,
const DataType& v)
const
162 ARCANE_CHECK_AT(i.localId(), m_size);
163 this->m_values[i.localId()] = v;
178template <
typename ItemType,
typename DataType>
179class ItemVariableScalarInViewT
180:
public VariableViewBase
189 : VariableViewBase(var)
194 typename SimdTypeTraits<DataType>::SimdType
197 typedef typename SimdTypeTraits<DataType>::SimdType
SimdType;
202 typename SimdTypeTraits<DataType>::SimdType
205 typedef typename SimdTypeTraits<DataType>::SimdType
SimdType;
206 return SimdType(m_values.data() + simd_item.baseLocalId());
212 return this->m_values[i.localId()];
216 const DataType&
value(ItemIndexType i)
const
218 return this->m_values[i.localId()];
232template <
typename ItemType,
typename DataType>
233class ItemVariableArrayInViewT
234:
public VariableViewBase
243 : VariableViewBase(var)
250 return this->m_values[i.localId()];
256 return this->m_values[i.localId()];
270template <
typename ItemType,
typename Accessor>
271class ItemVariableArrayOutViewT
272:
public VariableViewBase
276 using DataType =
typename Accessor::ValueType;
277 using DataTypeReturnType =
typename Accessor::DataTypeReturnReference;
283 : VariableViewBase(var)
290 return DataTypeReturnType(this->m_values[i.localId()]);
296 return DataTypeReturnType(this->m_values[i.localId()]);
326template <
typename ItemType,
typename Accessor>
328:
public VariableViewBase
332 using DataType =
typename Accessor::ValueType;
333 using DataTypeReturnReference = DataType&;
340 : VariableViewBase(var)
360 ARCANE_CHECK_AT(item.localId(), m_size);
361 return Accessor(this->m_values + item.localId());
365 Accessor
value(ItemIndexType item)
const
367 ARCANE_CHECK_AT(item.localId(), m_size);
368 return Accessor(this->m_values + item.localId());
372 void setValue(ItemIndexType item,
const DataType& v)
const
374 ARCANE_CHECK_AT(item.localId(), m_size);
375 this->m_values[item.localId()] = v;
390template <
typename ItemType,
typename DataType>
auto
400template <
typename ItemType>
auto
410template <
typename ItemType>
auto
420template <
typename ItemType,
typename DataType>
auto
433template <
typename ItemType,
typename DataType>
auto
443template <
typename ItemType>
auto
453template <
typename ItemType>
auto
463template <
typename ItemType,
typename DataType>
auto
476template <
typename ItemType,
typename DataType>
auto
485template <
typename ItemType,
typename DataType>
auto
494typedef ItemVariableScalarInViewT<Node, Byte> VariableNodeByteInView;
495typedef ItemVariableScalarInViewT<Edge, Byte> VariableEdgeByteInView;
496typedef ItemVariableScalarInViewT<Face, Byte> VariableFaceByteInView;
497typedef ItemVariableScalarInViewT<Cell, Byte> VariableCellByteInView;
498typedef ItemVariableScalarInViewT<Particle, Byte> VariableParticleByteInView;
500typedef ItemVariableScalarInViewT<Node, Int16> VariableNodeInt16InView;
501typedef ItemVariableScalarInViewT<Edge, Int16> VariableEdgeInt16InView;
502typedef ItemVariableScalarInViewT<Face, Int16> VariableFaceInt16InView;
503typedef ItemVariableScalarInViewT<Cell, Int16> VariableCellInt16InView;
504typedef ItemVariableScalarInViewT<Particle, Int16> VariableParticleInt16InView;
506typedef ItemVariableScalarInViewT<Node, Int32> VariableNodeInt32InView;
507typedef ItemVariableScalarInViewT<Edge, Int32> VariableEdgeInt32InView;
508typedef ItemVariableScalarInViewT<Face, Int32> VariableFaceInt32InView;
509typedef ItemVariableScalarInViewT<Cell, Int32> VariableCellInt32InView;
510typedef ItemVariableScalarInViewT<Particle, Int32> VariableParticleInt32InView;
512typedef ItemVariableScalarInViewT<Node, Int64> VariableNodeInt64InView;
513typedef ItemVariableScalarInViewT<Edge, Int64> VariableEdgeInt64InView;
514typedef ItemVariableScalarInViewT<Face, Int64> VariableFaceInt64InView;
515typedef ItemVariableScalarInViewT<Cell, Int64> VariableCellInt64InView;
516typedef ItemVariableScalarInViewT<Particle, Int64> VariableParticleInt64InView;
518typedef ItemVariableScalarInViewT<Node, Real> VariableNodeRealInView;
519typedef ItemVariableScalarInViewT<Edge, Real> VariableEdgeRealInView;
520typedef ItemVariableScalarInViewT<Face, Real> VariableFaceRealInView;
521typedef ItemVariableScalarInViewT<Cell, Real> VariableCellRealInView;
522typedef ItemVariableScalarInViewT<Particle, Real> VariableParticleRealInView;
524typedef ItemVariableScalarInViewT<Node, Real2> VariableNodeReal2InView;
525typedef ItemVariableScalarInViewT<Edge, Real2> VariableEdgeReal2InView;
526typedef ItemVariableScalarInViewT<Face, Real2> VariableFaceReal2InView;
527typedef ItemVariableScalarInViewT<Cell, Real2> VariableCellReal2InView;
528typedef ItemVariableScalarInViewT<Particle, Real2> VariableParticleReal2InView;
530typedef ItemVariableScalarInViewT<Node, Real3> VariableNodeReal3InView;
531typedef ItemVariableScalarInViewT<Edge, Real3> VariableEdgeReal3InView;
532typedef ItemVariableScalarInViewT<Face, Real3> VariableFaceReal3InView;
533typedef ItemVariableScalarInViewT<Cell, Real3> VariableCellReal3InView;
534typedef ItemVariableScalarInViewT<Particle, Real3> VariableParticleReal3InView;
539typedef ItemVariableScalarOutViewT<Node, DataViewSetter<Byte>> VariableNodeByteOutView;
540typedef ItemVariableScalarOutViewT<Edge, DataViewSetter<Byte>> VariableEdgeByteOutView;
541typedef ItemVariableScalarOutViewT<Face, DataViewSetter<Byte>> VariableFaceByteOutView;
542typedef ItemVariableScalarOutViewT<Cell, DataViewSetter<Byte>> VariableCellByteOutView;
543typedef ItemVariableScalarOutViewT<Particle, DataViewSetter<Byte>> VariableParticleByteOutView;
545typedef ItemVariableScalarOutViewT<Node, DataViewSetter<Int16>> VariableNodeInt16OutView;
546typedef ItemVariableScalarOutViewT<Edge, DataViewSetter<Int16>> VariableEdgeInt16OutView;
547typedef ItemVariableScalarOutViewT<Face, DataViewSetter<Int16>> VariableFaceInt16OutView;
548typedef ItemVariableScalarOutViewT<Cell, DataViewSetter<Int16>> VariableCellInt16OutView;
549typedef ItemVariableScalarOutViewT<Particle, DataViewSetter<Int16>> VariableParticleInt16OutView;
551typedef ItemVariableScalarOutViewT<Node, DataViewSetter<Int32>> VariableNodeInt32OutView;
552typedef ItemVariableScalarOutViewT<Edge, DataViewSetter<Int32>> VariableEdgeInt32OutView;
553typedef ItemVariableScalarOutViewT<Face, DataViewSetter<Int32>> VariableFaceInt32OutView;
554typedef ItemVariableScalarOutViewT<Cell, DataViewSetter<Int32>> VariableCellInt32OutView;
555typedef ItemVariableScalarOutViewT<Particle, DataViewSetter<Int32>> VariableParticleInt32OutView;
557typedef ItemVariableScalarOutViewT<Node, DataViewSetter<Int64>> VariableNodeInt64OutView;
558typedef ItemVariableScalarOutViewT<Edge, DataViewSetter<Int64>> VariableEdgeInt64OutView;
559typedef ItemVariableScalarOutViewT<Face, DataViewSetter<Int64>> VariableFaceInt64OutView;
560typedef ItemVariableScalarOutViewT<Cell, DataViewSetter<Int64>> VariableCellInt64OutView;
561typedef ItemVariableScalarOutViewT<Particle, DataViewSetter<Int64>> VariableParticleInt64OutView;
563typedef ItemVariableScalarOutViewT<Node, DataViewSetter<Real>> VariableNodeRealOutView;
564typedef ItemVariableScalarOutViewT<Edge, DataViewSetter<Real>> VariableEdgeRealOutView;
565typedef ItemVariableScalarOutViewT<Face, DataViewSetter<Real>> VariableFaceRealOutView;
566typedef ItemVariableScalarOutViewT<Cell, DataViewSetter<Real>> VariableCellRealOutView;
567typedef ItemVariableScalarOutViewT<Particle, DataViewSetter<Real>> VariableParticleRealOutView;
569typedef ItemVariableRealNScalarOutViewT<Node, DataViewSetter<Real2>> VariableNodeReal2OutView;
570typedef ItemVariableRealNScalarOutViewT<Edge, DataViewSetter<Real2>> VariableEdgeReal2OutView;
571typedef ItemVariableRealNScalarOutViewT<Face, DataViewSetter<Real2>> VariableFaceReal2OutView;
572typedef ItemVariableRealNScalarOutViewT<Cell, DataViewSetter<Real2>> VariableCellReal2OutView;
573typedef ItemVariableRealNScalarOutViewT<Particle, DataViewSetter<Real2>> VariableParticleReal2OutView;
575typedef ItemVariableRealNScalarOutViewT<Node, DataViewSetter<Real3>> VariableNodeReal3OutView;
576typedef ItemVariableRealNScalarOutViewT<Edge, DataViewSetter<Real3>> VariableEdgeReal3OutView;
577typedef ItemVariableRealNScalarOutViewT<Face, DataViewSetter<Real3>> VariableFaceReal3OutView;
578typedef ItemVariableRealNScalarOutViewT<Cell, DataViewSetter<Real3>> VariableCellReal3OutView;
579typedef ItemVariableRealNScalarOutViewT<Particle, DataViewSetter<Real3>> VariableParticleReal3OutView;
Declarations of types on entities.
Read-only view on a mesh array variable.
Write-only view on a mesh array variable.
Write-only view on a scalar variable of type 'RealN' of the mesh.
Read view on a scalar variable of the mesh.
Write view on a scalar variable of the mesh.
Class to access a 1D array of a read/write view.
Class to access a 1D array of a read/write view.
Class for accessing an element of a read/write view.
Class for accessing an element of a write view.
Characteristics of mesh elements.
Span< const DataType > value(ItemIndexType i) const
Access operator for the item entity.
Span< const DataType > operator[](ItemIndexType i) const
Access operator for the item entity.
Span< DataType > value(ItemIndexType i) const
Access operator for the item entity.
DataTypeReturnType operator[](ItemIndexType i) const
Access operator for the item entity.
ItemVariableRealNScalarOutViewT(IVariable *var, Span< DataType > v)
Constructs the view.
void setValue(ItemIndexType item, const DataType &v) const
Positions the value for the item entity at v.
SimdSetter< DataType > operator[](SimdItemIndexT< ItemType > simd_item) const
Vector access operator with indirection.
Accessor operator[](ItemIndexType item) const
Access operator for the item entity.
SimdDirectSetter< DataType > operator[](SimdItemDirectIndexT< ItemType > simd_item) const
Vector access operator without indirection.
Accessor value(ItemIndexType item) const
Access operator for the item entity.
SimdTypeTraits< DataType >::SimdType operator[](SimdItemIndexT< ItemType > simd_item) const
Vector access operator with indirection.
const DataType & value(ItemIndexType i) const
Access operator for the item entity.
const DataType & operator[](ItemIndexType i) const
Access operator for the item entity.
SimdTypeTraits< DataType >::SimdType operator[](SimdItemDirectIndexT< ItemType > simd_item) const
Vector access operator with indirection.
void setValue(ItemIndexType i, const DataType &v) const
Sets the value for the item entity at v.
SimdDirectSetter< DataType > operator[](SimdItemDirectIndexT< ItemType > simd_item) const
Vector access operator without indirection.
Accessor operator[](ItemIndexType i) const
Access operator for the item entity.
Accessor value(ItemIndexType i) const
Access operator for the item entity.
SimdSetter< DataType > operator[](SimdItemIndexT< ItemType > simd_item) const
Vector access operator with indirection.
Array variable on a mesh entity type.
Scalar variable on a mesh entity type.
Object allowing positioning of values in a SIMD vector.
Vector index without indirection for an entity type.
Vector index with indirection for an entity type. TODO: store the indices in a vector register to be ...
const SimdIndexType &ARCANE_RESTRICT simdLocalIds() const
List of local IDs of the instance entities.
Object allowing positioning of values in a SIMD vector.
View for a 2D array whose size is an 'Int64'.
constexpr __host__ __device__ pointer data() const noexcept
Pointer to the start of the view.
constexpr __host__ __device__ SizeType size() const noexcept
Returns the size of the array.
View of an array of elements of type T.
IVariable * variable() const
Associated variable.
auto viewInOut(const ViewBuildInfo &vbi, CellMaterialVariableScalarRef< DataType > &var)
Read/write view for scalar material variables.
auto viewOut(const ViewBuildInfo &vbi, CellMaterialVariableScalarRef< DataType > &var)
Write view for scalar material variables.
auto viewIn(const ViewBuildInfo &vbi, const CellMaterialVariableScalarRef< DataType > &var)
Read view for scalar material variables.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.