Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MeshMaterialModifier.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* MeshMaterialModifier.cc (C) 2000-2024 */
9/* */
10/* Objet permettant de modifier les matériaux. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/materials/MeshMaterialModifier.h"
15
16#include "arcane/utils/ArrayView.h"
17#include "arcane/utils/TraceInfo.h"
18#include "arcane/utils/FatalErrorException.h"
19
20#include "arcane/core/materials/IMeshMaterialMng.h"
21#include "arcane/core/materials/internal/IMeshMaterialMngInternal.h"
22
23#include "arcane/materials/internal/MeshMaterialModifierImpl.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane::Materials
29{
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33MeshMaterialModifier::
34MeshMaterialModifier(IMeshMaterialMng* mm)
35: m_impl(mm->_internalApi()->modifier())
36, m_has_update(false)
37{
38 if (!m_impl)
39 ARCANE_FATAL("Can not create 'MeshMaterialModifier' because IMeshMaterialMng is not yet initialized");
40 m_impl->reset();
41}
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
45
46MeshMaterialModifier::
47~MeshMaterialModifier() ARCANE_NOEXCEPT_FALSE
48{
49 endUpdate();
50}
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58void MeshMaterialModifier::
59_checkHasUpdate()
60{
61 if (!m_has_update) {
62 m_impl->beginUpdate();
63 m_has_update = true;
64 }
65}
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70void MeshMaterialModifier::
72{
73 _checkHasUpdate();
74 m_impl->addCells(mat, ids);
75}
76
77/*---------------------------------------------------------------------------*/
78/*---------------------------------------------------------------------------*/
79
80void MeshMaterialModifier::
82{
83 _checkHasUpdate();
84 m_impl->removeCells(mat, ids);
85}
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
90void MeshMaterialModifier::
91endUpdate()
92{
93 if (m_has_update) {
94 // IMPORTANT: il faut mettre la m_has_update à \a false avant
95 // l'appel car si m_impl->endUpdate() lève une exception, on va rejouer
96 // la mise à jour dans le destructeur de cette classe.
97 m_has_update = false;
98 m_impl->endUpdate();
99 }
100}
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
105void MeshMaterialModifier::
106setDoCopyBetweenPartialAndPure(bool v)
107{
108 m_impl->setDoCopyBetweenPartialAndPure(v);
109}
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114void MeshMaterialModifier::
115setDoInitNewItems(bool v)
116{
117 m_impl->setDoInitNewItems(v);
118}
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123void MeshMaterialModifier::
124setPersistantWorkBuffer(bool v)
125{
126 m_impl->setPersistantWorkBuffer(v);
127}
128
129/*---------------------------------------------------------------------------*/
130/*---------------------------------------------------------------------------*/
131
132} // namespace Arcane::Materials
133
134/*---------------------------------------------------------------------------*/
135/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Interface d'un matériau d'un maillage.
Active toujours les traces dans les parties Arcane concernant les matériaux.