Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
AnyItemArray.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* AnyItemArray.h (C) 2000-2012 */
9/* */
10/* Tableau d'items de types quelconques. */
11/*---------------------------------------------------------------------------*/
12
13#ifndef ARCANE_ANYITEM_ANYITEMARRAY_H
14#define ARCANE_ANYITEM_ANYITEMARRAY_H
15
16#include "arcane/IItemFamily.h"
17#include "arcane/utils/Array.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22#include "arcane/anyitem/AnyItemGlobal.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27ARCANE_BEGIN_NAMESPACE
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32ANYITEM_BEGIN_NAMESPACE
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
53template<typename DataType>
54class Array
55{
56public:
57
58 Array(const Group& group)
59 {
60 for(Group::Enumerator e = group.enumerator(); e.hasNext(); ++e) {
61 if(e.groupIndex() >= m_values.size())
62 m_values.resize(e.groupIndex()+1);
63 }
64 for(Group::Enumerator e = group.enumerator(); e.hasNext(); ++e) {
65 m_values[e.groupIndex()].resize(e.group().itemFamily()->maxLocalId());
66 }
67 }
68
70 void fill(const DataType& data)
71 {
72 for(Integer i = 0; i < m_values.size(); ++i) {
73 m_values[i].fill(data);
74 }
75 }
76
78 template<typename T>
79 inline DataType& operator[](const T& item) {
80 return m_values[item.groupIndex()][item.varIndex()];
81 }
82
83 // Acceseur
84 template<typename T>
85 inline typename Arcane::UniqueArray<DataType>::ConstReferenceType operator[](const T& item) const {
86 return m_values[item.groupIndex()][item.varIndex()];
87 }
88
89private:
90
93};
94
95/*---------------------------------------------------------------------------*/
96/*---------------------------------------------------------------------------*/
97
98ANYITEM_END_NAMESPACE
99ARCANE_END_NAMESPACE
100
101/*---------------------------------------------------------------------------*/
102/*---------------------------------------------------------------------------*/
103
104#endif /* ARCANE_ANYITEM_ANYITEMARRAY_H */
Tableau d'items de types quelconques.
void fill(const DataType &data)
Remplissage du tableau.
Arcane::UniqueArray< Arcane::UniqueArray< DataType > > m_values
Conteneur des variables génériques.
DataType & operator[](const T &item)
Accesseur.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120