Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MeshMaterial.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* MeshMaterial.h (C) 2000-2025 */
9/* */
10/* Mesh material. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MATERIALS_INTERNAL_MESHMATERIAL_H
13#define ARCANE_MATERIALS_INTERNAL_MESHMATERIAL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18
19#include "arcane/core/ItemGroup.h"
20#include "arcane/core/materials/IMeshMaterial.h"
21#include "arcane/core/materials/MatItem.h"
22#include "arcane/core/materials/internal/IMeshComponentInternal.h"
23
24#include "arcane/materials/internal/MeshComponentData.h"
25#include "arcane/materials/internal/MeshMaterialVariableIndexer.h"
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30namespace Arcane::Materials
31{
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
37class MeshEnvironment;
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
51class MeshMaterial
52: public TraceAccessor
53, public IMeshMaterial
54{
55 class InternalApi
57 {
58 public:
59
60 explicit InternalApi(MeshMaterial* mat)
61 : m_material(mat)
62 {}
63
64 public:
65
67 {
68 return m_material->variableIndexer();
69 }
71 {
72 return m_material->constituentItemListView();
73 }
74 Int32 variableIndexerIndex() const override;
77
78 private:
79
80 MeshMaterial* m_material = nullptr;
81 };
82
83 public:
84
86 const String& name, Int16 mat_id);
87
88 public:
89
90 IMeshMaterialMng* materialMng() override { return m_material_mng; }
91 ITraceMng* traceMng() override { return TraceAccessor::traceMng(); }
92 MeshMaterialInfo* infos() const override { return m_infos; }
93 String name() const override { return m_data.name(); }
94 IMeshEnvironment* environment() const override;
95 CellGroup cells() const override;
96
97 MeshMaterialVariableIndexer* variableIndexer() const
98 {
99 return m_data.variableIndexer();
100 }
101
102 ConstituentItemLocalIdListView constituentItemListView() const
103 {
104 return m_data.constituentItemListView();
105 }
106
107 Int32 id() const override { return m_data.componentId(); }
108
109 IUserMeshMaterial* userMaterial() const override { return m_user_material; }
110 void setUserMaterial(IUserMeshMaterial* umm) override { m_user_material = umm; }
111
112 MatCell findMatCell(AllEnvCell c) const override;
113 ComponentCell findComponentCell(AllEnvCell c) const override;
114
115 MatItemVectorView matView() const override;
116 ComponentItemVectorView view() const override;
117
118 void checkValid() override;
119
120 bool isMaterial() const override { return true; }
121 bool isEnvironment() const override { return false; }
122 bool hasSpace(MatVarSpace space) const override { return space == MatVarSpace::MaterialAndEnvironment; }
123 IMeshMaterial* asMaterial() override { return this; }
124 IMeshEnvironment* asEnvironment() override { return nullptr; }
125
129
132 MatPartItemVectorView partMatItems(eMatPart part) const override;
133
135 {
136 m_data.setSpecificExecutionPolicy(policy);
137 }
139 {
140 return m_data.specificExecutionPolicy();
141 }
142
143 public:
144
145 IMeshComponentInternal* _internalApi() override { return &m_internal_api; }
146
147 public:
148
149 void setConstituentItem(Int32 index, ConstituentItemIndex id)
150 {
151 m_data._setConstituentItem(index, id);
152 }
153 Int16 componentId() const { return m_data.componentId(); }
154
155 public:
156
158
159 void build();
160 void resizeItemsInternal(Integer nb_item);
161 MeshComponentData* componentData() { return &m_data; }
162 MeshEnvironment* trueEnvironment() { return m_environment; }
163 const MeshEnvironment* trueEnvironment() const { return m_environment; }
165
166 private:
167
168 IMeshMaterialMng* m_material_mng = nullptr;
169 MeshMaterialInfo* m_infos = nullptr;
170 MeshEnvironment* m_environment = nullptr;
171 IUserMeshMaterial* m_user_material = nullptr;
172 MeshComponentData m_data;
173 MeshMaterial* m_non_const_this = nullptr;
174 InternalApi m_internal_api;
175};
176
177/*---------------------------------------------------------------------------*/
178/*---------------------------------------------------------------------------*/
179
180} // End namespace Arcane::Materials
181
182/*---------------------------------------------------------------------------*/
183/*---------------------------------------------------------------------------*/
184
185#endif
Arcane cell with material and environment information.
View over a vector of entities of a component.
Index of a constituent entity in the list of constituent entities.
View of a ConstituentItemLocalIdList instance.
Arcane internal API for 'IMeshComponent'.
Interface for the material and environment manager of a mesh.
Represents a material in a multi-material cell.
View over the impure part of the entities of a material.
View over a vector of entities of a material.
View over pure or partial entities of a material.
View over the pure part of the entities of a material.
Info about a material of a mesh.
ConstituentItemLocalIdListView constituentItemListView() const override
View of the constituent cells.
Ref< IConstituentItemVectorImpl > createItemVectorImpl() const override
Create an instance of the 'ConstituentItemVectorImpl' implementation.
MeshMaterialVariableIndexer * variableIndexer() const override
Indexer to access partial variables.
Int32 variableIndexerIndex() const override
Index to access partial variables.
void build()
Public functions but reserved for IMeshMaterialMng.
Int32 id() const override
Component identifier.
IMeshEnvironment * environment() const override
Environment to which this material belongs.
void setSpecificExecutionPolicy(Accelerator::eExecutionPolicy policy) override
Sets an execution policy for this constituent.
bool hasSpace(MatVarSpace space) const override
Indicates if the component is defined for space space.
MatItemVectorView matView() const override
View associated with this material.
ComponentImpurePartItemVectorView impureItems() const override
View on the list of impure (partial) entities of the component.
Accelerator::eExecutionPolicy specificExecutionPolicy() const override
Specific execution policy.
MatCell findMatCell(AllEnvCell c) const override
Cell of this material for cell c.
IMeshComponentInternal * _internalApi() override
Internal API.
bool isMaterial() const override
True if the component is a material.
ComponentPurePartItemVectorView pureItems() const override
View on the list of pure entities (associated with the global cell) of the component.
ComponentItemVectorView view() const override
View associated with this component.
ComponentCell findComponentCell(AllEnvCell c) const override
Cell of this component for cell c.
IMeshEnvironment * asEnvironment() override
Returns the component in the form of an IMeshMaterial.
IMeshMaterialMng * materialMng() override
Associated manager.
ComponentPartItemVectorView partItems(eMatPart part) const override
View on the pure or impure part of the component's entities.
MatPurePartItemVectorView pureMatItems() const override
View on the list of pure entities (associated with the global cell) of the material.
String name() const override
Component name.
void checkValid() override
Checks that the component is valid.
MatPartItemVectorView partMatItems(eMatPart part) const override
View on the pure or impure part of the material entities.
void setUserMaterial(IUserMeshMaterial *umm) override
Sets the associated user material.
MeshMaterialInfo * infos() const override
Material information.
MatImpurePartItemVectorView impureMatItems() const override
View on the list of impure (partial) entities of the material.
IUserMeshMaterial * userMaterial() const override
Associated user material.
IMeshMaterial * asMaterial() override
Returns the component in the form of an IMeshMaterial.
ITraceMng * traceMng() override
Associated trace manager.
CellGroup cells() const override
Group of cells for this material.
bool isEnvironment() const override
True if the component is an environment.
Reference to an instance.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
ITraceMng * traceMng() const
Trace manager.
ItemGroupT< Cell > CellGroup
Group of cells.
Definition ItemTypes.h:184
eExecutionPolicy
Execution policy for a Runner.
Always enables tracing in Arcane parts concerning materials.
MatVarSpace
Definition space for a material variable.
@ MaterialAndEnvironment
Variable having values on environments and materials.
eMatPart
Part of a component.
Int32 Integer
Type representing an integer.
std::int16_t Int16
Signed integer type of 16 bits.
std::int32_t Int32
Signed integer type of 32 bits.