Reference to a variable. More...
#include <arcane/core/VariableRef.h>
Classes | |
| class | UpdateNotifyFunctorList |
| Internal class to manage functors called when the variable is updated. More... | |
Public Member Functions | |
| virtual | ~VariableRef () |
| Releases resources. | |
| ISubDomain * | subDomain () const |
| Sub-domain associated with the variable (TODO deprecate end of 2023). | |
| IVariableMng * | variableMng () const |
| Variable manager associated with the variable. | |
| String | name () const |
| Variable name. | |
| virtual eDataType | dataType () const |
| Variable type (Real, Integer, ...). | |
| virtual void | print (std::ostream &o) const |
| Prints the variable value. | |
| virtual IModule * | module () const |
| Module associated with the variable (or nullptr, if none). | |
| virtual int | property () const |
| Variable properties. | |
| virtual int | referenceProperty () const |
| Reference properties (internal). | |
| virtual void | setProperty (int property) |
| Sets the property property. | |
| virtual void | unsetProperty (int property) |
| Unsets the property property. | |
| virtual void | registerVariable () |
| Registers the variable (internal). | |
| virtual void | unregisterVariable () |
| Unregisters the variable (internal). | |
| IVariable * | variable () const |
| Associated variable. | |
| virtual Integer | checkIfSync (int max_print=0) |
| Checks if the variable is synchronized. | |
| virtual Integer | checkIfSameOnAllReplica (int max_print=0) |
| Checks if the variable has the same values on all replicas. | |
| virtual void | updateFromInternal () |
| Updates from the internal part. | |
| virtual Integer | arraySize () const |
| If the variable is an array, returns its dimension, otherwise returns 0. | |
| void | setUsed (bool v) |
| bool | isUsed () const |
| virtual void | internalSetUsed (bool) |
| const String & | assignmentStackTrace () const |
| Call stack at the time of assigning this instance. | |
| void | addTag (const String &tagname, const String &tagvalue) |
| Adds the tag tagname with the value tagvalue. | |
| void | removeTag (const String &tagname) |
| Removes the tag tagname. | |
| bool | hasTag (const String &tagname) const |
| true if the variable has the tag tagname | |
| String | tagValue (const String &tagname) const |
| Value of the tag tagname. The string is null if the tag does not exist. | |
Protected Member Functions | |
| VariableRef (const VariableBuildInfo &vbi) | |
| Constructs a reference to a variable with the infos vbi. | |
| VariableRef (const VariableRef &from) | |
| Copy constructor. | |
| VariableRef (IVariable *var) | |
| Constructs a reference to a variable var. | |
| VariableRef & | operator= (const VariableRef &from) |
| Copy assignment operator. | |
| VariableRef () | |
| Default constructor. | |
Friends | |
| class | UpdateNotifyFunctorList |
Dependency Management | |
Operations related to variable dependency management. | |
| bool | m_has_trace = false |
| void | _setComputeFunction (IVariableComputeFunction *v) |
| void | _internalInit (IVariable *) |
| Internal initialization of the variable. | |
| IVariable * | _variable () const |
| Referenced variable. | |
| void | _executeUpdateFunctors () |
| void | _internalAssignVariable (const VariableRef &var) |
| void | update () |
| Recalculates the variable if necessary. | |
| void | setUpToDate () |
| Indicates that the variable has just been updated. | |
| Int64 | modifiedTime () |
| Time when the variable was updated. | |
| void | addDependCurrentTime (const VariableRef &var) |
| Adds var to the dependency list at the current time. | |
| void | addDependCurrentTime (const VariableRef &var, const TraceInfo &tinfo) |
| Adds var to the dependency list at the current time with trace info tinfo. | |
| void | addDependPreviousTime (const VariableRef &var) |
| Adds var to the dependency list at the previous time. | |
| void | addDependPreviousTime (const VariableRef &var, const TraceInfo &tinfo) |
| Adds var to the dependency list at the previous time with trace info tinfo. | |
| void | removeDepend (const VariableRef &var) |
| Removes var from the dependency list. | |
| template<typename ClassType> | |
| void | setComputeFunction (ClassType *instance, void(ClassType::*func)()) |
| Sets the variable's recalculation function. | |
| template<typename ClassType> | |
| void | setComputeFunction (ClassType *instance, void(ClassType::*func)(), const TraceInfo &tinfo) |
| Sets the variable's recalculation function. | |
| VariableRef * | previousReference () |
| Previous reference (or null) to variable(). | |
| VariableRef * | nextReference () |
| Next reference (or null) to variable(). | |
| void | setPreviousReference (VariableRef *v) |
| void | setNextReference (VariableRef *v) |
| static void | setTraceCreation (bool v) |
| static bool | hasTraceCreation () |
Reference to a variable.
This class manages a reference to a variable (IVariable).
If the variable is not associated with a module, the module() method returns 0.
This class must be derived.
The most derived class of this class must call _internalInit() in its constructor. Only it must do so, and in the constructor to ensure that the reference to the variable is valid as soon as the object is constructed and that the virtual methods that must be called during this initialization correspond to the instance being created.
Definition at line 55 of file VariableRef.h.
|
explicitprotected |
Constructs a reference to a variable with the infos vbi.
Definition at line 137 of file VariableRef.cc.
References module(), and property().
Referenced by addDependCurrentTime(), addDependCurrentTime(), addDependPreviousTime(), addDependPreviousTime(), Arcane::VariableRefArray2T< DataType >::internalContainer(), Arcane::VariableRefArrayT< DataType >::internalContainer(), Arcane::MeshVariableRef::MeshVariableRef(), nextReference(), operator=(), previousReference(), removeDepend(), Arcane::VariableRefScalarT< Byte >::swapValues(), VariableRef(), Arcane::VariableRefArray2T< T >::VariableRefArray2T(), Arcane::VariableRefArray2T< T >::VariableRefArray2T(), Arcane::VariableRefArray2T< T >::VariableRefArray2T(), Arcane::VariableRefArrayT< T >::VariableRefArrayT(), Arcane::VariableRefArrayT< T >::VariableRefArrayT(), Arcane::VariableRefArrayT< T >::VariableRefArrayT(), Arcane::VariableRefScalarT< DataType >::VariableRefScalarT(), Arcane::VariableRefScalarT< DataType >::VariableRefScalarT(), and Arcane::VariableRefScalarT< DataType >::VariableRefScalarT().
|
protected |
Copy constructor.
Definition at line 178 of file VariableRef.cc.
References registerVariable(), and VariableRef().
|
explicitprotected |
Constructs a reference to a variable var.
Definition at line 150 of file VariableRef.cc.
References property().
|
protected |
Default constructor.
Constructor for an unregistered variable.
This constructor is only used for C# wrapping. In C++, it is not accessible to ensure that the user does not have unreferenced variables
Definition at line 170 of file VariableRef.cc.
|
virtual |
|
protected |
Definition at line 619 of file VariableRef.cc.
|
protected |
Definition at line 629 of file VariableRef.cc.
|
protected |
Internal initialization of the variable.
Definition at line 261 of file VariableRef.cc.
References Arcane::IK_Unknown, registerVariable(), updateFromInternal(), and variable().
Referenced by Arcane::VariableRefArray2T< T >::VariableRefArray2T(), Arcane::VariableRefArray2T< T >::VariableRefArray2T(), Arcane::VariableRefArrayT< T >::VariableRefArrayT(), Arcane::VariableRefArrayT< T >::VariableRefArrayT(), Arcane::VariableRefScalarT< DataType >::VariableRefScalarT(), and Arcane::VariableRefScalarT< DataType >::VariableRefScalarT().
|
protected |
Definition at line 512 of file VariableRef.cc.
|
inlineprotected |
Referenced variable.
This method checks that a variable is properly referenced.
Definition at line 294 of file VariableRef.h.
| void Arcane::VariableRef::addDependCurrentTime | ( | const VariableRef & | var | ) |
Adds var to the dependency list at the current time.
Definition at line 467 of file VariableRef.cc.
References variable(), and VariableRef().
| void Arcane::VariableRef::addDependCurrentTime | ( | const VariableRef & | var, |
| const TraceInfo & | tinfo ) |
Adds var to the dependency list at the current time with trace info tinfo.
Definition at line 485 of file VariableRef.cc.
References variable(), and VariableRef().
| void Arcane::VariableRef::addDependPreviousTime | ( | const VariableRef & | var | ) |
Adds var to the dependency list at the previous time.
Definition at line 476 of file VariableRef.cc.
References variable(), and VariableRef().
| void Arcane::VariableRef::addDependPreviousTime | ( | const VariableRef & | var, |
| const TraceInfo & | tinfo ) |
Adds var to the dependency list at the previous time with trace info tinfo.
Definition at line 494 of file VariableRef.cc.
References variable(), and VariableRef().
Adds the tag tagname with the value tagvalue.
Definition at line 521 of file VariableRef.cc.
|
inlinevirtual |
If the variable is an array, returns its dimension, otherwise returns 0.
Reimplemented in Arcane::PrivateVariableArrayT< DataType >, Arcane::PrivateVariableArrayT< DataTypeT >, Arcane::PrivateVariableScalarT< DataType >, Arcane::PrivateVariableScalarT< DataTypeT >, Arcane::VariableRefArray2T< T >, Arcane::VariableRefArray2T< Byte >, Arcane::VariableRefArray2T< DataType >, Arcane::VariableRefArray2T< Int16 >, Arcane::VariableRefArray2T< Int32 >, Arcane::VariableRefArray2T< Int64 >, Arcane::VariableRefArray2T< Integer >, Arcane::VariableRefArray2T< Real >, Arcane::VariableRefArray2T< Real2 >, Arcane::VariableRefArray2T< Real2x2 >, Arcane::VariableRefArray2T< Real3 >, Arcane::VariableRefArray2T< Real3x3 >, Arcane::VariableRefArrayT< T >, Arcane::VariableRefArrayT< Byte >, Arcane::VariableRefArrayT< DataType >, Arcane::VariableRefArrayT< Int16 >, Arcane::VariableRefArrayT< Int32 >, Arcane::VariableRefArrayT< Int64 >, Arcane::VariableRefArrayT< Integer >, Arcane::VariableRefArrayT< Real >, Arcane::VariableRefArrayT< Real2 >, Arcane::VariableRefArrayT< Real2x2 >, Arcane::VariableRefArrayT< Real3 >, Arcane::VariableRefArrayT< Real3x3 >, Arcane::VariableRefArrayT< String >, Arcane::VariableRefScalarT< DataType >, Arcane::VariableRefScalarT< Byte >, Arcane::VariableRefScalarT< Int16 >, Arcane::VariableRefScalarT< Int32 >, Arcane::VariableRefScalarT< Int64 >, Arcane::VariableRefScalarT< Integer >, Arcane::VariableRefScalarT< Real >, Arcane::VariableRefScalarT< Real2 >, Arcane::VariableRefScalarT< Real2x2 >, Arcane::VariableRefScalarT< Real3 >, Arcane::VariableRefScalarT< Real3x3 >, and Arcane::VariableRefScalarT< String >.
Definition at line 143 of file VariableRef.h.
|
inline |
Call stack at the time of assigning this instance.
The stack is only accessible in verification or debug mode. If not, it returns a null string.
Definition at line 160 of file VariableRef.h.
|
virtual |
Checks if the variable has the same values on all replicas.
Definition at line 346 of file VariableRef.cc.
|
virtual |
Checks if the variable is synchronized.
Definition at line 336 of file VariableRef.cc.
|
virtual |
Variable type (Real, Integer, ...).
Definition at line 276 of file VariableRef.cc.
| bool Arcane::VariableRef::hasTag | ( | const String & | tagname | ) | const |
true if the variable has the tag tagname
Definition at line 539 of file VariableRef.cc.
|
static |
Definition at line 610 of file VariableRef.cc.
|
inlinevirtual |
Definition at line 150 of file VariableRef.h.
|
inline |
Definition at line 148 of file VariableRef.h.
| Int64 Arcane::VariableRef::modifiedTime | ( | ) |
Time when the variable was updated.
Definition at line 458 of file VariableRef.cc.
|
inlinevirtual |
Module associated with the variable (or nullptr, if none).
Definition at line 104 of file VariableRef.h.
Referenced by VariableRef().
| String Arcane::VariableRef::name | ( | ) | const |
Variable name.
Definition at line 296 of file VariableRef.cc.
| VariableRef * Arcane::VariableRef::nextReference | ( | ) |
Next reference (or null) to variable().
Definition at line 566 of file VariableRef.cc.
References VariableRef().
Referenced by Arcane::Variable::removeVariableRef().
|
protected |
Copy assignment operator.
Definition at line 196 of file VariableRef.cc.
References VariableRef().
Referenced by Arcane::VariableRefArray2T< T >::operator=(), Arcane::VariableRefArray2T< T >::refersTo(), Arcane::VariableRefArrayT< T >::refersTo(), Arcane::VariableRefScalarT< DataType >::refersTo(), and Arcane::PrivateVariableArrayT< DataTypeT >::updateFromInternal().
| VariableRef * Arcane::VariableRef::previousReference | ( | ) |
Previous reference (or null) to variable().
Definition at line 557 of file VariableRef.cc.
References VariableRef().
Referenced by Arcane::Variable::addVariableRef(), and Arcane::Variable::removeVariableRef().
|
virtual |
Prints the variable value.
Definition at line 286 of file VariableRef.cc.
|
virtual |
Variable properties.
Definition at line 306 of file VariableRef.cc.
Referenced by setProperty(), unsetProperty(), VariableRef(), and VariableRef().
|
virtual |
Reference properties (internal).
Definition at line 356 of file VariableRef.cc.
Referenced by Arcane::Variable::property().
|
virtual |
Registers the variable (internal).
Definition at line 250 of file VariableRef.cc.
Referenced by _internalInit(), and VariableRef().
| void Arcane::VariableRef::removeDepend | ( | const VariableRef & | var | ) |
Removes var from the dependency list.
Definition at line 503 of file VariableRef.cc.
References variable(), and VariableRef().
| void Arcane::VariableRef::removeTag | ( | const String & | tagname | ) |
Removes the tag tagname.
If the tag tagname is not in the list, nothing happens.
Definition at line 530 of file VariableRef.cc.
|
inline |
Sets the variable's recalculation function.
If a recalculation function already existed, it is destroyed and replaced by this one.
Definition at line 228 of file VariableRef.h.
|
inline |
Sets the variable's recalculation function.
If a recalculation function already existed, it is destroyed and replaced by this one. tinfo contains the information allowing to know where the function is defined (for debugging)
Definition at line 241 of file VariableRef.h.
| void Arcane::VariableRef::setNextReference | ( | VariableRef * | v | ) |
Definition at line 584 of file VariableRef.cc.
| void Arcane::VariableRef::setPreviousReference | ( | VariableRef * | v | ) |
Definition at line 575 of file VariableRef.cc.
|
virtual |
|
static |
Definition at line 601 of file VariableRef.cc.
| void Arcane::VariableRef::setUpToDate | ( | ) |
Indicates that the variable has just been updated.
For correct dependency management, this property must be called every time a variable update has been performed.
Definition at line 449 of file VariableRef.cc.
|
inline |
Definition at line 147 of file VariableRef.h.
| ISubDomain * Arcane::VariableRef::subDomain | ( | ) | const |
Sub-domain associated with the variable (TODO deprecate end of 2023).
Definition at line 316 of file VariableRef.cc.
Value of the tag tagname. The string is null if the tag does not exist.
Definition at line 548 of file VariableRef.cc.
|
virtual |
Unregisters the variable (internal).
Definition at line 239 of file VariableRef.cc.
Referenced by ~VariableRef().
|
virtual |
| void Arcane::VariableRef::update | ( | ) |
Recalculates the variable if necessary.
Through the dependency mechanism, this operation is called recursively on all variables that the instance depends on. The recalculation function computeFunction() is then called if it turns out that one of the variables it depends on has been modified more recently.
Definition at line 440 of file VariableRef.cc.
|
virtual |
Updates from the internal part.
Reimplemented in Arcane::MeshMatrixMDVariableRefT< ItemType, DataType, Row, Column, Extents >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, Extents >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, AddedFirstExtentsType >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, AddedFirstLastExtentsType >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, AddedFirstLastLastExtentsType >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, Extents::template AddedFirstExtentsType< DynExtent > >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, Extents::template AddedFirstLastExtentsType< DynExtent, Size > >, Arcane::MeshMDVariableRefBaseT< ItemType, DataType, Extents::template AddedFirstLastLastExtentsType< DynExtent, Row, Column > >, Arcane::MeshVectorMDVariableRefT< ItemType, DataType, Size, Extents >, Arcane::PrivateVariableArrayT< DataType >, Arcane::PrivateVariableArrayT< DataTypeT >, Arcane::PrivateVariableScalarT< DataType >, Arcane::PrivateVariableScalarT< DataTypeT >, Arcane::VariableRefArray2T< T >, Arcane::VariableRefArray2T< Byte >, Arcane::VariableRefArray2T< DataType >, Arcane::VariableRefArray2T< Int16 >, Arcane::VariableRefArray2T< Int32 >, Arcane::VariableRefArray2T< Int64 >, Arcane::VariableRefArray2T< Integer >, Arcane::VariableRefArray2T< Real >, Arcane::VariableRefArray2T< Real2 >, Arcane::VariableRefArray2T< Real2x2 >, Arcane::VariableRefArray2T< Real3 >, Arcane::VariableRefArray2T< Real3x3 >, Arcane::VariableRefArrayT< T >, Arcane::VariableRefArrayT< Byte >, Arcane::VariableRefArrayT< DataType >, Arcane::VariableRefArrayT< Int16 >, Arcane::VariableRefArrayT< Int32 >, Arcane::VariableRefArrayT< Int64 >, Arcane::VariableRefArrayT< Integer >, Arcane::VariableRefArrayT< Real >, Arcane::VariableRefArrayT< Real2 >, Arcane::VariableRefArrayT< Real2x2 >, Arcane::VariableRefArrayT< Real3 >, Arcane::VariableRefArrayT< Real3x3 >, Arcane::VariableRefArrayT< String >, Arcane::VariableRefScalarT< DataType >, Arcane::VariableRefScalarT< Byte >, Arcane::VariableRefScalarT< Int16 >, Arcane::VariableRefScalarT< Int32 >, Arcane::VariableRefScalarT< Int64 >, Arcane::VariableRefScalarT< Integer >, Arcane::VariableRefScalarT< Real >, Arcane::VariableRefScalarT< Real2 >, Arcane::VariableRefScalarT< Real2x2 >, Arcane::VariableRefScalarT< Real3 >, Arcane::VariableRefScalarT< Real3x3 >, and Arcane::VariableRefScalarT< String >.
Definition at line 365 of file VariableRef.cc.
Referenced by _internalInit(), Arcane::Variable::syncReferences(), Arcane::PrivateVariableArrayT< DataType >::updateFromInternal(), Arcane::PrivateVariableScalarT< DataType >::updateFromInternal(), Arcane::VariableRefArray2T< T >::updateFromInternal(), Arcane::VariableRefArrayT< T >::updateFromInternal(), and Arcane::VariableRefScalarT< DataType >::updateFromInternal().
|
inline |
Associated variable.
Definition at line 126 of file VariableRef.h.
Referenced by _internalInit(), addDependCurrentTime(), addDependCurrentTime(), addDependPreviousTime(), addDependPreviousTime(), Arcane::VariableUtils::markVariableAsMostlyReadOnly(), Arcane::Hdf5VariableReaderHelper::open(), Arcane::VariableUtils::prefetchVariableAsync(), removeDepend(), Arcane::Accelerator::viewIn(), Arcane::Accelerator::viewIn(), Arcane::Accelerator::viewIn(), Arcane::Accelerator::viewIn(), Arcane::Accelerator::viewIn(), Arcane::viewIn(), Arcane::viewIn(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::Accelerator::viewInOut(), Arcane::viewInOut(), Arcane::viewInOut(), Arcane::viewInOut(), Arcane::viewInOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::Accelerator::viewOut(), Arcane::viewOut(), Arcane::viewOut(), Arcane::viewOut(), and Arcane::viewOut().
| IVariableMng * Arcane::VariableRef::variableMng | ( | ) | const |
Variable manager associated with the variable.
Definition at line 326 of file VariableRef.cc.
Referenced by Arcane::VariableRefScalarT< DataType >::reduce().
|
friend |
Definition at line 60 of file VariableRef.h.
|
protected |
Definition at line 331 of file VariableRef.h.