Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IVariable.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/* IVariable.h (C) 2000-2026 */
9/* */
10/* Interface of the Variable class. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IVARIABLE_H
13#define ARCANE_CORE_IVARIABLE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/serialize/SerializeGlobal.h"
18
19#include "arcane/utils/Ref.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31/*!
32 * \brief Interface of a variable.
33 *
34 * The implementation of this interface is the Variable class.
35 *
36 * Generally, this interface is not used directly. Variables are managed by
37 * the VariableRef class and its derived classes.
38 */
39class ARCANE_CORE_EXPORT IVariable
40{
41 public:
42
43 //! Dependency Type
45 {
46 DPT_PreviousTime,
47 DPT_CurrentTime
48 };
49
50 public:
51
52 /*!
53 * \brief Properties of a variable.
54 */
55 enum
56 {
57 /*!
58 * \brief Indicates that the variable should not be saved.
59 *
60 * This property is collective: it must be set on all subdomains (or on none).
61 */
62 PNoDump = (1 << 0),
63
64 /*!
65 * \brief Indicates that the variable is not necessarily synchronized.
66 *
67 * This means it is normal for the variable values to be different from
68 * one processor to another on ghost cells
69 */
70 PNoNeedSync = (1 << 1),
71
72 //! Indicates that the variable is traced (only in trace mode)
73 PHasTrace = (1 << 2),
74
75 /*! \brief Indicates that the variable value is dependent on the subdomain.
76 *
77 * This means, among other things, that the variable value is different
78 * as soon as the number of subdomains changes. This is, for example, the case
79 * of the variable containing the number of the subdomain owning an entity.
80 */
81 PSubDomainDepend = (1 << 3),
82
83 /*! \brief Indicates that the variable is private to the subdomain.
84 *
85 * This means that the variable is dependent on the subdomain and specifically
86 * that it does not necessarily exist on all subdomains. This
87 * property cannot be set for mesh variables.
88 */
90
91 /*! \brief Indicates that the variable value is dependent on the execution
92 *
93 * The values of these variables change between two executions. This is, for
94 * example, the case of a variable containing the CPU time used.
95 */
96 PExecutionDepend = (1 << 5),
97
98 /*! \brief Indicates that the variable is private
99 *
100 * A private variable cannot possess more than one reference.
101 * This property can only be set when the variable is created
102 */
103 PPrivate = (1 << 6),
104
105 /*! \brief Indicates that the variable is temporary
106 *
107 * A temporary variable is temporary, as its name suggests. It
108 * cannot be saved, is not transferred during mesh balancing (but can be
109 * synchronized), and is not saved during rollback.
110 *
111 * A temporary variable that is no longer used (no references to it)
112 * can be deallocated.
113 */
114 PTemporary = (1 << 7),
115
116 /*! \brief Indicates that the variable should not be restored.
117 *
118 * A variable of this type is neither saved nor restored during rollback.
119 */
120 PNoRestore = (1 << 8),
121
122 /*! \brief Indicates that the variable should not be exchanged.
123 *
124 * A variable of this type is not exchanged during mesh repartitioning, for
125 * example. This prevents the sending of unnecessary data
126 * if this variable is only used temporarily or
127 * if it is recalculated in one of the entry points called
128 * following a repartitioning.
129 */
130 PNoExchange = (1 << 9),
131
132 /*!
133 * \brief Indicates that the variable is persistent.
134 *
135 * A persistent variable is not destroyed even if there are no references
136 * to it anymore.
137 */
138 PPersistant = (1 << 10),
139
140 /*!
141 * \brief Indicates that the variable does not necessarily have the same value
142 * across replicas.
143 *
144 * This means it is normal for the variable values to be different on the same
145 * subdomains of other replicas.
146 */
147 PNoReplicaSync = (1 << 11),
148
149 /*!
150 * \brief Indicates that the variable must be allocated in shared memory.
151 *
152 * The MachineShMemWinMemoryAllocator will be used.
153 * The MachineShMemWinVariable class can be used with
154 * this variable.
155 */
156 PInShMem = (1 << 12),
157
158 /*!
159 * \brief Indicates that the save will be null for this variable and for
160 * this subdomain.
161 *
162 * A save will be performed, but with a default value
163 * (value = 0 for a scalar, empty array for an array).
164 *
165 * Only works for unsupported variables.
166 */
167 PDumpNull = (1 << 13)
168 };
169
170 public:
171
172 //! Tag used to indicate if a variable will be post-processed
173 static const char* TAG_POST_PROCESSING;
174
175 //! Tag used to indicate if a variable will be post-processed at this iteration
177
178 public:
179
180 friend class VariableMng;
181
182 public:
183
184 virtual ~IVariable() = default; //!< Frees resources
185
186 public:
187
188 //! Subdomain associated with the variable (TODO deprecate end of 2023)
189 virtual ISubDomain* subDomain() = 0;
190
191 public:
192
193 //! Variable manager associated with the variable
194 virtual IVariableMng* variableMng() const = 0;
195
196 //! Memory size (in Bytes) used by the variable
197 virtual Real allocatedMemory() const = 0;
198
199 //! Variable name
200 virtual String name() const = 0;
201
202 //! Full variable name (with family prefix)
203 virtual String fullName() const = 0;
204
205 //! Data type managed by the variable (Real, Integer, ...)
206 virtual eDataType dataType() const = 0;
207
208 /*!
209 * \brief Kind of mesh entities on which the variable is based.
210 *
211 * For scalar or array variables, there is no kind, and the
212 * method returns #IK_Unknown.
213 * For other variables, it returns the kind of the mesh element (Node, Cell, ...), namely:
214 * - #IK_Node for nodes
215 * - #IK_Edge for edges
216 * - #IK_Face for faces
217 * - #IK_Cell for cells
218 * - #IK_Particle for particles
219 * - #IK_DoF for degrees of freedom
220 */
221 virtual eItemKind itemKind() const = 0;
222
223 /*!
224 * \brief Dimension of the variable.
225 *
226 * The possible values are as follows:
227 * - 0 for a scalar variable.
228 * - 1 for a mono-dimensional array variable or a mesh scalar variable.
229 * - 2 for a bi-dimensional array variable or a mesh array variable.
230 */
231 virtual Integer dimension() const = 0;
232
233 /*!
234 * \brief Indicates if the variable is a multi-sized array.
235 *
236 * This value is only useful for 2D or higher arrays.
237 * - 0 for a scalar variable or standard 2D array.
238 * - 1 for a multi-sized 2D array variable.
239 * - 2 for an ancient format 2D array variable (obsolete).
240 */
241 virtual Integer multiTag() const = 0;
242
243 /*!
244 * \brief Number of elements of the variable.
245 *
246 * The returned values depend on the dimension of the variable:
247 * - for dimension 0, returns 1,
248 * - for dimension 1, returns the number of elements in the array
249 * - for dimension 2, returns the total number of elements by summing
250 * the number of elements per dimension.
251 */
252 virtual Integer nbElement() const = 0;
253
254 //! Returns the properties of the variable
255 virtual int property() const = 0;
256
257 //! Indicates that the properties of one of the references to this
258 //! variable have changed (internal)
260
261 /*!
262 * \brief Adds a reference to this variable
263 *
264 * \pre \a var_ref must not already reference a variable.
265 */
266 virtual void addVariableRef(VariableRef* var_ref) = 0;
267
268 /*!
269 * \brief Removes a reference to this variable
270 *
271 * \pre \a var_ref must reference this variable (an call to addVariableRef()
272 * must have been made on this variable).
273 */
274 virtual void removeVariableRef(VariableRef* var_ref) = 0;
275
276 //! First reference (or null) on this variable
277 virtual VariableRef* firstReference() const = 0;
278
279 //! Number of references on this variable
280 virtual Integer nbReference() const = 0;
281
282 public:
283
284 ARCANE_DEPRECATED_REASON("Y2021: This method is a noop")
285 virtual void setTraceInfo(Integer id, eTraceType tt) = 0;
286
287 public:
288
289 /*!
290 * \brief Sets the number of elements for an array variable.
291 *
292 * When the variable is a 1D or 2D array type, it sets the number
293 * of array elements to \a new_size. For a 2D array, the number
294 * of elements in the first dimension is modified.
295 *
296 * This operation must not be called for mesh variables
297 * because the number of elements is determined automatically based on the number
298 * of entities in the group it relies on. For this type of variable,
299 * resizeFromGroup() must be called.
300 *
301 * This operation synchronizes the references (syncReferences()).
302 */
303 virtual void resize(Integer new_size) = 0;
304
305 /*!
306 * \brief Sets the number of elements for a mesh variable.
307 *
308 * Reallocates the size of the mesh variable based on the group
309 * it relies on.
310 *
311 * This operation only has an effect on mesh variables.
312 * For others, no action is performed.
313 *
314 * This operation synchronizes the references (syncReferences()).
315 */
316 virtual void resizeFromGroup() = 0;
317
318 /*!
319 * \brief Frees any additional memory allocated for the data.
320 *
321 * This method is only useful for non-scalar variables
322 */
323 virtual void shrinkMemory() = 0;
324
325 //! Sets allocation information
326 virtual void setAllocationInfo(const DataAllocationInfo& v) = 0;
327
328 //! Allocation information
330
331 public:
332
333 /*!
334 * \brief Initializes the variable on a group.
335 *
336 * Initializes the variable with the value \a value for all elements of the
337 * group \a group.
338 *
339 * This operation is only usable with mesh variables.
340 *
341 * \param group_name group. It must correspond to an existing group
342 * of the variable's type (e.g., CellGroup for a cell variable).
343 * \param value initialization value. The string must be convertible
344 * to the variable's type.
345 *
346 * \retval true in case of error or if the variable is not a mesh variable.
347 * \retval false if the initialization is successful.
348 */
349 virtual bool initialize(const ItemGroup& group, const String& value) = 0;
350
351 //! @name Verification Operations
352 //@{
353 /*! \brief Checks if the variable is properly synchronized.
354 *
355 * This operation only works for mesh variables.
356 *
357 * A variable is synchronized when its values are the same
358 * across all subdomains, both on owned elements and ghost elements.
359 *
360 * For each unsynchronized element, a message is displayed.
361 *
362 * \param max_print maximum number of messages to display.
363 * If 0, no element is displayed. If positive, display at most
364 * \a max_print elements. If negative, all elements are displayed.
365 *
366 * \return the number of different reference values.
367 */
368 virtual Int32 checkIfSync(Integer max_print = 0) = 0;
369
370 /*! \brief Checks that the variable is identical to a reference value
371 *
372 * This operation checks that the variable values are identical
373 * to a reference value read from the reader \a reader.
374 *
375 * For each value different from the reference, a message is displayed.
376 *
377 * \param max_print maximum number of messages to display.
378 * If 0, no element is displayed. If positive, display at most
379 * \a max_print elements. If negative, all elements are displayed.
380 * \param compare_ghost if true, compares values both on owned entities
381 * and ghost entities. Otherwise, it only compares on owned entities.
382 *
383 * \return the number of different reference values.
384 */
385 virtual Int32 checkIfSame(IDataReader* reader, Integer max_print, bool compare_ghost) = 0;
386
387 /*!
388 * \brief Checks if the variable has the same values on all replicas.
389
390 *
391 * Compare the variable's values with those of the same subdomain
392 * of other replicas. For each different element,
393 * a message is displayed.
394 *
395 * This method is collective across the same subdomain as other replicas.
396 * Therefore, it should only be called if the variable exists on all subdomains
397 * otherwise it causes a blocking.
398 *
399 * This method only works for variables of numeric types.
400 * In this case, it throws a NotSupportedException.
401 *
402 * \param max_print maximum number of messages to display.
403 * If 0, no elements are displayed. If positive, displays at most
404 * \a max_print elements. If negative, all elements are displayed.
405 * For each different element, the minimum and
406 * maximum value is displayed.
407 *
408 * \return the number of different values of the reference.
409 */
410 virtual Int32 checkIfSameOnAllReplica(Integer max_print = 0) = 0;
411 //@}
412
413 /*!
414 * \brief Synchronizes the variable.
415 *
416 La synchronisation ne peut se faire que sur les variables du maillage.
417 */
418 virtual void synchronize() = 0;
419
420 // TODO: à rendre virtuelle pure (décembre 2024)
421 /*!
422 * \brief Synchronizes the variable on a list of entities.
423 *
424 * Synchronization can only be performed on mesh variables.
425 * Only the entities listed in \a local_ids will be synchronized. Note:
426 * an entity present in this list on one subdomain must be present
427 * in this list for any other subdomain that possesses this entity.
428 */
429 virtual void synchronize(Int32ConstArrayView local_ids);
430
431 /*!
432 * \brief Mesh associated with the variable.
433 *
434 * This operation is only meaningful for variables on
435 * mesh entities.
436 */
437 ARCCORE_DEPRECATED_2020("Use meshHandle() instead")
438 virtual IMesh* mesh() const = 0;
439
440 /*!
441 * \brief Mesh associated with the variable.
442 *
443 * This operation is only meaningful for variables on
444 * mesh entities.
445 */
446 virtual MeshHandle meshHandle() const = 0;
447
448 /*!
449 * \brief Associated mesh group.
450 *
451 * \return the associated mesh group if for a mesh variable
452 * or the null group if the variable is not a mesh variable.
453 *
454 * If a variable is not used or not yet allocated,
455 * the returned value is the null group.
456 * However, the variable can still be associated with a group.
457 * In this case, you must use the itemGroupName() function to
458 * retrieve the name of this group.
459 */
460 virtual ItemGroup itemGroup() const = 0;
461
462 //! Name of the associated entity group.
463 virtual String itemGroupName() const = 0;
464
465 /*!
466 * \brief Associated entity family.
467 *
468 * \return the family associated with the variable or 0
469 * if the variable has no family.
470 *
471 * If a variable is not used or not yet allocated,
472 * the returned value is null.
473 * However, the variable can still be associated with a family.
474 * In this case, you must use the itemFamilyName() function to
475 * retrieve the name of this family.
476 */
477 virtual IItemFamily* itemFamily() const = 0;
478
479 //! Name of the associated family (null if none).
480 virtual String itemFamilyName() const = 0;
481
482 //! Name of the associated mesh (null if none).
483 virtual String meshName() const = 0;
484
485 /*!
486 * \brief Creates an instance containing the variable's metadata.
487 *
488 * The returned instance must be destroyed by calling the delete operator.
489 */
490 ARCANE_DEPRECATED_REASON("Y2024: Use createMetaDataRef() instead")
491 virtual VariableMetaData* createMetaData() const = 0;
492
493 //! Creates an instance containing the variable's metadata.
495
496 /*!
497 * \brief Synchronizes references.
498 *
499 * Synchronizes the values of references (VariableRef) to this variable
500 * with the variable's current value. This method is called
501 * automatically when a scalar variable is modified or
502 * the number of elements of an array variable changes.
503 */
504 virtual void syncReferences() = 0;
505
506 public:
507
508 /*!
509 * \brief Sets the usage state of the variable
510 *
511 * If \v is false, the variable becomes unusable
512 * and all associated resources are released.
513 *
514 * If \v is true, the variable is considered used and if it is
515 * a mesh variable and setItemGroup() has not been called, the
516 * variable is allocated to the group of all entities.
517 */
518 virtual void setUsed(bool v) = 0;
519
520 //! Usage state of the variable
521 virtual bool isUsed() const = 0;
522
523 /*!
524 * \brief Indicates if the variable is partial.
525 *
526 * A variable is partial when it is not defined on all
527 * entities of a family. In this case, group()!=itemFamily()->allItems().
528 */
529 virtual bool isPartial() const = 0;
530
531 public:
532
533 /*!
534 * \brief Copies the values of entities numbered @a source into entities
535 * numbered @a destination
536 *
537 * @note This operation is internal to Arcane and must be done in
538 * conjunction with the entity family corresponding to this
539 * variable.
540 *
541 * @param source list of @b source localIds
542 * @param destination list of @b destination localIds
543 */
544 virtual void copyItemsValues(Int32ConstArrayView source, Int32ConstArrayView destination) = 0;
545
546 /*!
547 * \brief Copies the mean values of entities numbered
548 * @a first_source and @a second_source into entities numbered
549 * @a destination
550 *
551 * @param first_source list of @b localIds of the 1st source
552 * @param second_source list of @b localIds of the 2nd source
553 * @param destination list of @b destination localIds
554 */
555 virtual void copyItemsMeanValues(Int32ConstArrayView first_source,
556 Int32ConstArrayView second_source,
557 Int32ConstArrayView destination) = 0;
558
559 /*!
560 * \brief Compresses the variable's values.
561 *
562 * This operation is internal to Arcane and must be done in
563 * conjunction with the entity family corresponding to this
564 * variable.
565 */
566 virtual void compact(Int32ConstArrayView new_to_old_ids) = 0;
567
568 //! pH: EXPERIMENTAL
569 virtual void changeGroupIds(Int32ConstArrayView old_to_new_ids) = 0;
570
571 public:
572
573 //! Data associated with the variable
574 virtual IData* data() = 0;
575
576 //! Data associated with the variable
577 virtual const IData* data() const = 0;
578
579 //! Data factory associated with the variable
580 virtual IDataFactoryMng* dataFactoryMng() const = 0;
581
582 //! @name Serialization operations
583 //@{
584 /*! Serializes the variable.
585 *
586 * The \a operation is only meaningful in read mode (ISerializer::ModeGet)
587 */
588 virtual void serialize(ISerializer* sbuffer, IDataOperation* operation = 0) = 0;
589
590 /*!
591 * \brief Serializes the variable for identifiers \a ids.
592 *
593 * Serialization depends on the variable's dimension.
594 * For scalar variables (dimension=0), nothing is done.
595 * For array or mesh variables, \a ids corresponds to an array
596 * of first dimension indirection.
597 *
598 * The \a operation is only meaningful in read mode (ISerializer::ModeGet)
599 */
600 virtual void serialize(ISerializer* sbuffer, Int32ConstArrayView ids, IDataOperation* operation = 0) = 0;
601
602 /*!
603 * \brief Saves the variable
604 *
605 * \deprecated Should be replaced by the following code:
606 * \code
607 * IVariable* var;
608 * var->notifyBeginWrite();
609 * writer->write(var,var->data());
610 * \endcode
611 */
612 virtual ARCANE_DEPRECATED_2018 void write(IDataWriter* writer) = 0;
613
614 /*!
615 * Reads the variable.
616 *
617 * \deprecated Should be replaced by the following code:
618 * \code
619 * IVariable* var;
620 * reader->read(var,var->data());
621 * var->notifyEndRead();
622 * \endcode
623 */
624 virtual ARCANE_DEPRECATED_2018 void read(IDataReader* reader) = 0;
625
626 /*!
627 * \brief Notifies of external modification of data().
628 *
629 * Signals to the instance the end of a read operation that modified
630 * data(). This method must therefore be called as soon as a modification of
631 * data() has been performed. This method triggers the observables registered
632 * in readObservable().
633 */
634 virtual void notifyEndRead() = 0;
635
636 /*!
637 * \brief Notifies of the start of writing data().
638 *
639 * This method triggers the observables registered
640 * in writeObservable().
641 */
642 virtual void notifyBeginWrite() = 0;
643
644 /*!
645 * \brief Write observable.
646 *
647 * The observers registered in this observable are called
648 * before writing the variable (write operation).
649 */
651
652 /*! \brief Read observable.
653 *
654 * The observers registered in this observable are called
655 * after reading the variable (read operation).
656 */
658
659 /*! \brief Size change observable.
660 *
661 * The observers registered in this observable are called
662 * when the number of elements of the variable changes.
663 * This is the case, for example, after a remeshing for a cell variable
664 */
666 //@}
667
668 //@{ @name Tag Management
669 //! Adds the tag \a tagname with the value \a tagvalue
670 virtual void addTag(const String& tagname, const String& tagvalue) = 0;
671 /*! \brief Removes the tag \a tagname
672 *
673 * If the tag \a tagname is not in the list, nothing happens.
674 */
675 virtual void removeTag(const String& tagname) = 0;
676 //! \a true if the variable has the tag \a tagname
677 virtual bool hasTag(const String& tagname) = 0;
678 //! Value of the tag \a tagname. The string is null if the tag does not exist.
679 virtual String tagValue(const String& tagname) = 0;
680 //@}
681
682 public:
683
684 //! Prints the variable's values to the stream \a o
685 virtual void print(std::ostream& o) const = 0;
686
687 public:
688
689 //! @name Dependency Management
690 //@{
691 /*!
692 * \brief Recalculates the variable if necessary
693 *
694 * Through the dependency mechanism, this operation is called recursively
695 * on all variables that the instance depends on. The recalculation function
696 * computeFunction() is then called if it turns out that one of the variables
697 * it depends on has been modified more recently.
698 *
699 * \pre computeFunction() != 0
700 */
701 virtual void update() = 0;
702
703 virtual void update(Real wanted_time) = 0;
704
705 /*! \brief Indicates that the variable has just been updated.
706 *
707 * For correct dependency management, this property
708 * must be called every time a variable has been updated.
709 */
710 virtual void setUpToDate() = 0;
711
712 //! Time when the variable was updated
713 virtual Int64 modifiedTime() = 0;
714
715 //! Adds \a var to the list of dependencies
716 virtual void addDepend(IVariable* var, eDependType dt) = 0;
717
718 //! Adds \a var to the list of dependencies with trace info \a tinfo
719 virtual void addDepend(IVariable* var, eDependType dt, const TraceInfo& tinfo) = 0;
720
721 /*! \brief Removes \a var from the list of dependencies
722 */
723 virtual void removeDepend(IVariable* var) = 0;
724
725 /*!
726 * \brief Sets the variable's recalculation function.
727 *
728 * The specified function \a v must be allocated via the new operator.
729 * If a recalculation function already existed, it is destroyed
730 * (via the delete operator) and replaced by this one.
731 */
733
734 //! Function used to update the variable
736
737 /*!
738 * \brief Dependency information.
739 *
740 * Fills the array \a infos with dependency information.
741 */
742 virtual void dependInfos(Array<VariableDependInfo>& infos) = 0;
743 //@}
744
745 public:
746
747 ARCANE_DEPRECATED_REASON("Y2021: This method is a noop")
748 virtual IMemoryAccessTrace* memoryAccessTrace() const = 0;
749
750 /*!
751 * \brief Indicates that the variable is synchronized.
752 *
753 * This operation is collective.
754 */
755 virtual void setIsSynchronized() = 0;
756
757 /*!
758 * \brief Indicates that the variable is synchronized on the group \a item_group
759 *
760 * This operation is collective.
761 */
762 virtual void setIsSynchronized(const ItemGroup& item_group) = 0;
763
764 public:
765
766 //! Increments the modification counter and returns its value before modification
768
769 public:
770
771 //! Internal Arcane API
772 virtual IVariableInternal* _internalApi() = 0;
773};
774
775/*---------------------------------------------------------------------------*/
776/*---------------------------------------------------------------------------*/
777
778} // End namespace Arcane
779
780/*---------------------------------------------------------------------------*/
781/*---------------------------------------------------------------------------*/
782
783#endif
Declarations of types on entities.
Base class for 1D data vectors.
Information on data allocation.
Interface for reading variable data.
Definition IDataReader.h:35
Interface for writing variable data.
Definition IDataWriter.h:45
Interface of a data item.
Definition IData.h:34
Interface of an entity family.
Definition IItemFamily.h:83
Interface of the subdomain manager.
Definition ISubDomain.h:75
Interface of the functor class for recalculating a variable.
Variable manager interface.
Interface of a variable.
Definition IVariable.h:40
virtual Real allocatedMemory() const =0
Memory size (in Bytes) used by the variable.
virtual void changeGroupIds(Int32ConstArrayView old_to_new_ids)=0
pH: EXPERIMENTAL
virtual eDataType dataType() const =0
Data type managed by the variable (Real, Integer, ...).
virtual void addTag(const String &tagname, const String &tagvalue)=0
Adds the tag tagname with the value tagvalue.
eDependType
Dependency Type.
Definition IVariable.h:45
virtual String meshName() const =0
Name of the associated mesh (null if none).
virtual void print(std::ostream &o) const =0
Prints the variable's values to the stream o.
virtual void setIsSynchronized()=0
Indicates that the variable is synchronized.
virtual bool hasTag(const String &tagname)=0
true if the variable has the tag tagname
virtual void setUsed(bool v)=0
Sets the usage state of the variable.
virtual String itemFamilyName() const =0
Name of the associated family (null if none).
virtual VariableMetaData * createMetaData() const =0
Creates an instance containing the variable's metadata.
virtual void notifyEndRead()=0
Notifies of external modification of data().
virtual void setUpToDate()=0
Indicates that the variable has just been updated.
virtual String fullName() const =0
Full variable name (with family prefix).
@ PSubDomainDepend
Indicates that the variable value is dependent on the subdomain.
Definition IVariable.h:81
@ PNoExchange
Indicates that the variable should not be exchanged.
Definition IVariable.h:130
@ PNoReplicaSync
Indicates that the variable does not necessarily have the same value across replicas.
Definition IVariable.h:147
@ PTemporary
Indicates that the variable is temporary.
Definition IVariable.h:114
@ PInShMem
Indicates that the variable must be allocated in shared memory.
Definition IVariable.h:156
@ PExecutionDepend
Indicates that the variable value is dependent on the execution.
Definition IVariable.h:96
@ PHasTrace
Indicates that the variable is traced (only in trace mode).
Definition IVariable.h:73
@ PPrivate
Indicates that the variable is private.
Definition IVariable.h:103
@ PPersistant
Indicates that the variable is persistent.
Definition IVariable.h:138
@ PNoRestore
Indicates that the variable should not be restored.
Definition IVariable.h:120
@ PSubDomainPrivate
Indicates that the variable is private to the subdomain.
Definition IVariable.h:89
@ PNoNeedSync
Indicates that the variable is not necessarily synchronized.
Definition IVariable.h:70
@ PNoDump
Indicates that the variable should not be saved.
Definition IVariable.h:62
@ PDumpNull
Indicates that the save will be null for this variable and for this subdomain.
Definition IVariable.h:167
virtual ARCANE_DEPRECATED_2018 void read(IDataReader *reader)=0
virtual bool initialize(const ItemGroup &group, const String &value)=0
Initializes the variable on a group.
virtual int property() const =0
Returns the properties of the variable.
virtual Ref< VariableMetaData > createMetaDataRef() const =0
Creates an instance containing the variable's metadata.
virtual eItemKind itemKind() const =0
Kind of mesh entities on which the variable is based.
virtual Int64 modifiedTime()=0
Time when the variable was updated.
virtual Integer nbReference() const =0
Number of references on this variable.
virtual String tagValue(const String &tagname)=0
Value of the tag tagname. The string is null if the tag does not exist.
virtual void synchronize()=0
Synchronizes the variable.
virtual IDataFactoryMng * dataFactoryMng() const =0
Data factory associated with the variable.
virtual ~IVariable()=default
Frees resources.
virtual bool isPartial() const =0
Indicates if the variable is partial.
virtual Integer dimension() const =0
Dimension of the variable.
virtual void resizeFromGroup()=0
Sets the number of elements for a mesh variable.
virtual void notifyReferencePropertyChanged()=0
virtual void removeDepend(IVariable *var)=0
Removes var from the list of dependencies.
virtual IData * data()=0
Data associated with the variable.
virtual void syncReferences()=0
Synchronizes references.
virtual Int32 checkIfSync(Integer max_print=0)=0
Checks if the variable is properly synchronized.
virtual VariableRef * firstReference() const =0
First reference (or null) on this variable.
virtual bool isUsed() const =0
Usage state of the variable.
virtual void dependInfos(Array< VariableDependInfo > &infos)=0
Dependency information.
virtual ItemGroup itemGroup() const =0
Associated mesh group.
static Int64 incrementModifiedTime()
Increments the modification counter and returns its value before modification.
Definition Variable.cc:206
virtual Integer multiTag() const =0
Indicates if the variable is a multi-sized array.
virtual ARCANE_DEPRECATED_2018 void write(IDataWriter *writer)=0
Saves the variable.
virtual IVariableComputeFunction * computeFunction()=0
Function used to update the variable.
virtual Int32 checkIfSame(IDataReader *reader, Integer max_print, bool compare_ghost)=0
Checks that the variable is identical to a reference value.
virtual IMesh * mesh() const =0
Mesh associated with the variable.
virtual DataAllocationInfo allocationInfo() const =0
Allocation information.
virtual ISubDomain * subDomain()=0
Subdomain associated with the variable (TODO deprecate end of 2023).
virtual IObservable * readObservable()=0
Read observable.
virtual IObservable * onSizeChangedObservable()=0
Size change observable.
virtual void update()=0
Recalculates the variable if necessary.
static const char * TAG_POST_PROCESSING
Tag used to indicate if a variable will be post-processed.
Definition IVariable.h:173
virtual void compact(Int32ConstArrayView new_to_old_ids)=0
Compresses the variable's values.
virtual void addDepend(IVariable *var, eDependType dt)=0
Adds var to the list of dependencies.
virtual void notifyBeginWrite()=0
Notifies of the start of writing data().
virtual Int32 checkIfSameOnAllReplica(Integer max_print=0)=0
Checks if the variable has the same values on all replicas.
virtual void setComputeFunction(IVariableComputeFunction *v)=0
Sets the variable's recalculation function.
virtual IObservable * writeObservable()=0
Write observable.
virtual void copyItemsMeanValues(Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination)=0
Copies the mean values of entities numbered first_source and second_source into entities numbered des...
virtual void removeTag(const String &tagname)=0
Removes the tag tagname.
virtual void serialize(ISerializer *sbuffer, IDataOperation *operation=0)=0
virtual void setAllocationInfo(const DataAllocationInfo &v)=0
Sets allocation information.
virtual Integer nbElement() const =0
Number of elements of the variable.
virtual IItemFamily * itemFamily() const =0
Associated entity family.
virtual String itemGroupName() const =0
Name of the associated entity group.
virtual MeshHandle meshHandle() const =0
Mesh associated with the variable.
static const char * TAG_POST_PROCESSING_AT_THIS_ITERATION
Tag used to indicate if a variable will be post-processed at this iteration.
Definition IVariable.h:176
virtual void addVariableRef(VariableRef *var_ref)=0
Adds a reference to this variable.
virtual String name() const =0
Variable name.
virtual void removeVariableRef(VariableRef *var_ref)=0
Removes a reference to this variable.
virtual void copyItemsValues(Int32ConstArrayView source, Int32ConstArrayView destination)=0
Copies the values of entities numbered source into entities numbered destination.
virtual IVariableInternal * _internalApi()=0
Internal Arcane API.
virtual void shrinkMemory()=0
Frees any additional memory allocated for the data.
virtual IVariableMng * variableMng() const =0
Variable manager associated with the variable.
virtual void resize(Integer new_size)=0
Sets the number of elements for an array variable.
Mesh entity group.
Definition ItemGroup.h:51
Handle on a mesh.
Definition MeshHandle.h:48
Reference to an instance.
Information about a variable dependency.
Metadata on a variable.
Reference to a variable.
Definition VariableRef.h:56
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
eTraceType
Possible trace type.
Definition DataTypes.h:194
eItemKind
Mesh entity type.
double Real
Type representing a real number.
eDataType
Data type.
Definition DataTypes.h:41
std::int32_t Int32
Signed integer type of 32 bits.