Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ConstituentModifierWorkInfo.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/* ConstituentModifierWorkInfo.h (C) 2000-2024 */
9/* */
10/* Working structure used during the modification of constituents. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MATERIALS_INTERNAL_CONSTITUENTMODIFIERWORKINFO_H
13#define ARCANE_MATERIALS_INTERNAL_CONSTITUENTMODIFIERWORKINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/utils/DualUniqueArray.h"
19
20#include "arcane/core/materials/internal/IMeshMaterialVariableInternal.h"
22#include "arcane/materials/internal/MeshMaterialVariableIndexer.h"
23#include "arcane/materials/internal/ComponentItemListBuilder.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane::Materials
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
44class ARCANE_MATERIALS_EXPORT ConstituentModifierWorkInfo
45{
46 public:
47
48 ConstituentModifierWorkInfo(const MemoryAllocationOptions& opts, eMemoryRessource mem);
49
50 public:
51
72 bool is_verbose = false;
73
78
81 DualUniqueArray<Int32> m_saved_local_ids;
82
85
86 // Filter indicating if a cell will be partial after addition.
87 // This array is dimensioned by the number of cells added during the current transformation.
88 NumArray<bool, MDDim1> m_cells_is_partial;
89
90 ComponentItemListBuilder list_builder;
91
94
97
98 public:
99
101 void initialize(Int32 max_local_id, Int32 nb_material, Int32 nb_environment, RunQueue& queue);
102
103 public:
104
106 bool isTransformedCell(CellLocalId local_id) const
107 {
108 return m_cells_to_transform[local_id.localId()];
109 }
110
112 void setTransformedCell(CellLocalId local_id, bool v)
113 {
114 m_cells_to_transform[local_id.localId()] = v;
115 }
116
119 {
120 for (Int32 x : local_ids)
121 m_cells_to_transform[x] = false;
122 }
123
124 bool isRemovedCell(Int32 local_id) const { return m_removed_local_ids_filter[local_id]; }
125
127 void setRemovedCells(ConstArrayView<Int32> local_ids, bool value);
128
130 void setCurrentOperation(MaterialModifierOperation* operation);
131
133 bool isAdd() const { return m_is_add; }
134
135 SmallSpan<const bool> transformedCells() const { return m_cells_to_transform.to1DSmallSpan(); }
136 SmallSpan<bool> transformedCells() { return m_cells_to_transform.to1DSmallSpan(); }
137 SmallSpan<const bool> removedCells() const { return m_removed_local_ids_filter.to1DSmallSpan(); }
138 SmallSpan<bool> removedCells() { return m_removed_local_ids_filter.to1DSmallSpan(); }
139
140 private:
141
143 // This array is dimensioned by the number of cells.
145
147 // This array is dimensioned by the number of cells.
149
150 bool m_is_add = false;
151};
152
153/*---------------------------------------------------------------------------*/
154/*---------------------------------------------------------------------------*/
155
156} // namespace Arcane::Materials
157
158/*---------------------------------------------------------------------------*/
159/*---------------------------------------------------------------------------*/
160
161#endif
Constant view of an array of type T.
Represents an array having a view on both CPU and accelerator.
Helper class for building a list of ComponentItems for a MeshMaterialVariableIndexer.
UniqueArray< Int32 > cells_unchanged_in_env
List of cells of an environment that are already present in an environment during an operation.
UniqueArray< Int16 > m_cells_current_nb_material
Number of materials for the environment currently being evaluated.
DualUniqueArray< Int32 > pure_local_ids
List of pure cells of a constituent added/removed by the current operation.
void resetTransformedCells(ConstArrayView< Int32 > local_ids)
Sets the transformation status of the cell local_id for the current operation.
bool isRemovedCell(Int32 local_id) const
Indicates if the cell local_id is removed from the material for the current operation.
DualUniqueArray< MatVarIndex > m_saved_matvar_indexes
List of MatVarIndex and LocalId to save when deleting material cells.
bool isTransformedCell(CellLocalId local_id) const
Indicates if the cell local_id is transformed during the current operation.
UniqueArray< CopyBetweenDataInfo > m_host_variables_copy_data
Information for copies between partial and global values.
DualUniqueArray< bool > m_is_materials_modified
Array dimensioned by materials, which is true if a material is affected by the current modification.
NumArray< bool, MDDim1 > m_removed_local_ids_filter
Filter indicating the cells that are removed from the constituent.
UniqueArray< Int32 > cells_changed_in_env
List of cells of an environment that will be added or removed during an operation.
NumArray< CopyBetweenDataInfo, MDDim1 > m_variables_copy_data
Information for copies between partial and global values.
bool isAdd() const
Indicates if the current operation is an addition (true) or a removal (false) of cells.
void initialize(Int32 max_local_id, Int32 nb_material, Int32 nb_environment, RunQueue &queue)
Initializes the instance.
NumArray< bool, MDDim1 > m_cells_to_transform
Filter indicating the cells that must change status (Pure<->Partial).
DualUniqueArray< Int32 > partial_indexes
List of partial cells of a constituent added/removed by the current operation.
void setTransformedCell(CellLocalId local_id, bool v)
Sets the transformation status of the cell local_id for the current operation.
DualUniqueArray< bool > m_is_environments_modified
Array dimensioned by environments, which is true if an environment is affected by the current modific...
Operation to add or remove cells from a material.
Multi-dimensional arrays for numerical types accessible on accelerators.
View of an array of elements of type T.
Definition Span.h:805
1D data vector with value semantics (STL style).
Always enables tracing in Arcane parts concerning materials.
class ARCANE_MATERIALS_EXPORT(64) SimdMatVarIndex
SIMD indexer on a component.
Arcane::eMemoryResource eMemoryRessource
Typedef for the historical Arcane version (with 2's').
std::int32_t Int32
Signed integer type of 32 bits.