Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ConstituentModifierWorkInfo.cc
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/* Work structure used when modifying constituents. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/materials/internal/ConstituentModifierWorkInfo.h"
15
16#include "arcane/materials/internal/MaterialModifierOperation.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane::Materials
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27ConstituentModifierWorkInfo::
28ConstituentModifierWorkInfo(const MemoryAllocationOptions& opts, eMemoryRessource mem)
29: pure_local_ids(opts.allocator())
30, partial_indexes(opts.allocator())
31, cells_changed_in_env(opts)
32, cells_unchanged_in_env(opts)
33, m_saved_matvar_indexes(opts.allocator())
34, m_saved_local_ids(opts.allocator())
35, m_cells_current_nb_material(opts)
36, m_cells_is_partial(mem)
37, m_removed_local_ids_filter(mem)
38, m_cells_to_transform(mem)
39{
40 cells_changed_in_env.setDebugName("WorkInfoCellsChangedInEnv");
41 cells_unchanged_in_env.setDebugName("WorkInfoCellsUnchangedInEnv");
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47void ConstituentModifierWorkInfo::
48initialize(Int32 max_local_id, Int32 nb_material, Int32 nb_environment, RunQueue& queue)
49{
50 m_is_materials_modified.resizeHost(nb_material);
51 m_is_environments_modified.resizeHost(nb_environment);
52 m_cells_to_transform.resize(max_local_id);
53 m_cells_to_transform.fill(false, &queue);
54 m_removed_local_ids_filter.resize(max_local_id);
55 m_removed_local_ids_filter.fill(false, &queue);
56
57 m_saved_matvar_indexes.resizeHost(max_local_id);
58 m_saved_local_ids.resizeHost(max_local_id);
59
60 // Utilise toujours la mémoire du device pour le tableau contenant les données de copie
61 if (queue.isAcceleratorPolicy())
63}
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67
68void ConstituentModifierWorkInfo::
69setRemovedCells(ConstArrayView<Int32> local_ids, bool value)
70{
71 // Positions the deleted cells filter.
72 for (Int32 lid : local_ids)
73 m_removed_local_ids_filter[lid] = value;
74}
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79void ConstituentModifierWorkInfo::
80setCurrentOperation(MaterialModifierOperation* operation)
81{
82 m_is_add = operation->isAdd();
83}
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88} // namespace Arcane::Materials
89
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
bool isAcceleratorPolicy() const
Indicates if the instance is associated with an accelerator.
Definition RunQueue.cc:331
Constant view of an array of type T.
DualUniqueArray< MatVarIndex > m_saved_matvar_indexes
List of MatVarIndex and LocalId to save when deleting material cells.
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.
NumArray< CopyBetweenDataInfo, MDDim1 > m_variables_copy_data
Information for copies between partial and global values.
NumArray< bool, MDDim1 > m_cells_to_transform
Filter indicating the cells that must change status (Pure<->Partial).
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.
bool isAdd() const
Indicates whether the operation is to add or remove cells from the material.
Multi-dimensional arrays for numerical types accessible on accelerators.
Always enables tracing in Arcane parts concerning materials.
Arcane::eMemoryResource eMemoryRessource
Typedef for the historical Arcane version (with 2's').
std::int32_t Int32
Signed integer type of 32 bits.