Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
VariableBuildInfo.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/* VariableBuildInfo.cc (C) 2000-2024 */
9/* */
10/* Information for building a variable. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/VariableBuildInfo.h"
15
16#include "arcane/utils/Iostream.h"
17
18#include "arcane/core/IModule.h"
19#include "arcane/core/ISubDomain.h"
20#include "arcane/core/IMesh.h"
21#include "arcane/core/IItemFamily.h"
22#include "arcane/core/IApplication.h"
23#include "arcane/core/IDataFactoryMng.h"
24#include "arcane/core/IVariableMng.h"
25#include "arcane/core/internal/IVariableMngInternal.h"
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30namespace Arcane
31{
32
33namespace
34{
36 _getSubDomainDeprecated(const MeshHandle& handle)
37 {
38 return handle.subDomain();
39 }
40} // namespace
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
46VariableBuildInfo(IModule* m, const String& name, int property)
47: m_sub_domain(m->subDomain())
48, m_module(m)
49, m_mesh_handle(m->defaultMeshHandle())
50, m_name(name)
51, m_property(property)
52{
53 _init();
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
60VariableBuildInfo(ISubDomain* sd, const String& name, int property)
61: m_sub_domain(sd)
62, m_name(name)
63, m_property(property)
64{
65 _init();
66}
67
68/*---------------------------------------------------------------------------*/
69/*---------------------------------------------------------------------------*/
70
72VariableBuildInfo(IVariableMng* variable_mng, const String& name, int property)
73: m_sub_domain(variable_mng->_internalApi()->internalSubDomain())
74, m_name(name)
75, m_property(property)
76{
77 _init();
78}
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
84VariableBuildInfo(const MeshHandle& mesh_handle, const String& name, int property)
85: m_sub_domain(_getSubDomainDeprecated(mesh_handle))
86, m_mesh_handle(mesh_handle)
87, m_name(name)
88, m_property(property)
89{
90 _init();
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
97VariableBuildInfo(IMesh* mesh, const String& name, int property)
98: VariableBuildInfo(mesh->handle(), name, property)
99{
100}
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
106VariableBuildInfo(IModule* m, const String& name,
107 const String& item_family_name, int property)
108: m_sub_domain(m->subDomain())
109, m_module(m)
110, m_mesh_handle(m->defaultMeshHandle())
111, m_name(name)
112, m_item_family_name(item_family_name)
113, m_property(property)
114{
115 _init();
116}
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
122VariableBuildInfo(const MeshHandle& mesh_handle, const String& name,
123 const String& item_family_name, int property)
124: m_sub_domain(_getSubDomainDeprecated(mesh_handle))
125, m_mesh_handle(mesh_handle)
126, m_name(name)
127, m_item_family_name(item_family_name)
128, m_property(property)
129{
130 _init();
131}
132
133/*---------------------------------------------------------------------------*/
134/*---------------------------------------------------------------------------*/
135
137VariableBuildInfo(IMesh* mesh, const String& name,
138 const String& item_family_name, int property)
139: VariableBuildInfo(mesh->handle(), name, item_family_name, property)
140{
141}
142
143/*---------------------------------------------------------------------------*/
144/*---------------------------------------------------------------------------*/
145
147VariableBuildInfo(ISubDomain* sd, const String& name, const String& mesh_name,
148 const String& item_family_name, int property)
149: m_sub_domain(sd)
150, m_name(name)
151, m_item_family_name(item_family_name)
152, m_mesh_name(mesh_name)
153, m_property(property)
154{
155 _init();
156}
157
158/*---------------------------------------------------------------------------*/
159/*---------------------------------------------------------------------------*/
160
162VariableBuildInfo(IVariableMng* variable_mng, const String& name, const String& mesh_name,
163 const String& item_family_name, int property)
164: m_sub_domain(variable_mng->_internalApi()->internalSubDomain())
165, m_name(name)
166, m_item_family_name(item_family_name)
167, m_mesh_name(mesh_name)
168, m_property(property)
169{
170 _init();
171}
172
173/*---------------------------------------------------------------------------*/
174/*---------------------------------------------------------------------------*/
175
177VariableBuildInfo(IItemFamily* family, const String& name, int property)
178: m_sub_domain(_getSubDomainDeprecated(family->mesh()->handle()))
179, m_mesh_handle(family->mesh()->handle())
180, m_name(name)
181, m_item_family_name(family->name())
182, m_property(property)
183{
184 _init();
185}
186
187/*---------------------------------------------------------------------------*/
188/*---------------------------------------------------------------------------*/
189
191VariableBuildInfo(IModule* m, const String& name,
192 const String& item_family_name,
193 const String& item_group_name, int property)
194: m_sub_domain(m->subDomain())
195, m_module(m)
196, m_mesh_handle(m->defaultMesh()->handle())
197, m_name(name)
198, m_item_family_name(item_family_name)
199, m_item_group_name(item_group_name)
200, m_property(property)
201{
202 _init();
203}
204
205/*---------------------------------------------------------------------------*/
206/*---------------------------------------------------------------------------*/
207
209VariableBuildInfo(const MeshHandle& mesh_handle, const String& name,
210 const String& item_family_name,
211 const String& item_group_name, int property)
212: m_sub_domain(_getSubDomainDeprecated(mesh_handle))
213, m_mesh_handle(mesh_handle)
214, m_name(name)
215, m_item_family_name(item_family_name)
216, m_item_group_name(item_group_name)
217, m_property(property)
218{
219 _init();
220}
221
222/*---------------------------------------------------------------------------*/
223/*---------------------------------------------------------------------------*/
224
226VariableBuildInfo(IMesh* mesh, const String& name,
227 const String& item_family_name,
228 const String& item_group_name, int property)
229: VariableBuildInfo(mesh->handle(), name, item_family_name, item_group_name, property)
230{
231}
232
233/*---------------------------------------------------------------------------*/
234/*---------------------------------------------------------------------------*/
235
237VariableBuildInfo(ISubDomain* sd, const String& name,
238 const String& mesh_name,
239 const String& item_family_name,
240 const String& item_group_name, int property)
241: m_sub_domain(sd)
242, m_name(name)
243, m_item_family_name(item_family_name)
244, m_item_group_name(item_group_name)
245, m_mesh_name(mesh_name)
246, m_property(property)
247{
248 _init();
249}
250
251/*---------------------------------------------------------------------------*/
252/*---------------------------------------------------------------------------*/
253
255VariableBuildInfo(IVariableMng* variable_mng, const String& name,
256 const String& mesh_name,
257 const String& item_family_name,
258 const String& item_group_name, int property)
259: m_sub_domain(variable_mng->_internalApi()->internalSubDomain())
260, m_name(name)
261, m_item_family_name(item_family_name)
262, m_item_group_name(item_group_name)
263, m_mesh_name(mesh_name)
264, m_property(property)
265{
266 _init();
267}
268
269/*---------------------------------------------------------------------------*/
270/*---------------------------------------------------------------------------*/
271
273VariableBuildInfo(const NullTag&)
274: m_is_null(true)
275{
276 _init();
277}
278
279/*---------------------------------------------------------------------------*/
280/*---------------------------------------------------------------------------*/
281
282void VariableBuildInfo::
283_init()
284{
285 if (!m_mesh_handle.isNull()) {
286 m_mesh_name = m_mesh_handle.meshName();
287 }
288}
289
290/*---------------------------------------------------------------------------*/
291/*---------------------------------------------------------------------------*/
292
293IVariableMng* VariableBuildInfo::
294variableMng() const
295{
296 ARCANE_CHECK_POINTER(m_sub_domain);
297 return m_sub_domain->variableMng();
298}
299
300/*---------------------------------------------------------------------------*/
301/*---------------------------------------------------------------------------*/
302
303IDataFactoryMng* VariableBuildInfo::
304dataFactoryMng() const
305{
306 ARCANE_CHECK_POINTER(m_sub_domain);
307 return m_sub_domain->application()->dataFactoryMng();
308}
309
310/*---------------------------------------------------------------------------*/
311/*---------------------------------------------------------------------------*/
312
313ITraceMng* VariableBuildInfo::
314traceMng() const
315{
316 ARCANE_CHECK_POINTER(m_sub_domain);
317 return m_sub_domain->traceMng();
318}
319
320/*---------------------------------------------------------------------------*/
321/*---------------------------------------------------------------------------*/
322
323} // End namespace Arcane
324
325/*---------------------------------------------------------------------------*/
326/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
Interface of an entity family.
Definition IItemFamily.h:83
Interface of a module.
Definition IModule.h:40
Interface of the subdomain manager.
Definition ISubDomain.h:75
Variable manager interface.
Handle on a mesh.
Definition MeshHandle.h:48
bool isNull() const
Indicates if the handle is null (it does not reference any existing mesh or not).
Definition MeshHandle.h:163
VariableBuildInfo(IModule *m, const String &name, int property=0)
Constructs an initializer for a variable.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --