Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::VariableRefScalarT< DataType > Class Template Reference

Reference to a scalar variable. More...

#include <arcane/core/VariableRefScalar.h>

Inheritance diagram for Arcane::VariableRefScalarT< DataType >:
Collaboration diagram for Arcane::VariableRefScalarT< DataType >:

Public Types

typedef DataType ElementType
 Type of the variable elements.
typedef VariableRef BaseClass
 Type of the base class.
typedef VariableScalarT< DataType > PrivatePartType
typedef VariableRefScalarT< DataType > ThatClass

Public Member Functions

 VariableRefScalarT (const VariableBuildInfo &b)
 Constructs a reference to a scalar variable specified in vb.
 VariableRefScalarT (const VariableRefScalarT< DataType > &rhs)
 Constructs a reference from rhs.
 VariableRefScalarT (IVariable *var)
 Constructs a reference from var.
void refersTo (const VariableRefScalarT< DataType > &rhs)
 Positions the instance's reference to the variable rhs.
virtual bool isArrayVariable () const
virtual Integer arraySize () const
 If the variable is an array, returns its dimension, otherwise returns 0.
virtual void updateFromInternal ()
 Updates from the internal part.
ArrayView< DataType > asArray ()
ConstArrayView< DataType > asArray () const
void operator= (const DataType &v)
VariableRefScalarT< DataType > & operator= (const VariableRefScalarT< DataType > &v)
void reset ()
 Resets the variable to its default value.
const DataType & operator() () const
 Scalar value.
const DataType & value () const
 Scalar value.
bool isEqual (const DataType &v) const
 Compares the variable with the value v.
bool isZero () const
 Compares the variable with the value 0.
bool isNearlyEqual (const DataType &v) const
 Compares the variable with the value v.
bool isNearlyZero () const
 Compares the variable with the value 0.
void assign (const DataType &v)
 Assigns the value v to the variable.
void reduce (Parallel::eReduceType type)
 Performs a type type reduction on the variable.
void swapValues (VariableRefScalarT< DataType > &rhs)
 Exchange the values of variable rhs with those of the instance.
Public Member Functions inherited from Arcane::VariableRef
virtual ~VariableRef ()
 Releases resources.
ISubDomainsubDomain () const
 Sub-domain associated with the variable (TODO deprecate end of 2023).
IVariableMngvariableMng () 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 IModulemodule () 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).
IVariablevariable () 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.
void setUsed (bool v)
bool isUsed () const
virtual void internalSetUsed (bool)
const StringassignmentStackTrace () 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.
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.
VariableRefpreviousReference ()
 Previous reference (or null) to variable().
VariableRefnextReference ()
 Next reference (or null) to variable().
void setPreviousReference (VariableRef *v)
 Sets the previous reference.
void setNextReference (VariableRef *v)
 Sets the next reference.

Protected Member Functions

 VariableRefScalarT ()
 Default constructor.
Protected Member Functions inherited from Arcane::VariableRef
 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.
VariableRefoperator= (const VariableRef &from)
 Copy assignment operator.
 VariableRef ()
 Default constructor.
void _setComputeFunction (IVariableComputeFunction *v)
void _internalInit (IVariable *)
 Internal initialization of the variable.
IVariable_variable () const
 Referenced variable.
void _executeUpdateFunctors ()
void _internalAssignVariable (const VariableRef &var)

Static Private Member Functions

static VariableTypeInfo _buildVariableTypeInfo ()
static VariableInfo _buildVariableInfo (const VariableBuildInfo &vbi)
static VariableRef_autoCreate (const VariableBuildInfo &vb)

Private Attributes

PrivatePartType * m_private_part

Static Private Attributes

static VariableFactoryRegisterer m_auto_registerer

Additional Inherited Members

static void setTraceCreation (bool v)
static bool hasTraceCreation ()
bool m_has_trace = false

Detailed Description

template<typename DataType>
class Arcane::VariableRefScalarT< DataType >

Reference to a scalar variable.

The operator operator()() allows access to the variable's value for read-only purposes. To modify the variable's value, you must use the assign() method or the operator operator=(). Note that assignment triggers a reference update and can be costly.

Definition at line 41 of file VariableRefScalar.h.

Member Typedef Documentation

◆ BaseClass

