12#ifndef ARCANE_CORE_MESHPARTIALVARIABLESCALARREF_H
13#define ARCANE_CORE_MESHPARTIALVARIABLESCALARREF_H
17#include "arcane/utils/FatalErrorException.h"
19#include "arcane/core/MeshVariableRef.h"
20#include "arcane/core/PrivateVariableScalar.h"
22#include "arcane/core/ItemGroupRangeIterator.h"
23#include "arcane/core/ItemPairEnumerator.h"
24#include "arcane/core/GroupIndexTable.h"
39template <
typename DataTypeT>
45 typedef DataTypeT DataType;
47 typedef const DataType& ConstReturnReferenceType;
48 typedef DataType& ReturnReferenceType;
53 typedef typename BaseClass::PrivatePartType PrivatePartType;
54 typedef typename BaseClass::DataTypeReturnReference DataTypeReturnReference;
72 ARCANE_CORE_EXPORT
void fill(
const DataType& value);
74 ARCANE_CORE_EXPORT
void internalSetUsed(
bool v);
78 const DataType& operator[](
const Item& i)
const
80 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND(i);
81 ARCANE_ASSERT((m_table.isUsed()), (
"GroupIndexTable expired"));
83 return this->_value(table[i.
localId()]);
85 DataTypeReturnReference operator[](
const Item& i)
87 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND(i);
88 ARCANE_ASSERT((m_table.isUsed()), (
"GroupIndexTable expired"));
90 return this->_value(table[i.
localId()]);
93 const DataType& operator[](
const ItemGroupRangeIterator& i)
const
95 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND(i);
96 return this->_value(i.index());
98 const DataType& operator[](
const ItemEnumerator& i)
const
100 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND((*i));
101 ARCANE_CHECK_ENUMERATOR(i, this->itemGroup());
102 return this->_value(i.index());
104 const DataType& operator[](ItemEnumeratorIndex i)
const
106 return this->_value(i.index());
108 const DataType& operator[](
const ItemPairEnumerator& i)
const
110 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND((*i));
111 return this->_value(i.index());
114 DataTypeReturnReference operator[](
const ItemGroupRangeIterator& i)
116 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND(i);
117 return this->_value(i.index());
119 DataTypeReturnReference operator[](
const ItemEnumerator& i)
121 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND((*i));
122 ARCANE_CHECK_ENUMERATOR(i, this->itemGroup());
123 return this->_value(i.index());
125 DataTypeReturnReference operator[](ItemEnumeratorIndex i)
127 return this->_value(i.index());
129 DataTypeReturnReference operator[](
const ItemPairEnumerator& i)
131 ARCANE_CHECK_VALID_ITEM_AND_GROUP_KIND((*i));
132 return this->_value(i.index());
157template <
typename ItemTypeT,
typename DataTypeT>
163 typedef DataTypeT DataType;
164 typedef ItemTypeT ItemType;
166 typedef const DataType& ConstReturnReferenceType;
167 typedef DataType& ReturnReferenceType;
175 typedef typename BaseClass::DataTypeReturnReference DataTypeReturnReference;
188 const DataType& operator[](
const ItemLocalIdType& i)
const
190 ARCANE_ASSERT((this->m_table.isUsed()), (
"GroupIndexTable expired"));
192 return this->_value(table[i.asInt32()]);
194 DataTypeReturnReference operator[](
const ItemLocalIdType& i)
196 ARCANE_ASSERT((this->m_table.isUsed()), (
"GroupIndexTable expired"));
198 return this->_value(table[i.asInt32()]);
201 const DataType& operator[](
const ItemGroupRangeIteratorT<ItemType>& i)
const
203 return this->_value(i.index());
205 DataTypeReturnReference operator[](
const ItemGroupRangeIteratorT<ItemType>& i)
207 return this->_value(i.index());
209 const DataType& operator[](
const ItemEnumeratorT<ItemType>& i)
const
211 ARCANE_CHECK_ENUMERATOR(i, this->
itemGroup());
212 return this->_value(i.index());
214 const DataType& operator[](ItemEnumeratorIndexT<ItemType> i)
const
216 return this->_value(i.index());
218 DataTypeReturnReference operator[](
const ItemEnumeratorT<ItemType>& i)
220 ARCANE_CHECK_ENUMERATOR(i, this->
itemGroup());
221 return this->_value(i.index());
223 DataTypeReturnReference operator[](ItemEnumeratorIndexT<ItemType> i)
225 return this->_value(i.index());
227 const DataType& operator[](
const ItemPairEnumeratorSubT<ItemType>& i)
const
229 return this->_value(i.index());
231 DataTypeReturnReference operator[](
const ItemPairEnumeratorSubT<ItemType>& i)
233 return this->_value(i.index());
Base class of a hash table between group items and their positions in the table.
Index of an ItemType entity in a variable.
ItemPartialVariableScalarRefT(const VariableBuildInfo &vb, eItemKind ik)
Constructs a reference to the variable specified in vb.
GroupIndexTableView tableView() const
View of the group's redirection table.
ItemPartialVariableScalarRefT(IVariable *var)
Constructs a reference from var.
void operator=(const ItemPartialVariableScalarRefT< DataType > &rhs)
Copy operator.
ItemPartialVariableScalarRefT(const ItemPartialVariableScalarRefT< DataType > &rhs)
Constructs a reference from rhs.
Characteristics of mesh elements.
Base class for a mesh element.
constexpr Int32 localId() const
Local identifier of the entity in the processor subdomain.
void refersTo(const MeshPartialVariableScalarRefT< ItemType, DataType > &rhs)
Positions the instance reference to the variable rhs.
MeshPartialVariableScalarRefT(const MeshPartialVariableScalarRefT< ItemType, DataType > &rhs)
Constructs a reference from rhs.
MeshPartialVariableScalarRefT(const VariableBuildInfo &vb)
Constructs a reference to the variable specified in vb.
GroupType itemGroup() const
Group associated with the quantity.
PrivateVariableScalarT(const VariableBuildInfo &vb, const VariableInfo &vi)
1D data vector with value semantics (STL style).
Parameters necessary for building a variable.
Variable factory registrar.
Information characterizing a variable.
Information characterizing the type of a variable.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eItemKind
Mesh entity type.