Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MeshMaterialVariableIndexer.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/* MeshMaterialVariableIndexer.h (C) 2000-2024 */
9/* */
10/* Indexer for material variables. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MATERIALS_INTERNAL_MESHMATERIALVARIABLEINDEXER_H
13#define ARCANE_MATERIALS_INTERNAL_MESHMATERIALVARIABLEINDEXER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18#include "arcane/utils/Array.h"
19#include "arcane/utils/TraceAccessor.h"
20
22#include "arcane/core/ItemGroup.h"
23#include "arcane/core/materials/MatVarIndex.h"
24
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30namespace Arcane::Materials
31{
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
51class ARCANE_MATERIALS_EXPORT MeshMaterialVariableIndexer
52: public TraceAccessor
53{
54 friend class AllEnvData;
55 friend class MaterialModifierOperation;
56 friend class MeshEnvironment;
57 friend class MeshMaterial;
58 friend class MeshComponentData;
59 friend class MeshMaterialMng;
60 friend class IncrementalComponentModifier;
61 template <typename DataType> friend class ItemMaterialVariableScalar;
62
63 public:
64
65 MeshMaterialVariableIndexer(ITraceMng* tm, const String& name);
66
67 public:
68
70 const String& name() const { return m_name; }
71
78
79 Integer index() const { return m_index; }
80 ConstArrayView<MatVarIndex> matvarIndexes() const { return m_matvar_indexes; }
81 const CellGroup& cells() const { return m_cells; }
82 void checkValid();
84 bool isEnvironment() const { return m_is_environment; }
85 void dumpStats() const;
86
87 public:
88
89 // Public methods because they are used on accelerators
90 void endUpdateAdd(const ComponentItemListBuilder& builder, RunQueue& queue);
91 void endUpdateRemoveV2(ConstituentModifierWorkInfo& work_info, Integer nb_remove, RunQueue& queue);
92 void transformCells(ConstituentModifierWorkInfo& args, RunQueue& queue, bool is_from_env);
93
94 private:
95
97
98 void endUpdate(const ComponentItemListBuilderOld& builder);
99 Array<MatVarIndex>& matvarIndexesArray() { return m_matvar_indexes; }
100 void setCells(const CellGroup& cells) { m_cells = cells; }
101 void setIsEnvironment(bool is_environment) { m_is_environment = is_environment; }
102 void setIndex(Integer index) { m_index = index; }
103 Integer nbItem() const { return m_local_ids.size(); }
104 ConstArrayView<Int32> localIds() const { return m_local_ids; }
105
106 void changeLocalIds(Int32ConstArrayView old_to_new_ids);
107 void endUpdateRemove(ConstituentModifierWorkInfo& args, Integer nb_remove, RunQueue& queue);
109
110 private:
111 private:
112
115
118
121
124
127
137
139 bool m_is_environment = false;
140
143
151 Int32 m_nb_useless_remove_transform = 0;
152
155
156 private:
157
158 static void _changeLocalIdsV2(MeshMaterialVariableIndexer* var_indexer,
159 Int32ConstArrayView old_to_new_ids);
160 void _init();
161};
162
163/*---------------------------------------------------------------------------*/
164/*---------------------------------------------------------------------------*/
165
166} // End namespace Arcane::Materials
167
168/*---------------------------------------------------------------------------*/
169/*---------------------------------------------------------------------------*/
170
171#endif
Declarations of types on entities.
Base class for 1D data vectors.
Constant view of an array of type T.
Integer size() const
Number of elements in the group.
Definition ItemGroup.h:93
Helper class for building a list of ComponentItems for a MeshMaterialVariableIndexer.
Helper class for building a list of ComponentItems for a MeshMaterialVariableIndexer.
Working structure used during the modification of constituents (via MeshMaterialModifier).
Info about a material of a mesh.
bool m_is_print_useless_transform
Indicates whether a message is displayed during a useless transformation.
CellGroup m_cells
List of cells for this indexer.
Integer m_index
Index of this instance in the list of indexers.
bool m_is_environment
True if the indexer is associated with an environment.
bool isEnvironment() const
True if this indexer is for an environment.
Int32 m_nb_transform_called
Number of calls to transformation methods.
UniqueArray< MatVarIndex > m_matvar_indexes
List of indices for material variables.
UniqueArray< Int32 > m_local_ids
List of localId() of entities corresponding to m_matvar_indexes. NOTE: eventually,...
Int32 m_nb_useless_add_transform
Number of useless calls to transformation methods.
const String & name() const
Name of the indexer.
Integer m_max_index_in_multiple_array
Max index plus 1 in the multiple values array.
String m_name
Name of the material or environment.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
ItemGroupT< Cell > CellGroup
Group of cells.
Definition ItemTypes.h:184
Always enables tracing in Arcane parts concerning materials.
class ARCANE_MATERIALS_EXPORT(64) SimdMatVarIndex
SIMD indexer on a component.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
std::int32_t Int32
Signed integer type of 32 bits.