14#include "arcane/materials/internal/MeshComponentData.h"
16#include "arcane/utils/FatalErrorException.h"
18#include "arcane/core/IItemFamily.h"
19#include "arcane/core/ItemPrinter.h"
20#include "arcane/core/materials/IMeshMaterialMng.h"
21#include "arcane/core/materials/internal/IMeshMaterialMngInternal.h"
23#include "arcane/materials/internal/MeshMaterialVariableIndexer.h"
24#include "arcane/materials/internal/MeshComponentPartData.h"
37 Int16 component_id, ComponentItemSharedInfo* shared_info,
39: TraceAccessor(component->traceMng())
40, m_component(component)
41, m_component_id(component_id)
43, m_constituent_local_id_list(shared_info, String(
"MeshComponentDataIdList")+name)
47 m_variable_indexer =
new MeshMaterialVariableIndexer(traceMng(), name);
48 m_is_indexer_owner =
true;
59 if (m_is_indexer_owner)
60 delete m_variable_indexer;
69void MeshComponentData::
73 m_part_data->_setConstituentListView(m_constituent_local_id_list.view());
79void MeshComponentData::
80_resizeItemsInternal(Integer nb_item)
82 m_constituent_local_id_list.resize(nb_item);
89void MeshComponentData::
90_setVariableIndexer(MeshMaterialVariableIndexer* indexer)
92 m_variable_indexer = indexer;
93 m_is_indexer_owner =
false;
99void MeshComponentData::
100_setItems(
const ItemGroup& group)
103 if (m_variable_indexer)
104 m_variable_indexer->setCells(group);
110void MeshComponentData::
113 m_part_data =
new MeshComponentPartData(m_component, m_name);
114 m_part_data->setRecomputeFunctor(&m_recompute_part_data_functor);
127void MeshComponentData::
137 for (
Integer i = 0, nb = current_internals.
size(); i < nb; ++i) {
138 Int32 lid = local_ids[i];
139 Int32 new_lid = old_to_new_ids[lid];
140 if (new_lid != NULL_ITEM_LOCAL_ID) {
141 new_internals.
add(current_internals[i]);
148 _resizeItemsInternal(new_internals.
size());
156void MeshComponentData::
162 const bool do_lazy_evaluation =
true;
163 if (do_lazy_evaluation)
164 m_part_data->setNeedRecompute();
166 m_part_data->_setFromMatVarIndexes(m_variable_indexer->matvarIndexes(), queue);
172void MeshComponentData::
173_rebuildPartDataDirect()
175 RunQueue& queue = m_component->materialMng()->_internalApi()->runQueue();
176 m_part_data->_setFromMatVarIndexes(m_variable_indexer->matvarIndexes(), queue);
182void MeshComponentData::
185 if (!arcaneIsCheck())
188 info(4) <<
"Check valid component name=" << name();
189 m_variable_indexer->checkValid();
193 if (m_items!=m_variable_indexer->cells())
194 ARCANE_FATAL(
"Incoherent group for component name={0} data={1} indexer={2}",
195 name(),m_items.name(),m_variable_indexer->cells().name());
204 IItemFamily* family = m_items.itemFamily();
205 UniqueArray<Int32> presence(family->maxLocalId());
208 presence[iitem.itemLocalId()] = 1;
211 for( Integer i=0, n=indexer_local_ids.size(); i<n; ++i )
212 presence[indexer_local_ids[i]] += 2;
213 ItemInfoListView items_internal = family->itemInfoListView();
215 for( Integer i=0, n=presence.size(); i<n; ++i ){
216 Int32 v = presence[i];
219 Cell cell(items_internal[i]);
221 info(4) <<
"WARNING: Incoherence between group and internals "
222 <<
" component=" << name() <<
" v=" << v
223 <<
" cell=" << ItemPrinter(cell);
226 warning() <<
"WARNING: Incoherence between group and internals "
227 <<
" component=" << name() <<
" nb_error=" << nb_error;
233 ConstArrayView<MatVarIndex> mat_var_indexes(m_variable_indexer->matvarIndexes());
234 Integer nb_val = mat_var_indexes.size();
235 info(4) <<
"CheckValid component_name=" << name()
236 <<
" matvar_indexes=" << mat_var_indexes;
237 info(4) <<
"Cells=" << m_variable_indexer->cells().view().localIds();
238 for( Integer i=0; i<nb_val; ++ i){
239 MatVarIndex component_mvi = m_constituent_local_id_list.variableIndex(i);
240 MatVarIndex mvi = mat_var_indexes[i];
241 if (component_mvi!=mvi)
242 ARCANE_FATAL(
"Bad 'var_index' environment={3} component='{0}' direct='{1}' i={2}",
243 component_mvi,mvi,i,name());
247 m_part_data->checkValid();
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Integer size() const
Nombre d'éléments du vecteur.
File d'exécution pour un accélérateur.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
Vue constante d'un tableau de type T.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Index d'un Item dans une variable.
Interface d'un composant (matériau ou milieu) d'un maillage.
Données d'un constituant (matériau ou milieu) d'un maillage.
ConstituentItemLocalIdList m_constituent_local_id_list
Liste des ConstituentItemIndex pour ce constituant.
Vecteur 1D de données avec sémantique par valeur (style STL).
Active toujours les traces dans les parties Arcane concernant les matériaux.
Int32 Integer
Type représentant un entier.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
std::int16_t Int16
Type entier signé sur 16 bits.
std::int32_t Int32
Type entier signé sur 32 bits.