14#include "arcane/materials/internal/ComponentItemInternalData.h"
16#include "arcane/utils/MemoryUtils.h"
18#include "arcane/core/IItemFamily.h"
19#include "arcane/core/internal/IItemFamilyInternal.h"
21#include "arcane/materials/internal/MeshMaterialMng.h"
35MemoryAllocationOptions ComponentItemInternalData::Storage::
36_allocInfo(
const MemoryAllocationOptions& alloc_info,
const String& base_name,
const String& name)
38 MemoryAllocationOptions opts(alloc_info);
39 opts.setArrayName(base_name + name);
46ComponentItemInternalData::Storage::
47Storage(
const MemoryAllocationOptions& alloc_info,
const String& base_name)
48: m_first_sub_constituent_item_id_list(_allocInfo(alloc_info, base_name,
"FirtSubComponentIdList"))
49, m_super_component_item_local_id_list(_allocInfo(alloc_info, base_name,
"SuperComponentIdList"))
50, m_component_id_list(_allocInfo(alloc_info, base_name,
"ComponentIdList"))
51, m_nb_sub_constituent_item_list(_allocInfo(alloc_info, base_name,
"NbSubConstituentItemList"))
52, m_global_item_local_id_list(_allocInfo(alloc_info, base_name,
"GlobalItemLocalIdList"))
53, m_var_index_list(_allocInfo(alloc_info, base_name,
"VarIndexList"))
60void ComponentItemInternalData::Storage::
61resize(
Int32 new_size, ComponentItemSharedInfo* shared_info, RunQueue& queue)
66 Int32 true_size = new_size + 1;
69 const bool force_resize =
false;
70 MemoryUtils::checkResizeArrayWithCapacity(m_first_sub_constituent_item_id_list, true_size, force_resize);
71 MemoryUtils::checkResizeArrayWithCapacity(m_super_component_item_local_id_list, true_size, force_resize);
72 MemoryUtils::checkResizeArrayWithCapacity(m_component_id_list, true_size, force_resize);
73 MemoryUtils::checkResizeArrayWithCapacity(m_nb_sub_constituent_item_list, true_size, force_resize);
74 MemoryUtils::checkResizeArrayWithCapacity(m_global_item_local_id_list, true_size, force_resize);
75 MemoryUtils::checkResizeArrayWithCapacity(m_var_index_list, true_size, force_resize);
77 auto first_sub_constituent_item_id_list = m_first_sub_constituent_item_id_list.smallSpan();
78 auto super_component_item_local_id_list = m_super_component_item_local_id_list.smallSpan();
79 auto component_id_list = m_component_id_list.smallSpan();
80 auto nb_sub_constituent_item_list = m_nb_sub_constituent_item_list.smallSpan();
81 auto global_item_local_id_list = m_global_item_local_id_list.smallSpan();
82 auto var_index_list = m_var_index_list.smallSpan();
90 shared_info->m_storage_size = new_size;
91 first_sub_constituent_item_id_list[0] = {};
92 component_id_list[0] = -1;
93 nb_sub_constituent_item_list[0] = 0;
94 global_item_local_id_list[0] = NULL_ITEM_LOCAL_ID;
95 var_index_list[0].reset();
97 shared_info->m_first_sub_constituent_item_id_data = first_sub_constituent_item_id_list.data() + 1;
98 shared_info->m_super_component_item_local_id_data = super_component_item_local_id_list.data() + 1;
99 shared_info->m_component_id_data = component_id_list.data() + 1;
101 shared_info->m_nb_sub_constituent_item_data = nb_sub_constituent_item_list.data() + 1;
102 shared_info->m_global_item_local_id_data = global_item_local_id_list.data() + 1;
103 shared_info->m_var_index_data = var_index_list.data() + 1;
114ComponentItemInternalData::
115ComponentItemInternalData(MeshMaterialMng* mmg)
116: TraceAccessor(mmg->traceMng())
118, m_shared_infos(MemoryUtils::getAllocatorForMostlyReadOnlyData())
119, m_all_env_storage(_allocOptions(),
"AllEnvStorage")
120, m_env_storage(_allocOptions(),
"EnvStorage")
121, m_mat_storage(_allocOptions(),
"MatStorage")
125 ComponentItemSharedInfo::_setNullInstance();
130 m_shared_infos.resize(3);
131 m_shared_infos.setDebugName(
"ComponentItemInternalDataSharedInfo");
137MemoryAllocationOptions ComponentItemInternalData::
140 return MemoryAllocationOptions(platform::getDefaultDataAllocator());
146void ComponentItemInternalData::
157void ComponentItemInternalData::
163 RunQueue queue(m_material_mng->runQueue());
170 const Int32
env_size = m_env_storage.size();
171 const Int32
mat_size = m_mat_storage.size();
192void ComponentItemInternalData::
195 RunQueue& queue(m_material_mng->runQueue());
197 auto environments = m_material_mng->trueEnvironments();
198 const Int32
nb_env = environments.size();
208 m_all_env_items_internal_range.setRange(0,
max_local_id);
220 info(4) <<
"ResizeStorage max_local_id=" <<
max_local_id
225 m_all_env_storage.resize(
max_local_id, allEnvSharedInfo(), queue);
230 _resetItemsInternal();
236void ComponentItemInternalData::
251 info_mat->m_components = m_material_mng->materialsAsComponents();
254 info_env->m_level = LEVEL_ENVIRONMENT;
256 info_env->m_components = m_material_mng->environmentsAsComponents();
264 info() <<
"EndCreate ComponentItemInternalData nb_mat=" <<
info_mat->m_components.size()
265 <<
" nb_env=" <<
info_env->m_components.size();
266 info() <<
"EndCreate ComponentItemInternalData mat_shared_info=" <<
info_mat
Types et macros pour gérer les boucles sur les accélérateurs.
#define RUNCOMMAND_SINGLE(...)
Boucle sur accélérateur pour exécution avec un seul thread.
#define RUNCOMMAND_LOOP1(iter_name, x1,...)
Boucle sur accélérateur avec arguments supplémentaires pour les réductions.
Permet de modifier l'asynchronisme de la file pendant la durée de vie de l'instance.
File d'exécution pour un accélérateur.
Interface d'une famille d'entités.
virtual IMesh * mesh() const =0
Maillage associé
virtual IItemFamilyInternal * _internalApi()=0
API interne à Arcane.
Structure interne partagée d'une entité de maillage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Interval des identifiants des constituants dans la liste des ComponentItemInternal.
Informations partagées sur les 'ComponentItem'.
Index d'une entité constituant dans la liste des entités constituants.
RunCommand makeCommand(const RunQueue &run_queue)
Créé une commande associée à la file run_queue.
Active toujours les traces dans les parties Arcane concernant les matériaux.
bool arcaneIsCheck()
Vrai si on est en mode vérification.