14#include "arcane/utils/ArgumentException.h"
15#include "arcane/utils/NotImplementedException.h"
16#include "arcane/utils/Ref.h"
18#include "arcane/core/IMesh.h"
19#include "arcane/core/IItemFamily.h"
20#include "arcane/core/internal/ItemGroupImplInternal.h"
21#include "arcane/core/materials/internal/IMeshMaterialMngInternal.h"
23#include "arcane/materials/MeshMaterialInfo.h"
24#include "arcane/materials/IMeshMaterialMng.h"
25#include "arcane/materials/MatItemEnumerator.h"
26#include "arcane/materials/ComponentItemVectorView.h"
27#include "arcane/materials/ComponentPartItemVectorView.h"
29#include "arcane/materials/internal/MeshMaterial.h"
30#include "arcane/materials/internal/MeshEnvironment.h"
31#include "arcane/materials/internal/ConstituentItemVectorImpl.h"
32#include "arcane/materials/internal/MeshComponentPartData.h"
44MeshMaterial(MeshMaterialInfo* infos, MeshEnvironment* env,
45 const String& name, Int16 mat_id)
46: TraceAccessor(infos->materialMng()->traceMng())
47, m_material_mng(infos->materialMng())
50, m_user_material(nullptr)
51, m_data(this, name, mat_id, m_material_mng->_internalApi()->componentItemSharedInfo(LEVEL_MATERIAL), true)
52, m_non_const_this(this)
56 ARCANE_THROW(ArgumentException,
"null environement for material '{0}'", name);
68 IMesh* mesh = m_material_mng->mesh();
69 IItemFamily* cell_family = mesh->cellFamily();
70 String group_name = m_material_mng->name() +
"_" + name();
71 CellGroup items = cell_family->findGroup(group_name,
true);
73 m_data._setItems(items);
79IMeshEnvironment* MeshMaterial::
89findMatCell(AllEnvCell c)
const
91 Int32 mat_id = m_data.componentId();
92 for( EnvCell env_cell : c.subEnvItems() ) {
93 for( MatCell mc : env_cell.subMatItems()) {
94 Int32 mid = mc.materialId();
106ComponentCell MeshMaterial::
107findComponentCell(AllEnvCell c)
const
109 return findMatCell(c);
115MatItemVectorView MeshMaterial::
118 return { m_non_const_this, variableIndexer()->matvarIndexes(),
119 constituentItemListView(), variableIndexer()->localIds() };
125ComponentItemVectorView MeshMaterial::
135resizeItemsInternal(Integer nb_item)
137 m_data._resizeItemsInternal(nb_item);
155 return m_data.items();
161ComponentPurePartItemVectorView MeshMaterial::
164 return m_data._partData()->pureView();
170ComponentImpurePartItemVectorView MeshMaterial::
173 return m_data._partData()->impureView();
179ComponentPartItemVectorView MeshMaterial::
180partItems(eMatPart part)
const
182 return m_data._partData()->partView(part);
188MatPurePartItemVectorView MeshMaterial::
191 return { m_non_const_this, m_data._partData()->pureView() };
197MatImpurePartItemVectorView MeshMaterial::
198impureMatItems()
const
200 return { m_non_const_this, m_data._partData()->impureView() };
206MatPartItemVectorView MeshMaterial::
207partMatItems(eMatPart part)
const
209 return { m_non_const_this, m_data._partData()->partView(part) };
215Int32 MeshMaterial::InternalApi::
216variableIndexerIndex()
const
218 return variableIndexer()->index();
224Ref<IConstituentItemVectorImpl> MeshMaterial::InternalApi::
225createItemVectorImpl()
const
227 auto* x =
new ConstituentItemVectorImpl(m_material->m_non_const_this);
228 return makeRef<IConstituentItemVectorImpl>(x);
234Ref<IConstituentItemVectorImpl> MeshMaterial::InternalApi::
235createItemVectorImpl(ComponentItemVectorView rhs)
const
237 auto* x =
new ConstituentItemVectorImpl(rhs);
238 return makeRef<IConstituentItemVectorImpl>(x);
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
ItemGroupImplInternal * _internalApi() const
API interne à Arcane.
ItemGroupT< Cell > CellGroup
Groupe de mailles.
Active toujours les traces dans les parties Arcane concernant les matériaux.