Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
IncrementalComponentModifier.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/* IncrementalComponentModifier.h (C) 2000-2024 */
9/* */
10/* Incremental modification of constituents. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MATERIALS_INTERNAL_INCREMENTALCOMPONENTMODIFIER_H
13#define ARCANE_MATERIALS_INTERNAL_INCREMENTALCOMPONENTMODIFIER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18
20#include "arcane/materials/internal/MeshMaterialVariableIndexer.h"
21#include "arcane/materials/internal/ConstituentModifierWorkInfo.h"
22
23#include "arcane/accelerator/core/RunQueue.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane::Materials
29{
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
41class ARCANE_MATERIALS_EXPORT IncrementalComponentModifier
42: public TraceAccessor
43{
44 friend class MeshMaterialModifierImpl;
45
46 public:
47
48 IncrementalComponentModifier(AllEnvData* all_env_data, const RunQueue& queue);
49
50 public:
51
52 void initialize(bool is_debug);
53 void apply(MaterialModifierOperation* operation);
54 void finalize();
55 void setDoCopyBetweenPartialAndPure(bool v) { m_do_copy_between_partial_and_pure = v; }
56 void setDoInitNewItems(bool v) { m_do_init_new_items = v; }
57
58 private:
59
60 AllEnvData* m_all_env_data = nullptr;
61 MeshMaterialMng* m_material_mng = nullptr;
63 RunQueue m_queue;
64 bool m_do_copy_between_partial_and_pure = true;
65 bool m_do_init_new_items = true;
66 bool m_is_debug = false;
71
72 public:
73
74 void flagRemovedCells(SmallSpan<const Int32> local_ids, bool value_to_set);
75
76 public:
77
79 void _resetTransformedCells(SmallSpan<const Int32> ids);
80 void _addItemsToIndexer(MeshMaterialVariableIndexer* var_indexer,
81 SmallSpan<const Int32> local_ids);
82 void _removeItemsInGroup(ItemGroup cells, SmallSpan<const Int32> removed_ids);
85 void _applyInitializeWithZero(const InitializeWithZeroArgs& args);
86 void _computeItemsToAdd(ComponentItemListBuilder& list_builder, SmallSpan<const Int32> local_ids);
87
88 private:
89
90 void _switchCellsForEnvironments(const IMeshEnvironment* modified_env,
92 void _switchCellsForMaterials(const MeshMaterial* modified_mat,
96 SmallSpan<const Int32> local_ids, bool update_env_indexer);
98 SmallSpan<const Int32> local_ids, bool update_env_indexer);
100 void _resizeVariablesIndexer(Int32 var_index);
101};
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106} // namespace Arcane::Materials
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111#endif
Mesh entity group.
Definition ItemGroup.h:51
Information on environment values.
Definition AllEnvData.h:45
Helper class for building a list of ComponentItems for a MeshMaterialVariableIndexer.
Working structure used during the modification of constituents (via MeshMaterialModifier).
Arguments for methods copying between partial and global values.
void _switchCellsForMaterials(const MeshMaterial *modified_mat, SmallSpan< const Int32 > ids)
Transforms entities for an environment.
Int32 _computeCellsToTransformForEnvironments(SmallSpan< const Int32 > ids)
Calculates the cells to transform when modifying the cells of an environment.
void _switchCellsForEnvironments(const IMeshEnvironment *modified_env, SmallSpan< const Int32 > ids)
Transforms entities for environments.
void _applyCopyVariableViews(RunQueue &queue)
Performs the copy of views for variables.
bool m_force_multiple_command_for_resize
True if we force the use of a single command for resizing.
void _addItemsToEnvironment(MeshEnvironment *env, MeshMaterial *mat, SmallSpan< const Int32 > local_ids, bool update_env_indexer)
Adds the cells of an environment material.
void _applyCopyBetweenPartialsAndGlobals(const CopyBetweenPartialAndGlobalArgs &args, RunQueue &queue)
Performs the copy between partial and global values.
void _resizeVariablesIndexer(Int32 var_index)
Resizes the variable index var_index.
void _copyBetweenPartialsAndGlobals(const CopyBetweenPartialAndGlobalArgs &args)
Copies between partial and global values.
Int32 m_use_generic_copy_between_pure_and_partial
1 or 2 if we use a generic version for copies between pure and partial
Int32 _computeCellsToTransformForMaterial(const MeshMaterial *mat, SmallSpan< const Int32 > ids)
Calculates the cells to transform for material \at mat.
void _removeItemsFromEnvironment(MeshEnvironment *env, MeshMaterial *mat, SmallSpan< const Int32 > local_ids, bool update_env_indexer)
Removes cells of a material from the environment.
Arguments for methods copying between partial and global values.
Operation to add or remove cells from a material.
Implementation of a material manager.
View of an array of elements of type T.
Definition Span.h:805
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
Always enables tracing in Arcane parts concerning materials.
class ARCANE_MATERIALS_EXPORT(64) SimdMatVarIndex
SIMD indexer on a component.
std::int32_t Int32
Signed integer type of 32 bits.