Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
VariableBuildInfo.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/* VariableBuildInfo.h (C) 2000-2024 */
9/* */
10/* Information for building a variable. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_VARIABLEBUILDINFO_H
13#define ARCANE_VARIABLEBUILDINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18#include "arcane/core/MeshHandle.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29class IModule;
30class ISubDomain;
31class IMesh;
32class IItemFamily;
33class IVariableMng;
34class VariablePrivate;
35class IDataFactoryMng;
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40/*!
41 * \brief Parameters necessary for building a variable.
42 */
43class ARCANE_CORE_EXPORT VariableBuildInfo
44{
45 public:
46
47 // To access the default constructor.
48 friend class NullVariableBuildInfo;
49 // TEMPORARY To access _subDomain(). To be removed later.
50 friend class VariablePrivate;
51
52 private:
53
54 //! Tag for a null VariableBuildInfo.
55 struct NullTag
56 {};
57
58 public:
59
60 /*!
61 * \brief Constructs an initializer for a variable.
62 *
63 * \param name variable name
64 * \param m associated module
65 * \param property variable properties
66 */
67 VariableBuildInfo(IModule* m, const String& name, int property = 0);
68
69 /*!
70 * \brief Constructs an initializer for a variable without associating it with
71 * a module.
72 *
73 * \param sub_domain subdomain manager
74 * \param name variable name
75 * \param property variable properties
76 */
77 VariableBuildInfo(ISubDomain* sub_domain, const String& name, int property = 0);
78
79 /*!
80 * \brief Constructs an initializer for a variable without associating it with
81 * a module.
82 *
83 * \param variable_mng variable manager
84 * \param name variable name
85 * \param property variable properties
86 */
87 VariableBuildInfo(IVariableMng* variable_mng, const String& name, int property = 0);
88
89 /*!
90 * \brief Constructs an initializer for a variable associated with a mesh other
91 * than the default mesh.
92 *
93 * \param mesh mesh
94 * \param name variable name
95 * \param property variable properties
96 */
97 VariableBuildInfo(IMesh* mesh, const String& name, int property = 0);
98
99 /*!
100 * \brief Constructs an initializer for a variable associated with a mesh other
101 * than the default mesh.
102 *
103 * \param mesh mesh
104 * \param name variable name
105 * \param property variable properties
106 */
107 VariableBuildInfo(const MeshHandle& mesh_handle, const String& name, int property = 0);
108
109 /*!
110 * \brief Constructs an initializer for a variable.
111 *
112 * \param m associated module
113 * \param name variable name
114 * \param item_family_name entity family name
115 * \param property variable properties
116 */
117 VariableBuildInfo(IModule* m, const String& name,
118 const String& item_family_name, int property = 0);
119
120 /*!
121 * \brief Constructs an initializer for a variable associated with a mesh
122 * other than the default mesh.
123 *
124 * \param mesh mesh
125 * \param name variable name
126 * \param item_family_name entity family name
127 * \param property variable properties
128 */
129 VariableBuildInfo(IMesh* mesh, const String& name,
130 const String& item_family_name, int property = 0);
131
132 /*!
133 * \brief Constructs an initializer for a variable associated with a mesh
134 * other than the default mesh.
135 *
136 * \param mesh mesh
137 * \param name variable name
138 * \param item_family_name entity family name
139 * \param property variable properties
140 */
141 VariableBuildInfo(const MeshHandle& mesh_handle, const String& name,
142 const String& item_family_name, int property = 0);
143
144 /*!
145 * \brief Constructs an initializer for a variable not associated with a mesh.
146 *
147 * \param sd subdomain
148 * \param name variable name
149 * \param mesh_name mesh name
150 * \param item_family_name entity family name
151 * \param property variable properties
152 */
153 VariableBuildInfo(ISubDomain* sd, const String& name, const String& mesh_name,
154 const String& item_family_name, int property = 0);
155
156 /*!
157 * \brief Constructs an initializer for a variable not associated with a mesh.
158 *
159 * \param variable_mng variable manager
160 * \param name variable name
161 * \param mesh_name mesh name
162 * \param item_family_name entity family name
163 * \param property variable properties
164 */
165 VariableBuildInfo(IVariableMng* variable_mng, const String& name, const String& mesh_name,
166 const String& item_family_name, int property = 0);
167
168 /*!
169 * \brief Constructs an initializer for a variable associated with a mesh
170 * other than the default mesh.
171 *
172 * \param family entity family
173 * \param name variable name
174 * \param property variable properties
175 */
176 VariableBuildInfo(IItemFamily* family, const String& name, int property = 0);
177
178 /*!
179 * \brief Constructs an initializer for a variable.
180 *
181 * \param m associated module
182 * \param name variable name
183 * \param item_family_name entity family name
184 * \param item_group_name associated group name (for partial variables)
185 * \param property variable properties
186 */
187 VariableBuildInfo(IModule* m, const String& name,
188 const String& item_family_name,
189 const String& item_group_name, int property = 0);
190
191 /*!
192 * \brief Constructs an initializer for a variable associated with a mesh
193 * other than the default mesh.
194 *
195 * \param mesh mesh
196 * \param name variable name
197 * \param item_family_name entity family name
198 * \param group_name associated group name (for partial variables)
199 * \param property variable properties
200 */
201 VariableBuildInfo(IMesh* mesh, const String& name,
202 const String& item_family_name,
203 const String& item_group_name, int property = 0);
204
205 /*!
206 * \brief Constructs an initializer for a variable associated with a mesh
207 * other than the default mesh.
208 *
209 * \param mesh mesh
210 * \param name variable name
211 * \param item_family_name entity family name
212 * \param group_name associated group name (for partial variables)
213 * \param property variable properties
214 */
215 VariableBuildInfo(const MeshHandle& mesh_handle, const String& name,
216 const String& item_family_name,
217 const String& item_group_name, int property = 0);
218
219 /*!
220 * \brief Constructs an initializer for a variable not associated with a mesh
221 *
222 * \param sd subdomain
223 * \param name variable name
224 * \param mesh_name mesh name
225 * \param item_family_name entity family name
226 * \param group_name associated group name (for partial variables)
227 * \param property variable properties
228 */
229 VariableBuildInfo(ISubDomain* sd, const String& name,
230 const String& mesh_name,
231 const String& item_family_name,
232 const String& item_group_name, int property = 0);
233
234 /*!
235 * \brief Constructs an initializer for a variable not associated with a mesh
236 *
237 * \param variable_mng variable manager
238 * \param name variable name
239 * \param mesh_name mesh name
240 * \param item_family_name entity family name
241 * \param group_name associated group name (for partial variables)
242 * \param property variable properties
243 */
244 VariableBuildInfo(IVariableMng* variable_mng, const String& name,
245 const String& mesh_name,
246 const String& item_family_name,
247 const String& item_group_name, int property = 0);
248
249 private:
250
251 explicit VariableBuildInfo(const NullTag&);
252
253 public:
254
255 ARCCORE_DEPRECATED_2020("Do not use this method. Try to get ISubDomain from another way")
256 ISubDomain* subDomain() const { return m_sub_domain; }
257
258 public:
259
260 IVariableMng* variableMng() const;
261 IDataFactoryMng* dataFactoryMng() const;
262 ITraceMng* traceMng() const;
263 IModule* module() const { return m_module; }
264 IMesh* mesh() const { return m_mesh_handle.mesh(); }
265 const MeshHandle& meshHandle() const { return m_mesh_handle; }
266 const String& name() const { return m_name; }
267 const String& itemFamilyName() const { return m_item_family_name; }
268 const String& itemGroupName() const { return m_item_group_name; }
269 const String& meshName() const { return m_mesh_name; }
270 int property() const { return m_property; }
271 bool isNull() const { return m_is_null; }
272
273 private:
274
275 ISubDomain* m_sub_domain = nullptr; //!< Subdomain manager
276 IModule* m_module = nullptr; //!< Module associated with the variable
277 MeshHandle m_mesh_handle; //!< Handle on the mesh
278 String m_name; //!< Variable name
279 String m_item_family_name; //!< Entity family name
280 String m_item_group_name; //!< Supported entity group name
281 String m_mesh_name; //!< Name of the mesh associated with the variable
282 int m_property = 0; //!< Variable properties
283 bool m_is_null = false;
284
285 private:
286
287 void _init();
288 ISubDomain* _subDomain() const { return m_sub_domain; }
289};
290
291/*---------------------------------------------------------------------------*/
292/*---------------------------------------------------------------------------*/
293
294/*!
295 * \brief Constructor for a null variable.
296 *
297 * \warning This class is experimental. Do not use it outside of Arcane.
298 */
299class ARCANE_CORE_EXPORT NullVariableBuildInfo
300: public VariableBuildInfo
301{
302 public:
303
304 NullVariableBuildInfo()
305 : VariableBuildInfo(NullTag{})
306 {}
307};
308
309/*---------------------------------------------------------------------------*/
310/*---------------------------------------------------------------------------*/
311
312} // End namespace Arcane
313
314/*---------------------------------------------------------------------------*/
315/*---------------------------------------------------------------------------*/
316
317#endif
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
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 --