Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::VariableRefArrayT< T > Class Template Reference

Array variable. More...

#include <arcane/core/VariableRefArray.h>

Inheritance diagram for Arcane::VariableRefArrayT< T >:
Collaboration diagram for Arcane::VariableRefArrayT< T >:

Public Types

typedef T DataType
typedef Array< T > ValueType
typedef ArrayView< T >::const_reference ConstReturnReferenceType
typedef ArrayView< T >::reference ReturnReferenceType
typedef DataType ElementType
 Type of the variable elements.
typedef VariableRef BaseClass
 Type of the base class.
typedef Array< DataType > ContainerType
 Type of the class managing the variable value.
typedef ArrayView< DataType > ArrayBase
 Type of the array allowing access to the variable.
typedef VariableArrayT< DataType > PrivatePartType
typedef VariableRefArrayT< DataType > ThatClass
typedef VariableRefArrayLockT< DataType > LockType
Public Types inherited from Arcane::ArrayView< T >
using ThatClass = ArrayView<T>
typedef T value_type
 Type of the array elements.
typedef value_typepointer
 Pointer type of an array element.
typedef const value_typeconst_pointer
 Constant pointer type of an array element.
typedef ArrayIterator< pointeriterator
 Type of the iterator over an array element.
typedef ArrayIterator< const_pointerconst_iterator
 Type of the constant iterator over an array element.
typedef value_typereference
 Reference type of an array element.
typedef const value_typeconst_reference
 Constant reference type of an array element.
typedef Integer size_type
 Type indexing the array.
typedef std::ptrdiff_t difference_type
 Type of a distance between array iterator elements.
typedef IterT< ArrayView< T > > iter
 Type of an iterator over the entire array.
typedef ConstIterT< ArrayView< T > > const_iter
 Type of a constant iterator over the entire array.
typedef std::reverse_iterator< iteratorreverse_iterator
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator

Public Member Functions

 VariableRefArrayT (const VariableBuildInfo &vb)
 Constructs a reference to a 1D array variable specified in vb.
 VariableRefArrayT (const VariableRefArrayT< DataType > &rhs)
 Constructs a reference from rhs.
 VariableRefArrayT (IVariable *var)
 Constructs a reference from var.
void refersTo (const VariableRefArrayT< DataType > &rhs)
 Positions the instance's reference to the variable rhs.
 ~VariableRefArrayT () override
 Frees resources.
virtual void resize (Integer new_size)
 Resizes the array to contain new_size elements.
virtual void resizeWithReserve (Integer new_size, Integer nb_additional)
 Resizes the array to contain new_size elements.
virtual bool isArrayVariable () const
Integer arraySize () const override
 If the variable is an array, returns its dimension, otherwise returns 0.
void updateFromInternal () override
 Updates from the internal part.
ArrayView< DataType > asArray ()
ConstArrayView< DataType > asArray () const
LockType lock ()
ContainerTypeinternalContainer ()
 Returns the container of this variable's values.
IArrayDataInternalT< T > * _internalTrueData ()
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.
Public Member Functions inherited from Arcane::ArrayView< T >
constexpr ArrayView () noexcept
 Constructs an empty view.
 ArrayView (const ArrayView< T > &from)=default
 Copy constructor from another view.
constexpr ArrayView (Integer asize, pointer ptr) noexcept
 Constructs a view over a memory region starting at ptr and.
template<std::size_t N>
constexpr ArrayView (std::array< T, N > &v)
ArrayView< T > & operator= (const ArrayView< T > &from)=default
 Copy assignment operator.
template<std::size_t N>
constexpr ArrayView< T > & operator= (std::array< T, N > &from)
constexpr reference operator[] (Integer i)
 i-th element of the array.
constexpr const_reference operator[] (Integer i) const
 i-th element of the array.
constexpr reference operator() (Integer i)
 i-th element of the array.
constexpr const_reference operator() (Integer i) const
 i-th element of the array.
