12#ifndef ARCANE_CORE_ANYITEM_ANYITEMVARIABLE_H
13#define ARCANE_CORE_ANYITEM_ANYITEMVARIABLE_H
17#include "arcane/utils/Exception.h"
19#include "arcane/core/anyitem/AnyItemGlobal.h"
20#include "arcane/core/anyitem/AnyItemGroup.h"
21#include "arcane/core/anyitem/AnyItemLinkFamily.h"
26namespace Arcane::AnyItem
53template <
typename DataType>
65 VariableAdder(Variable<DataType>& variable,
const ItemGroup& group)
73 ARCANE_ASSERT((
m_used ==
true), (
"VariableAdder never used"));
77 template <
typename K,
typename T>
80 ARCANE_ASSERT((
m_used ==
false), (
"VariableAdder already used"));
87 template <
typename K,
typename T>
90 ARCANE_ASSERT((
m_used ==
false), (
"VariableAdder already used"));
149 inline DataType&
operator[](
const LinkFamily::LinkData& item)
155 inline const DataType&
operator[](
const LinkFamily::LinkData& item)
const
166 template <
typename T>
169 return VariableAdder(*
this, group);
208 ARCANE_ASSERT((old_size <
m_family.groupSize()), (
"Old size greater than new size!"));
231 inline void _insertInternalVariable(ItemGroup group, IVariable* v)
AnyItem family (flyweight pattern) Aggregation of groups to describe variables / partial variables Co...
bool isPartial(const ItemGroup &group) const
Returns true if the group is associated with a partial variable.
void removeObserver(IFamilyObserver &observer) const
Remove an observer.
void registerObserver(IFamilyObserver &observer) const
Register an observer.
Integer groupIndex(const ItemGroup &group) const
Position of the group in the family.
AnyItem family observer interface.
Integer groupIndex() const
Identifier of the group associated with the item referenced by this LinkData.
Integer varIndex() const
LocalId identifier of the item referenced in its original IItemFamily.
Tool for adding a variable to a group.
Variable< DataType > & m_variable
AnyItem Variable.
void operator<<(MeshVariableScalarRefT< K, T > &v)
Binding of a variable.
void operator<<(MeshPartialVariableScalarRefT< K, T > &v)
Binding of a partial variable.
const ItemGroup & m_group
Variable group.
bool m_used
Indicator of Adder usage.
Aggregated variable of arbitrary types (no array variables).
VariableAdder operator[](const ItemGroup &group)
Adding a variable for a group.
Arcane::UniqueArray< ArrayView< DataType > > m_values
Container of generic variables.
Arcane::UniqueArray< IVariable * > m_variables
Container of variables.
void notifyFamilyIsInvalidate()
Notification of family invalidation.
ArrayView< DataType > valuesAtGroup(const Integer igrp)
Raw data associated with a group identified relative to its family.
ConstArrayView< IVariable * > variables() const
Array of variables.
const DataType & operator[](const Group::BlockItemEnumerator &item) const
Direct accessor by an AnyItem enumerator.
ConstArrayView< DataType > valuesAtGroup(const Integer igrp) const
Raw data associated with a group identified relative to its family.
const DataType & operator[](const LinkFamily::LinkData &item) const
Direct accessor by a LinkFamily element (LinkData).
DataType & operator[](const LinkFamily::LinkData &item)
Direct accessor by a LinkFamily element (LinkData).
const Family & family() const
Accessor to the family.
void notifyFamilyIsIncreased()
Notification of family enlargement.
DataType & operator[](const Group::BlockItemEnumerator &item)
Direct accessor by an AnyItem enumerator.
const Family m_family
AnyItem Family of groups.
Modifiable view of an array of type T.
Constant view of an array of type T.
Exception when a fatal error has occurred.
Reference to a group of a given kind.
const String & name() const
Group name.
Scalar variable on a mesh entity type.
Scalar variable on a mesh entity type.
1D data vector with value semantics (STL style).
IVariable * variable() const
Associated variable.
Int32 Integer
Type representing an integer.
void arcaneCallFunctionAndTerminateIfThrow(std::function< void()> function)
Calls the function function and calls std::terminate() if an exception occurs.