14#include "arcane/utils/StringBuilder.h"
15#include "arcane/utils/FatalErrorException.h"
16#include "arcane/utils/PlatformUtils.h"
19#include "arcane/core/ItemGroupImpl.h"
20#include "arcane/core/ItemGroup.h"
21#include "arcane/core/GroupIndexTable.h"
36GroupIndexTable(ItemGroupImpl* group_impl)
37: HashTableBase(0, false)
38, m_group_impl(group_impl)
43 ARCANE_ASSERT((m_group_impl), (
"ItemGroupImpl pointer null"));
45 m_disable_check_integrity = platform::getEnvironmentVariable(
"ARCANE_ENABLE_GROUPINDEXTABLE_CHECKINTEGRITY").null();
56 m_view.m_key_buffer_span = m_key_buffer;
57 m_view.m_next_buffer_span = m_next_buffer;
58 m_view.m_buckets_span = m_buckets;
59 m_view.m_nb_bucket = m_nb_bucket;
68 ItemGroup group(m_group_impl);
70 const Integer group_size = group.size();
71 m_nb_bucket = this->nearestPrimeNumber(2 * group_size);
72 m_buckets.resize(m_nb_bucket);
74 m_key_buffer.resize(group_size);
75 m_next_buffer.resize(group_size);
79 const Integer index = item.index();
80 const KeyTypeConstRef key = item->localId();
81 const Integer bucket = _hash(key);
82 ARCANE_ASSERT((_lookupBucket(bucket, key) < 0), (
"Already assigned key"));
83 m_key_buffer[index] = key;
84 m_next_buffer[index] = m_buckets[bucket];
85 m_buckets[bucket] = index;
88 ARCANE_ASSERT((_checkIntegrity()), (
"GroupIndexTable integrity failed"));
95compact(
const Int32ConstArrayView* infos)
100 ARCANE_ASSERT((m_group_impl->size() == m_key_buffer.size()), (
"Inconsistent sizes"));
107 ItemGroup group(m_group_impl);
110 const KeyTypeConstRef key = iitem.localId();
111 const Integer i = iitem.index();
112 const KeyTypeConstRef old_key = m_key_buffer[iitem.index()];
113 const Integer bucket = _hash(key);
114 ARCANE_ASSERT((_lookupBucket(bucket, key) < 0), (
"Already assigned key"));
115 ARCANE_ASSERT((infos == NULL || (*infos)[old_key] == key), (
"Inconsistent reorder translation %d vs %d vs %d", (*infos)[old_key], key, old_key));
116 m_key_buffer[i] = key;
117 m_next_buffer[i] = m_buckets[bucket];
118 m_buckets[bucket] = i;
120 ARCANE_ASSERT((_checkIntegrity()), (
"GroupIndexTable integrity failed"));
129bool GroupIndexTable::
132 const Integer
hf = _hash(
id);
133 for (Integer i = m_buckets[
hf]; i >= 0; i = m_next_buffer[i]) {
134 if (m_key_buffer[i] ==
id)
143bool GroupIndexTable::
146 return !m_buckets.empty();
152bool GroupIndexTable::
153_checkIntegrity(
bool full)
const
156 if (m_group_impl->size() != m_key_buffer.size()) {
158 b +=
"GroupIndexTable BAD DATA size : group size=";
159 b += m_group_impl->size();
160 b +=
" vs data size=";
161 b += m_key_buffer.size();
166 if (!
full && m_disable_check_integrity)
171 const Integer
hd = item.index();
172 if (m_key_buffer[
hd] != item.localId() || !_hasKey(item.localId())) {
174 b +=
"GroupIndexTable BAD DATA at ";
178 b += m_key_buffer[
hd];
180 b += _hasKey(item.localId());
Fonctions de gestion mémoire et des allocateurs.
Groupe d'entités de maillage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Exception lorsqu'une erreur fatale est survenue.
Constructeur de chaîne de caractère unicode.
IMemoryAllocator * getDefaultDataAllocator()
Allocateur par défaut pour les données.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.