template<typename DataType>
typedef VariableRef Arcane::VariableRefScalarT< DataType >::BaseClass

Type of the base class.

Definition at line 49 of file VariableRefScalar.h.

◆ ElementType

template<typename DataType>
typedef DataType Arcane::VariableRefScalarT< DataType >::ElementType

Type of the variable elements.

Definition at line 47 of file VariableRefScalar.h.

◆ PrivatePartType

template<typename DataType>
typedef VariableScalarT<DataType> Arcane::VariableRefScalarT< DataType >::PrivatePartType

Definition at line 51 of file VariableRefScalar.h.

◆ ThatClass

template<typename DataType>
typedef VariableRefScalarT<DataType> Arcane::VariableRefScalarT< DataType >::ThatClass

Definition at line 53 of file VariableRefScalar.h.

Constructor & Destructor Documentation

◆ VariableRefScalarT() [1/4]

template<typename DataType>
Arcane::VariableRefScalarT< DataType >::VariableRefScalarT ( const VariableBuildInfo & b)
explicit

Constructs a reference to a scalar variable specified in vb.

Definition at line 72 of file VariableRefScalar.cc.

References Arcane::VariableRef::_internalInit(), and Arcane::VariableRef::VariableRef().

Referenced by refersTo(), swapValues(), and VariableRefScalarT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VariableRefScalarT() [2/4]

template<class DataType>
Arcane::VariableRefScalarT< DataType >::VariableRefScalarT ( const VariableRefScalarT< DataType > & rhs)

Constructs a reference from rhs.

Definition at line 96 of file VariableRefScalar.cc.

References updateFromInternal(), Arcane::VariableRef::VariableRef(), and VariableRefScalarT().

Here is the call graph for this function:

◆ VariableRefScalarT() [3/4]

template<typename DataType>
Arcane::VariableRefScalarT< DataType >::VariableRefScalarT ( IVariable * var)
explicit

Constructs a reference from var.

Definition at line 84 of file VariableRefScalar.cc.

References Arcane::VariableRef::_internalInit(), and Arcane::VariableRef::VariableRef().

Here is the call graph for this function:

◆ VariableRefScalarT() [4/4]

template<typename DataType>
Arcane::VariableRefScalarT< DataType >::VariableRefScalarT ( )
inlineprotected

Default constructor.

Definition at line 74 of file VariableRefScalar.h.

Member Function Documentation

◆ _autoCreate()

template<typename DataType>
VariableRef * Arcane::VariableRefScalarT< DataType >::_autoCreate ( const VariableBuildInfo & vb)
staticprivate

Definition at line 62 of file VariableRefScalar.cc.

◆ _buildVariableInfo()

template<typename DataType>
VariableInfo Arcane::VariableRefScalarT< DataType >::_buildVariableInfo ( const VariableBuildInfo & vbi)
staticprivate

Definition at line 50 of file VariableRefScalar.cc.

◆ _buildVariableTypeInfo()

template<typename DataType>
VariableTypeInfo Arcane::VariableRefScalarT< DataType >::_buildVariableTypeInfo ( )
staticprivate

Definition at line 40 of file VariableRefScalar.cc.

◆ arraySize()

template<typename DataType>
virtual Integer Arcane::VariableRefScalarT< DataType >::arraySize ( ) const
inlinevirtual

If the variable is an array, returns its dimension, otherwise returns 0.

Reimplemented from Arcane::VariableRef.

Definition at line 81 of file VariableRefScalar.h.

◆ asArray() [1/2]

template<typename DataType>
ArrayView< DataType > Arcane::VariableRefScalarT< DataType >::asArray ( )
inline

Definition at line 86 of file VariableRefScalar.h.

◆ asArray() [2/2]

template<typename DataType>
ConstArrayView< DataType > Arcane::VariableRefScalarT< DataType >::asArray ( ) const
inline

Definition at line 87 of file VariableRefScalar.h.

◆ assign()

template<typename DataType>
void Arcane::VariableRefScalarT< DataType >::assign ( const DataType & v)

Assigns the value v to the variable.

Definition at line 120 of file VariableRefScalar.cc.

Referenced by reduce(), and Arcane::VariableRefScalarT< Byte >::reset().

Here is the caller graph for this function:

◆ isArrayVariable()

template<typename DataType>
virtual bool Arcane::VariableRefScalarT< DataType >::isArrayVariable ( ) const
inlinevirtual

