Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::VariableArrayT< T > Class Template Reference

Public Types

typedef Array< T > ValueType
typedef IArrayDataT< T > ValueDataType
typedef VariableArrayT< T > ThatClass
typedef Variable BaseClass
Public Types inherited from Arcane::IVariable
enum  eDependType { DPT_PreviousTime , DPT_CurrentTime }
 Dependency Type. More...
enum  {
  PNoDump = (1 << 0) , PNoNeedSync = (1 << 1) , PHasTrace = (1 << 2) , PSubDomainDepend = (1 << 3) ,
  PSubDomainPrivate = (1 << 4) , PExecutionDepend = (1 << 5) , PPrivate = (1 << 6) , PTemporary = (1 << 7) ,
  PNoRestore = (1 << 8) , PNoExchange = (1 << 9) , PPersistant = (1 << 10) , PNoReplicaSync = (1 << 11) ,
  PInShMem = (1 << 12) , PDumpNull = (1 << 13)
}
 Properties of a variable. More...

Public Member Functions

void synchronize () override
 Synchronizes the variable.
void synchronize (Int32ConstArrayView local_ids) override
 Synchronizes the variable on a list of entities.
virtual void resizeWithReserve (Integer n, Integer nb_additional)
Real allocatedMemory () const override
 Memory size (in Bytes) used by the variable.
bool initialize (const ItemGroup &group, const String &value) override
 Initializes the variable.
Integer nbElement () const override
 Number of elements of the variable.
ValueType & value ()
ConstArrayView< T > constValueView () const
ConstArrayView< T > valueView () const
ArrayView< T > valueView ()
void shrinkMemory () override
 Frees any additional memory allocated for the data.
Integer capacity ()
void copyItemsValues (Int32ConstArrayView source, Int32ConstArrayView destination) override
 Copies the values of entities numbered source into entities numbered destination.
void copyItemsMeanValues (Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination) override
 Copies the mean values of entities numbered first_source and second_source into entities numbered destination.
void compact (Int32ConstArrayView old_to_new_ids) override
 Compresses the variable's values.
void print (std::ostream &o) const override
 Prints the variable's values to the stream o.
void setIsSynchronized () override
 Indicates that the variable is synchronized.
void setIsSynchronized (const ItemGroup &item_group) override
 Indicates that the variable is synchronized on the group item_group.
IDatadata () override
 Data associated with the variable.
const IDatadata () const override
 Data associated with the variable.
virtual void fill (const T &v)
virtual void fill (const T &v, const ItemGroup &item_group)
void swapValues (ThatClass &rhs)
ValueDataType * trueData ()
void copyItemsMeanValues (Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination)
 Copies the mean values of entities numbered first_source and second_source into entities numbered destination.
void copyItemsMeanValues (Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination)
 Copies the mean values of entities numbered first_source and second_source into entities numbered destination.
Public Member Functions inherited from Arcane::Variable
 ~Variable () override
 Frees resources.
 Variable (const Variable &from)=delete
 Copy constructor (do not use).
Variableoperator= (const Variable &from)=delete
 Copy assignment operator (do not use).
ISubDomainsubDomain () override
 Subdomain associated with the variable (TODO deprecate end of 2023).
IVariableMngvariableMng () const override
 Variable manager associated with the variable.
String fullName () const final
 Full variable name (with family prefix).
String name () const final
 Variable name.
String itemFamilyName () const final
 Name of the associated family (null if none).
String meshName () const final
 Name of the associated mesh (null if none).
String itemGroupName () const final
 Name of the associated entity group.
int property () const override
void notifyReferencePropertyChanged () override
void setUsed (bool v) override
 Sets the usage state of the variable.
bool isUsed () const override
 Usage state of the variable.
bool isPartial () const override
 Indicates if the variable is partial.
void setTraceInfo (Integer, eTraceType) override
void read (IDataReader *d) override
void write (IDataWriter *d) override
 Saves the variable.
void notifyEndRead () override
 Notifies of external modification of data().
void notifyBeginWrite () override
 Notifies of the start of writing data().
void addVariableRef (VariableRef *ref) override
 Adds a reference to this variable.
void removeVariableRef (VariableRef *ref) override
 Removes a reference to this variable.
VariableReffirstReference () const override
 First reference (or null) on this variable.
Integer nbReference () const override
 Number of references on this variable.
VariableMetaDatacreateMetaData () const override
 Creates an instance containing the variable's metadata.
Ref< VariableMetaDatacreateMetaDataRef () const override
 Creates an instance containing the variable's metadata.
void syncReferences () override
 Synchronizes references.
IMeshmesh () const final
 Mesh associated with the variable.
MeshHandle meshHandle () const final
 Mesh associated with the variable.
ItemGroup itemGroup () const final
 Associated mesh group.
IItemFamilyitemFamily () const final
 Associated entity family.
eItemKind itemKind () const override
 Kind of mesh entities on which the variable is based.
Integer dimension () const override
 Dimension of the variable.
Integer multiTag () const override
 Indicates if the variable is a multi-sized array.
Int32 checkIfSync (Integer max_print) final
 Checks if the variable is properly synchronized.
Int32 checkIfSameOnAllReplica (Integer max_print) final
 Checks if the variable has the same values on all replicas.
Int32 checkIfSame (IDataReader *reader, Integer max_print, bool compare_ghost) final
 Checks that the variable is identical to a reference value.
eDataType dataType () const override
 Data type managed by the variable (Real, Integer, ...).
IDataFactoryMngdataFactoryMng () const final
 Data factory associated with the variable.
void serialize (ISerializer *sbuffer, IDataOperation *operation) override
void serialize (ISerializer *sbuffer, Int32ConstArrayView ids, IDataOperation *operation) override
 Serializes the variable for identifiers ids.
void resize (Integer n) override
 Sets the number of elements for an array variable.
void resizeFromGroup () override
 Sets the number of elements for a mesh variable.
void setAllocationInfo (const DataAllocationInfo &v) override
 Sets allocation information.
DataAllocationInfo allocationInfo () const override
 Allocation information.
IObservablewriteObservable () override
 Write observable.
IObservablereadObservable () override
 Read observable.
IObservableonSizeChangedObservable () override
 Size change observable.
void addTag (const String &tagname, const String &tagvalue) override
 Adds the tag tagname with the value tagvalue.
void removeTag (const String &tagname) override
 Removes the tag tagname.
bool hasTag (const String &tagname) override
 true if the variable has the tag tagname
String tagValue (const String &tagname) override
 Value of the tag tagname. The string is null if the tag does not exist.
void update () override
 Recalculates the variable if necessary.
void setUpToDate () override
 Indicates that the variable has just been updated.
Int64 modifiedTime () override
 Time when the variable was updated.
void addDepend (IVariable *var, eDependType dt) override
 Adds var to the list of dependencies.
void addDepend (IVariable *var, eDependType dt, const TraceInfo &tinfo) override
 Adds var to the list of dependencies with trace info tinfo.
void removeDepend (IVariable *var) override
 Removes var from the list of dependencies.
void setComputeFunction (IVariableComputeFunction *v) override
 Sets the variable's recalculation function.
IVariableComputeFunctioncomputeFunction () override
 Function used to update the variable.
void dependInfos (Array< VariableDependInfo > &infos) override
 Dependency information.
void update (Real wanted_time) override
void changeGroupIds (Int32ConstArrayView old_to_new_ids) override
 pH: EXPERIMENTAL
IVariableInternal * _internalApi () override
 Internal Arcane API.
IMemoryAccessTracememoryAccessTrace () const override
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const
Public Member Functions inherited from Arcane::IVariable
virtual ~IVariable ()=default
 Frees resources.

Static Public Member Functions

static ThatClass * getReference (IVariable *var)
static ThatClass * getReference (const VariableBuildInfo &v, const VariableInfo &vi)
static Int64 incrementModifiedTime ()
 Increments the modification counter and returns its value before modification.

Protected Member Functions

 VariableArrayT (const VariableBuildInfo &v, const VariableInfo &vi)
 Construit une variable basée sur la référence v.
void _internalResize (const VariableResizeArgs &resize_args) override
VariableComparerResults _compareVariable (const VariableComparerArgs &compare_args) final
 Comparison of values between variables.
Protected Member Functions inherited from Arcane::Variable
 Variable (const VariableBuildInfo &v, const VariableInfo &vi)
 Creates a variable linked to the reference v.
void _setProperty (int property)
void _setData (const Ref< IData > &data)
 Positions the data.
void _setValidData (bool valid_data)
 Indicates if the variable data is valid.
bool _hasValidData () const
 Indicates if the variable data is valid.
void _checkSwapIsValid (Variable *rhs)
 Checks if it is possible to swap the values of the instance with those of rhs.
bool _wantShrink () const
void _resize (const VariableResizeArgs &resize_args)
Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Additional Inherited Members

Static Public Attributes inherited from Arcane::IVariable
static const char * TAG_POST_PROCESSING = "PostProcessing"
 Tag used to indicate if a variable will be post-processed.
static const char * TAG_POST_PROCESSING_AT_THIS_ITERATION = "PostProcessingAtThisIteration"
 Tag used to indicate if a variable will be post-processed at this iteration.

Detailed Description

template<class T>
class Arcane::VariableArrayT< T >

Definition at line 35 of file VariableArray.h.

Member Typedef Documentation

◆ BaseClass

template<class T>
typedef Variable Arcane::VariableArrayT< T >::BaseClass

Definition at line 43 of file VariableArray.h.

◆ ThatClass

template<class T>
typedef VariableArrayT<T> Arcane::VariableArrayT< T >::ThatClass

Definition at line 42 of file VariableArray.h.

◆ ValueDataType

template<class T>
typedef IArrayDataT<T> Arcane::VariableArrayT< T >::ValueDataType

Definition at line 41 of file VariableArray.h.

◆ ValueType

template<class T>
typedef Array<T> Arcane::VariableArrayT< T >::ValueType

Definition at line 40 of file VariableArray.h.

Constructor & Destructor Documentation

◆ VariableArrayT()

template<typename T>
Arcane::VariableArrayT< T >::VariableArrayT ( const VariableBuildInfo & v,
const VariableInfo & vi )
protected

Construit une variable basée sur la référence v.

Definition at line 307 of file VariableArray.cc.

References Arcane::Variable::_setData(), ARCANE_CHECK_POINTER, data(), Arcane::TraceAccessor::info(), Arcane::makeRef(), and Arcane::Variable::Variable().

◆ ~VariableArrayT()

template<typename T>
Arcane::VariableArrayT< T >::~VariableArrayT ( )
override

Definition at line 324 of file VariableArray.cc.

Member Function Documentation

◆ _compareVariable()

◆ _internalResize()

template<typename T>
void Arcane::VariableArrayT< T >::_internalResize ( const VariableResizeArgs & resize_args)
overrideprotectedvirtual

Implements Arcane::Variable.

Definition at line 644 of file VariableArray.cc.

◆ allocatedMemory()

template<typename T>
Real Arcane::VariableArrayT< T >::allocatedMemory ( ) const
overridevirtual

Memory size (in Bytes) used by the variable.

Implements Arcane::IVariable.

Definition at line 417 of file VariableArray.cc.

◆ capacity()

template<typename DataType>
Integer Arcane::VariableArrayT< DataType >::capacity ( )

Definition at line 733 of file VariableArray.cc.

◆ compact()

template<typename T>
void Arcane::VariableArrayT< T >::compact ( Int32ConstArrayView new_to_old_ids)
overridevirtual

Compresses the variable's values.

This operation is internal to Arcane and must be done in conjunction with the entity family corresponding to this variable.

Implements Arcane::IVariable.

Definition at line 600 of file VariableArray.cc.

References Arcane::arcaneIsCheck(), Arcane::Array< T >::at(), Arcane::TraceAccessor::debug(), Arcane::Trace::High, Arcane::Variable::isPartial(), Arcane::Variable::name(), Arcane::ConstArrayView< T >::size(), and Arcane::Variable::syncReferences().

◆ constValueView()

template<class T>
ConstArrayView< T > Arcane::VariableArrayT< T >::constValueView ( ) const
inline

Definition at line 69 of file VariableArray.h.

◆ copyItemsMeanValues() [1/3]

void Arcane::VariableArrayT< String >::copyItemsMeanValues ( Int32ConstArrayView first_source,
Int32ConstArrayView second_source,
Int32ConstArrayView destination )
virtual

Copies the mean values of entities numbered first_source and second_source into entities numbered destination.

Parameters
first_sourcelist of localIds of the 1st source
second_sourcelist of localIds of the 2nd source
destinationlist of destination localIds

Implements Arcane::IVariable.

Definition at line 778 of file VariableArray.cc.

◆ copyItemsMeanValues() [2/3]

void Arcane::VariableArrayT< String >::copyItemsMeanValues ( Int32ConstArrayView first_source,
Int32ConstArrayView second_source,
Int32ConstArrayView destination )
virtual

Copies the mean values of entities numbered first_source and second_source into entities numbered destination.

Parameters
first_sourcelist of localIds of the 1st source
second_sourcelist of localIds of the 2nd source
destinationlist of destination localIds

Implements Arcane::IVariable.

◆ copyItemsMeanValues() [3/3]

template<typename T>
void Arcane::VariableArrayT< T >::copyItemsMeanValues ( Int32ConstArrayView first_source,
Int32ConstArrayView second_source,
Int32ConstArrayView destination )
overridevirtual

Copies the mean values of entities numbered first_source and second_source into entities numbered destination.

Parameters
first_sourcelist of localIds of the 1st source
second_sourcelist of localIds of the 2nd source
destinationlist of destination localIds

Implements Arcane::IVariable.

Definition at line 574 of file VariableArray.cc.

References Arcane::ConstArrayView< T >::size(), and Arcane::Variable::syncReferences().

◆ copyItemsValues()

template<typename T>
void Arcane::VariableArrayT< T >::copyItemsValues ( Int32ConstArrayView source,
Int32ConstArrayView destination )
overridevirtual

Copies the values of entities numbered source into entities numbered destination.

Note
This operation is internal to Arcane and must be done in conjunction with the entity family corresponding to this variable.
Parameters
sourcelist of source localIds
destinationlist of destination localIds

Implements Arcane::IVariable.

Definition at line 559 of file VariableArray.cc.

References Arcane::ConstArrayView< T >::size(), and Arcane::Variable::syncReferences().

◆ data() [1/2]

template<class T>
const IData * Arcane::VariableArrayT< T >::data ( ) const
inlineoverridevirtual

Data associated with the variable.

Implements Arcane::IVariable.

Definition at line 83 of file VariableArray.h.

◆ data() [2/2]

template<class T>
IData * Arcane::VariableArrayT< T >::data ( )
inlineoverridevirtual

Data associated with the variable.

Implements Arcane::IVariable.

Definition at line 82 of file VariableArray.h.

Referenced by Arcane::ItemVariableScalarRefT< DataTypeT >::copy(), and VariableArrayT().

◆ getReference() [1/2]

template<typename T>
VariableArrayT< T > * Arcane::VariableArrayT< T >::getReference ( const VariableBuildInfo & v,
const VariableInfo & vi )
static

Definition at line 332 of file VariableArray.cc.

◆ getReference() [2/2]

template<typename T>
VariableArrayT< T > * Arcane::VariableArrayT< T >::getReference ( IVariable * var)
static

Definition at line 353 of file VariableArray.cc.

◆ initialize()

template<typename T>
bool Arcane::VariableArrayT< T >::initialize ( const ItemGroup & group,
const String & value )
overridevirtual

Initializes the variable.

Initializes the variable with the value value on the group group.

Since the value is passed as a character string, it verifies that the conversion to the variable's type is possible. It also verifies that the group group is of type #GroupType. If either of these two points is not met, the initialization fails.

Return values
truein case of error,
falsein case of success.

Reimplemented from Arcane::Variable.

Definition at line 515 of file VariableArray.cc.

References Arcane::Variable::dataType(), ENUMERATE_ITEM, Arcane::TraceAccessor::error(), Arcane::ItemGroup::itemFamily(), Arcane::Variable::itemFamily(), Arcane::ItemGroup::itemKind(), Arcane::Variable::itemKind(), Arcane::itemKindName(), Arcane::Item::localId(), and Arcane::ItemGroup::name().

◆ nbElement()

template<class T>
Integer Arcane::VariableArrayT< T >::nbElement ( ) const
inlineoverridevirtual

Number of elements of the variable.

The returned values depend on the dimension of the variable:

  • for dimension 0, returns 1,
  • for dimension 1, returns the number of elements in the array
  • for dimension 2, returns the total number of elements by summing the number of elements per dimension.

Implements Arcane::IVariable.

Definition at line 66 of file VariableArray.h.

◆ print()

template<typename T>
void Arcane::VariableArrayT< T >::print ( std::ostream & o) const
overridevirtual

Prints the variable's values to the stream o.

Implements Arcane::IVariable.

Definition at line 367 of file VariableArray.cc.

References Arcane::ConstArrayView< T >::size().

◆ resizeWithReserve()

template<typename DataType>
void Arcane::VariableArrayT< DataType >::resizeWithReserve ( Integer n,
Integer nb_additional )
virtual

Definition at line 714 of file VariableArray.cc.

◆ setIsSynchronized() [1/2]

template<typename T>
void Arcane::VariableArrayT< T >::setIsSynchronized ( )
overridevirtual

Indicates that the variable is synchronized.

This operation is collective.

Implements Arcane::IVariable.

Definition at line 626 of file VariableArray.cc.

References Arcane::Variable::itemGroup(), and setIsSynchronized().

Referenced by setIsSynchronized().

◆ setIsSynchronized() [2/2]

template<typename T>
void Arcane::VariableArrayT< T >::setIsSynchronized ( const ItemGroup & item_group)
overridevirtual

Indicates that the variable is synchronized on the group item_group.

This operation is collective.

Implements Arcane::IVariable.

Definition at line 635 of file VariableArray.cc.

◆ shrinkMemory()

template<typename DataType>
void Arcane::VariableArrayT< DataType >::shrinkMemory ( )
overridevirtual

Frees any additional memory allocated for the data.

This method is only useful for non-scalar variables

Implements Arcane::IVariable.

Definition at line 723 of file VariableArray.cc.

References Arcane::Variable::syncReferences().

◆ swapValues()

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

Definition at line 762 of file VariableArray.cc.

◆ synchronize() [1/2]

template<typename T>
void Arcane::VariableArrayT< T >::synchronize ( )
overridevirtual

◆ synchronize() [2/2]

template<typename T>
void Arcane::VariableArrayT< T >::synchronize ( Int32ConstArrayView local_ids)
overridevirtual

Synchronizes the variable on a list of entities.

Synchronization can only be performed on mesh variables. Only the entities listed in local_ids will be synchronized. Note: an entity present in this list on one subdomain must be present in this list for any other subdomain that possesses this entity.

Reimplemented from Arcane::IVariable.

Definition at line 400 of file VariableArray.cc.

References Arcane::IItemFamily::allItemsSynchronizer(), ARCANE_FATAL, ARCANE_THROW, Arcane::Variable::fullName(), Arcane::IK_Unknown, Arcane::Variable::isPartial(), Arcane::Variable::itemGroup(), Arcane::Variable::itemKind(), and Arcane::IVariableSynchronizer::synchronize().

◆ trueData()

template<class T>
ValueDataType * Arcane::VariableArrayT< T >::trueData ( )
inline

Definition at line 91 of file VariableArray.h.

◆ value()

template<typename DataType>
auto Arcane::VariableArrayT< DataType >::value ( )

Definition at line 798 of file VariableArray.cc.

◆ valueView() [1/2]

template<class T>
ArrayView< T > Arcane::VariableArrayT< T >::valueView ( )
inline

Definition at line 71 of file VariableArray.h.

◆ valueView() [2/2]

template<class T>
ConstArrayView< T > Arcane::VariableArrayT< T >::valueView ( ) const
inline

Definition at line 70 of file VariableArray.h.


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