constexpr const_reference item (Integer i) const
 i-th element of the array.
constexpr void setItem (Integer i, const_reference v)
 Sets the i-th element of the array.
constexpr Integer size () const noexcept
 Returns the size of the array.
constexpr Integer length () const noexcept
 Number of elements in the array.
constexpr iterator begin () noexcept
 Iterator to the first element of the array.
constexpr iterator end () noexcept
 Iterator to the first element after the end of the array.
constexpr const_iterator begin () const noexcept
 Constant iterator to the first element of the array.
constexpr const_iterator end () const noexcept
 Constant iterator to the first element after the end of the array.
constexpr reverse_iterator rbegin () noexcept
 Reverse iterator to the first element of the array.
constexpr const_reverse_iterator rbegin () const noexcept
 Reverse iterator to the first element of the array.
constexpr reverse_iterator rend () noexcept
 Reverse iterator to the first element after the end of the array.
constexpr const_reverse_iterator rend () const noexcept
 Reverse iterator to the first element after the end of the array.
ArrayRange< pointerrange ()
 Iteration range from the first to the last element.
ArrayRange< const_pointerrange () const
 Iteration range from the first to the last element.
constexpr pointer ptrAt (Integer index)
 Address of the index-th element.
constexpr const_pointer ptrAt (Integer index) const
 Address of the index-th element.
constexpr const_reference at (Integer i) const
void setAt (Integer i, const_reference value)
void fill (const T &o) noexcept
 Fills the array with the value o.
constexpr ConstArrayView< T > constView () const noexcept
 Constant view of this view.
constexpr ArrayView< T > subView (Integer abegin, Integer asize) noexcept
 Sub-view starting from element abegin and containing asize elements.
constexpr ThatClass subPart (Integer abegin, Integer asize) noexcept
 Sub-view starting from element abegin and containing asize elements.
constexpr ConstArrayView< T > subConstView (Integer abegin, Integer asize) const noexcept
 Constant sub-view starting from element abegin and containing asize elements.
constexpr ArrayView< T > subViewInterval (Integer index, Integer nb_interval)
 Sub-view corresponding to the interval index over nb_interval.
constexpr ThatClass subPartInterval (Integer index, Integer nb_interval)
 Sub-view corresponding to the interval index over nb_interval.
template<class U>
void copy (const U &copy_array)
 Copies the array copy_array into the instance.
constexpr bool empty () const noexcept
 Returns true if the array is empty (zero dimension).
bool contains (const_reference v) const
 true if the array contains the element with value v
void setArray (const ArrayView< T > &v) noexcept
constexpr pointer unguardedBasePointer () noexcept
 Pointer to the beginning of the view.
constexpr const_pointer unguardedBasePointer () const noexcept
 Constant pointer to the start of the view.
constexpr const_pointer data () const noexcept
 Pointer to the start of the view.
constexpr pointer data () noexcept
 Constant pointer to the start of the view.

Static Public Member Functions

static VariableTypeInfo _internalVariableTypeInfo ()
static VariableInfo _internalVariableInfo (const VariableBuildInfo &vbi)
static void setTraceCreation (bool v)
static bool hasTraceCreation ()
Static Public Member Functions inherited from Arcane::ArrayView< T >
static constexpr ThatClass create (pointer ptr, Integer asize) noexcept
 Constructs a view over a memory region starting at ptr and.

Static Private Member Functions

static VariableRef_autoCreate (const VariableBuildInfo &vb)

Private Attributes

PrivatePartType * m_private_part

Static Private Attributes

static VariableFactoryRegisterer m_auto_registerer

Additional Inherited Members

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)
Protected Member Functions inherited from Arcane::ArrayView< T >
constexpr pointer _ptr () noexcept
 Returns a pointer to the array.
constexpr const_pointer _ptr () const noexcept
 Returns a pointer to the array.
void _setArray (pointer v, Integer s) noexcept
 Modifies the pointer and size of the array.
void _setPtr (pointer v) noexcept
 Modifies the pointer to the start of the array.
void _setSize (Integer s) noexcept
 Modifies the size of the array.
bool m_has_trace = false

Detailed Description

template<typename T>
class Arcane::VariableRefArrayT< T >

Array variable.

Definition at line 37 of file VariableRefArray.h.

Member Typedef Documentation

◆ ArrayBase

template<typename T>
typedef ArrayView<DataType> Arcane::VariableRefArrayT< T >::ArrayBase

Type of the array allowing access to the variable.

Definition at line 55 of file VariableRefArray.h.

◆ BaseClass

template<typename T>
typedef VariableRef Arcane::VariableRefArrayT< T >::BaseClass

Type of the base class.

Definition at line 51 of file VariableRefArray.h.

◆ ConstReturnReferenceType

template<typename T>
typedef ArrayView<T>::const_reference Arcane::VariableRefArrayT< T >::ConstReturnReferenceType

Definition at line 45 of file VariableRefArray.h.

◆ ContainerType

template<typename T>
typedef Array<DataType> Arcane::VariableRefArrayT< T >::ContainerType

Type of the class managing the variable value.

Definition at line 53 of file VariableRefArray.h.

◆ DataType

template<typename T>
typedef T Arcane::VariableRefArrayT< T >::DataType

Definition at line 43 of file VariableRefArray.h.

◆ ElementType

template<typename T>
typedef DataType Arcane::VariableRefArrayT< T >::ElementType

Type of the variable elements.

Definition at line 49 of file VariableRefArray.h.

◆ LockType

template<typename T>
typedef VariableRefArrayLockT<DataType> Arcane::VariableRefArrayT< T >::LockType

Definition at line 61 of file VariableRefArray.h.

◆ PrivatePartType

template<typename T>
typedef VariableArrayT<DataType> Arcane::VariableRefArrayT< T >::PrivatePartType

Definition at line 57 of file VariableRefArray.h.

◆ ReturnReferenceType

template<typename T>
typedef ArrayView<T>::reference Arcane::VariableRefArrayT< T >::ReturnReferenceType

Definition at line 46 of file VariableRefArray.h.

◆ ThatClass

template<typename T>
typedef VariableRefArrayT<DataType> Arcane::VariableRefArrayT< T >::ThatClass

Definition at line 59 of file VariableRefArray.h.

◆ ValueType

template<typename T>
typedef Array<T> Arcane::VariableRefArrayT< T >::ValueType

Definition at line 44 of file VariableRefArray.h.

Constructor & Destructor Documentation

◆ VariableRefArrayT() [1/3]

template<typename DataType>
Arcane::VariableRefArrayT< DataType >::VariableRefArrayT ( const VariableBuildInfo & vb)
explicit

Constructs a reference to a 1D array variable specified in vb.

Definition at line 81 of file VariableRefArray.cc.

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

Referenced by refersTo(), and VariableRefArrayT().

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

◆ VariableRefArrayT() [2/3]

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

Constructs a reference from rhs.

Definition at line 93 of file VariableRefArray.cc.

References Arcane::ArrayView< T >::ArrayView(), updateFromInternal(), Arcane::VariableRef::VariableRef(), and VariableRefArrayT().

Here is the call graph for this function:

◆ VariableRefArrayT() [3/3]

template<class DataType>
Arcane::VariableRefArrayT< DataType >::VariableRefArrayT ( IVariable * var)
explicit

Constructs a reference from var.

Definition at line 106 of file VariableRefArray.cc.

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

Here is the call graph for this function:

◆ ~VariableRefArrayT()

template<typename DataType>
Arcane::VariableRefArrayT< DataType >::~VariableRefArrayT ( )
override

Frees resources.

Frees allocated memory.

Definition at line 133 of file VariableRefArray.cc.

Member Function Documentation

◆ _autoCreate()

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

Definition at line 71 of file VariableRefArray.cc.

◆ _internalTrueData()

template<typename T>
IArrayDataInternalT< T > * Arcane::VariableRefArrayT< T >::_internalTrueData ( )

Definition at line 195 of file VariableRefArray.cc.

References ARCANE_FATAL, Arcane::VariableRef::name(), Arcane::IVariable::PPrivate, and Arcane::VariableRef::property().

Referenced by internalContainer().

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

◆ _internalVariableInfo()

template<typename DataType>
VariableInfo Arcane::VariableRefArrayT< DataType >::_internalVariableInfo ( const VariableBuildInfo & vbi)
static

Definition at line 58 of file VariableRefArray.cc.

◆ _internalVariableTypeInfo()

template<typename DataType>
VariableTypeInfo Arcane::VariableRefArrayT< DataType >::_internalVariableTypeInfo ( )
static

Definition at line 47 of file VariableRefArray.cc.

◆ arraySize()

template<typename T>
Integer Arcane::VariableRefArrayT< T >::arraySize ( ) const
inlineoverridevirtual

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

Reimplemented from Arcane::VariableRef.

Definition at line 88 of file VariableRefArray.h.

◆ asArray() [1/2]

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

Definition at line 93 of file VariableRefArray.h.

◆ asArray() [2/2]

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

Definition at line 94 of file VariableRefArray.h.

◆ internalContainer()

template<typename T>
VariableRefArrayT< T >::ContainerType & Arcane::VariableRefArrayT< T >::internalContainer ( )

Returns the container of this variable's values.

Calling this method is only possible for private variables (PPrivate property). For others, an exception is raised (you must use lock()).

Definition at line 185 of file VariableRefArray.cc.

References _internalTrueData().

Here is the call graph for this function:

◆ isArrayVariable()

template<typename T>
virtual bool Arcane::VariableRefArrayT< T >::isArrayVariable ( ) const
inlinevirtual

Definition at line 87 of file VariableRefArray.h.

◆ lock()

template<typename DataType>
VariableRefArrayT< DataType >::LockType Arcane::VariableRefArrayT< DataType >::lock ( )

Definition at line 174 of file VariableRefArray.cc.

◆ refersTo()

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

Positions the instance's reference to the variable rhs.

Definition at line 118 of file VariableRefArray.cc.

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

Here is the call graph for this function:

◆ resize()

template<typename DataType>
void Arcane::VariableRefArrayT< DataType >::resize ( Integer new_size)
virtual

Resizes the array to contain new_size elements.

Definition at line 142 of file VariableRefArray.cc.

Referenced by Arcane::Hdf5VariableReaderHelper2::_createCorrespondance(), Arcane::TimeHistoryMngInternal::_fromLegacyFormat(), and Arcane::TimeHistoryValueT< DataType >::fromOldToNewVariables().

Here is the caller graph for this function:

◆ resizeWithReserve()

template<typename DataType>
void Arcane::VariableRefArrayT< DataType >::resizeWithReserve ( Integer new_size,
Integer nb_additional )
virtual

Resizes the array to contain new_size elements.

Definition at line 152 of file VariableRefArray.cc.

◆ updateFromInternal()

template<typename DataType>
void Arcane::VariableRefArrayT< DataType >::updateFromInternal ( )
overridevirtual

Updates from the internal part.

Reimplemented from Arcane::VariableRef.

Definition at line 162 of file VariableRefArray.cc.

References Arcane::VariableRef::updateFromInternal().

Referenced by refersTo(), and VariableRefArrayT().

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

Member Data Documentation

◆ m_auto_registerer

template<typename T>
VariableFactoryRegisterer Arcane::VariableRefArrayT< T >::m_auto_registerer
staticprivate

Definition at line 129 of file VariableRefArray.h.

◆ m_private_part

template<typename T>
PrivatePartType* Arcane::VariableRefArrayT< T >::m_private_part
private

Definition at line 125 of file VariableRefArray.h.


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