Definition at line 80 of file VariableRefScalar.h.

◆ isEqual()

template<typename DataType>
bool Arcane::VariableRefScalarT< DataType >::isEqual ( const DataType & v) const
inline

Compares the variable with the value v.

Definition at line 110 of file VariableRefScalar.h.

◆ isNearlyEqual()

template<typename DataType>
bool Arcane::VariableRefScalarT< DataType >::isNearlyEqual ( const DataType & v) const
inline

Compares the variable with the value v.

For a floating-point type, the comparison is done within an epsilon, defined in float_info<T>::nearlyEpsilon().

Definition at line 130 of file VariableRefScalar.h.

◆ isNearlyZero()

template<typename DataType>
bool Arcane::VariableRefScalarT< DataType >::isNearlyZero ( ) const
inline

Compares the variable with the value 0.

See also
isEqual().

Definition at line 138 of file VariableRefScalar.h.

◆ isZero()

template<typename DataType>
bool Arcane::VariableRefScalarT< DataType >::isZero ( ) const
inline

Compares the variable with the value 0.

See also
isEqual().

Definition at line 119 of file VariableRefScalar.h.

◆ operator()()

template<typename DataType>
const DataType & Arcane::VariableRefScalarT< DataType >::operator() ( ) const
inline

Scalar value.

Definition at line 102 of file VariableRefScalar.h.

◆ operator=() [1/2]

template<typename DataType>
void Arcane::VariableRefScalarT< DataType >::operator= ( const DataType & v)
inline

Definition at line 91 of file VariableRefScalar.h.

◆ operator=() [2/2]

template<typename DataType>
VariableRefScalarT< DataType > & Arcane::VariableRefScalarT< DataType >::operator= ( const VariableRefScalarT< DataType > & v)
inline

Definition at line 92 of file VariableRefScalar.h.

◆ reduce()

template<typename DataType>
void Arcane::VariableRefScalarT< DataType >::reduce ( Parallel::eReduceType type)

Performs a type type reduction on the variable.

Definition at line 149 of file VariableRefScalar.cc.

References assign(), and Arcane::VariableRef::variableMng().

Here is the call graph for this function:

◆ refersTo()

template<class DataType>
void Arcane::VariableRefScalarT< DataType >::refersTo ( const VariableRefScalarT< DataType > & rhs)

Positions the instance's reference to the variable rhs.

Definition at line 108 of file VariableRefScalar.cc.

References Arcane::VariableRef::operator=(), updateFromInternal(), and VariableRefScalarT().

Here is the call graph for this function:

◆ reset()

template<typename DataType>
void Arcane::VariableRefScalarT< DataType >::reset ( )
inline

Resets the variable to its default value.

Definition at line 99 of file VariableRefScalar.h.

Referenced by Arcane::TimeHistoryMngInternal::_fromLegacyFormat().

Here is the caller graph for this function:

◆ swapValues()

template<typename DataType>
void Arcane::VariableRefScalarT< DataType >::swapValues ( VariableRefScalarT< DataType > & rhs)

Exchange the values of variable rhs with those of the instance.

Definition at line 175 of file VariableRefScalar.cc.

References VariableRefScalarT().

Here is the call graph for this function:

◆ updateFromInternal()

template<typename T>
void Arcane::VariableRefScalarT< T >::updateFromInternal ( )
virtual

Updates from the internal part.

Reimplemented from Arcane::VariableRef.

Definition at line 162 of file VariableRefScalar.cc.

References Arcane::VariableRef::updateFromInternal().

Referenced by refersTo(), and VariableRefScalarT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ value()

template<typename DataType>
const DataType & Arcane::VariableRefScalarT< DataType >::value ( ) const
inline

Scalar value.

Definition at line 105 of file VariableRefScalar.h.

Member Data Documentation

◆ m_auto_registerer

template<typename DataType>
VariableFactoryRegisterer Arcane::VariableRefScalarT< DataType >::m_auto_registerer
staticprivate

Definition at line 158 of file VariableRefScalar.h.

◆ m_private_part

template<typename DataType>
PrivatePartType* Arcane::VariableRefScalarT< DataType >::m_private_part
private

Definition at line 154 of file VariableRefScalar.h.


The documentation for this class was generated from the following files: