Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::AnyItem::Array2< DataType > Class Template Reference

2D array of items of arbitrary types. More...

#include <arcane/core/anyitem/AnyItemArray2.h>

Collaboration diagram for Arcane::AnyItem::Array2< DataType >:

Public Member Functions

 Array2 (const Group &group)
void resize (Integer size)
 Resizing the second dimension of the array.
void fill (const DataType &data)
 Filling the array.
template<typename T>
ArrayView< DataType > operator[] (const T &item)
 Accessor.
template<typename T>
ConstArrayView< DataType > operator[] (const T &item) const
Integer size () const
 Returns the size of the array.

Private Attributes

Integer m_size
 Size of the array's second dimension.
Arcane::UniqueArray< Arcane::UniqueArray2< DataType > > m_values
 Container for generic variables.

Detailed Description

template<typename DataType>
class Arcane::AnyItem::Array2< DataType >

2D array of items of arbitrary types.

Similar to 2D variables but without defining them

For example:

AnyItem::UniqueArray2<Real> array(family.allItems()); array.resize(3); array.fill(0.);

ENUMERATE_ANY_ITEM(iitem, family.allItems()) { for(Integer i = 0; i < 3; ++i) array[iitem][i] += variable[iitem]; }

\TODO: We could improve the implementation by using localId in AnyItem::Family with a unique array allocated to maxLocalId

Definition at line 51 of file AnyItemArray2.h.

Constructor & Destructor Documentation

◆ Array2()

template<typename DataType>
Arcane::AnyItem::Array2< DataType >::Array2 ( const Group & group)
inline

Definition at line 55 of file AnyItemArray2.h.

Member Function Documentation

◆ fill()

template<typename DataType>
void Arcane::AnyItem::Array2< DataType >::fill ( const DataType & data)
inline

Filling the array.

Definition at line 77 of file AnyItemArray2.h.

References m_values.

◆ operator[]() [1/2]

template<typename DataType>
template<typename T>
ArrayView< DataType > Arcane::AnyItem::Array2< DataType >::operator[] ( const T & item)
inline

Accessor.

Definition at line 86 of file AnyItemArray2.h.

References m_values.

◆ operator[]() [2/2]

template<typename DataType>
template<typename T>
ConstArrayView< DataType > Arcane::AnyItem::Array2< DataType >::operator[] ( const T & item) const
inline

Definition at line 93 of file AnyItemArray2.h.

◆ resize()

template<typename DataType>
void Arcane::AnyItem::Array2< DataType >::resize ( Integer size)
inline

Resizing the second dimension of the array.

Definition at line 68 of file AnyItemArray2.h.

References m_size, m_values, and size().

Here is the call graph for this function:

◆ size()

template<typename DataType>
Integer Arcane::AnyItem::Array2< DataType >::size ( ) const
inline

Returns the size of the array.

Definition at line 99 of file AnyItemArray2.h.

References m_size.

Referenced by resize().

Here is the caller graph for this function:

Member Data Documentation

◆ m_size

template<typename DataType>
Integer Arcane::AnyItem::Array2< DataType >::m_size
private

Size of the array's second dimension.

Definition at line 104 of file AnyItemArray2.h.

Referenced by resize(), and size().

◆ m_values

template<typename DataType>
Arcane::UniqueArray<Arcane::UniqueArray2<DataType> > Arcane::AnyItem::Array2< DataType >::m_values
private

Container for generic variables.

Definition at line 107 of file AnyItemArray2.h.

Referenced by fill(), operator[](), and resize().


The documentation for this class was generated from the following file: