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

Public Types

using ValueType = Array2<T>
using ValueDataType = IArray2DataT<T>
using ThatClass = Array2VariableT<T>
using BaseClass = Variable
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.
Real allocatedMemory () const override
 Memory size (in Bytes) used by the variable.
Integer nbElement () const override
 Number of elements of the variable.
virtual ValueType & value ()
ConstArray2View< T > constValueView () const
ConstArray2View< T > valueView () const
Array2View< T > valueView ()
void shrinkMemory () override
 Frees any additional memory allocated for the data.
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.
void directResize (Integer dim1)
void directResize (Integer dim1, Integer dim2)
void directResizeAndReshape (const ArrayShape &shape)
void swapValues (ThatClass &rhs)
void fillShape (ArrayShape &shape)
ValueDataType * trueData ()
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, ...).
bool initialize (const ItemGroup &, const String &) override
 Initializes the variable on a group.
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

 Array2VariableT (const VariableBuildInfo &v, const VariableInfo &vi)
 Constructs a variable based on the reference 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::Array2VariableT< T >

Definition at line 35 of file Array2Variable.h.

Member Typedef Documentation

◆ BaseClass

template<class T>
using Arcane::Array2VariableT< T >::BaseClass = Variable

Definition at line 43 of file Array2Variable.h.

◆ ThatClass

template<class T>
using Arcane::Array2VariableT< T >::ThatClass = Array2VariableT<T>

Definition at line 42 of file Array2Variable.h.

◆ ValueDataType

template<class T>
using Arcane::Array2VariableT< T >::ValueDataType = IArray2DataT<T>

Definition at line 41 of file Array2Variable.h.

◆ ValueType

template<class T>
using Arcane::Array2VariableT< T >::ValueType = Array2<T>

Definition at line 40 of file Array2Variable.h.

Constructor & Destructor Documentation

◆ Array2VariableT()

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

Constructs a variable based on the reference v.

Definition at line 233 of file Array2Variable.cc.

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

Member Function Documentation

◆ _compareVariable()

◆ _internalResize()

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

Implements Arcane::Variable.

Definition at line 479 of file Array2Variable.cc.

◆ allocatedMemory()

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

Memory size (in Bytes) used by the variable.

Implements Arcane::IVariable.

Definition at line 388 of file Array2Variable.cc.

◆ compact()

template<typename T>
void Arcane::Array2VariableT< 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 588 of file Array2Variable.cc.

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

◆ constValueView()

template<class T>
ConstArray2View< T > Arcane::Array2VariableT< T >::constValueView ( ) const
inline

Definition at line 63 of file Array2Variable.h.

◆ copyItemsMeanValues()

template<typename T>
void Arcane::Array2VariableT< 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 566 of file Array2Variable.cc.

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

◆ copyItemsValues()

template<typename T>
void Arcane::Array2VariableT< 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 546 of file Array2Variable.cc.

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

◆ data() [1/2]

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

Data associated with the variable.

Implements Arcane::IVariable.

Definition at line 76 of file Array2Variable.h.

◆ data() [2/2]

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

Data associated with the variable.

Implements Arcane::IVariable.

Definition at line 75 of file Array2Variable.h.

Referenced by Array2VariableT(), and Arcane::ItemVariableArrayRefT< DataTypeT >::copy().

◆ directResize() [1/2]

template<typename T>
void Arcane::Array2VariableT< T >::directResize ( Integer dim1)

Definition at line 284 of file Array2Variable.cc.

◆ directResize() [2/2]

template<typename DataType>
void Arcane::Array2VariableT< DataType >::directResize ( Integer dim1,
Integer dim2 )

Definition at line 298 of file Array2Variable.cc.

◆ directResizeAndReshape()

template<typename DataType>
void Arcane::Array2VariableT< DataType >::directResizeAndReshape ( const ArrayShape & shape)

Definition at line 319 of file Array2Variable.cc.

◆ fillShape()

template<typename DataType>
void Arcane::Array2VariableT< DataType >::fillShape ( ArrayShape & shape)

Definition at line 680 of file Array2Variable.cc.

◆ getReference() [1/2]

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

Definition at line 249 of file Array2Variable.cc.

◆ getReference() [2/2]

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

Definition at line 270 of file Array2Variable.cc.

◆ nbElement()

template<class T>
Integer Arcane::Array2VariableT< 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 60 of file Array2Variable.h.

◆ print()

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

Prints the variable's values to the stream o.

Implements Arcane::IVariable.

Definition at line 344 of file Array2Variable.cc.

◆ setIsSynchronized() [1/2]

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

Indicates that the variable is synchronized.

This operation is collective.

Implements Arcane::IVariable.

Definition at line 637 of file Array2Variable.cc.

◆ setIsSynchronized() [2/2]

template<typename T>
void Arcane::Array2VariableT< 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 645 of file Array2Variable.cc.

◆ shrinkMemory()

template<typename DataType>
void Arcane::Array2VariableT< 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 334 of file Array2Variable.cc.

References Arcane::Variable::syncReferences().

◆ swapValues()

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

Definition at line 654 of file Array2Variable.cc.

◆ synchronize() [1/2]

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

◆ synchronize() [2/2]

template<typename T>
void Arcane::Array2VariableT< 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 371 of file Array2Variable.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::Array2VariableT< T >::trueData ( )
inline

Definition at line 85 of file Array2Variable.h.

◆ value()

template<typename DataType>
auto Arcane::Array2VariableT< DataType >::value ( )
virtual

Definition at line 670 of file Array2Variable.cc.

◆ valueView() [1/2]

template<class T>
Array2View< T > Arcane::Array2VariableT< T >::valueView ( )
inline

Definition at line 65 of file Array2Variable.h.

◆ valueView() [2/2]

template<class T>
ConstArray2View< T > Arcane::Array2VariableT< T >::valueView ( ) const
inline

Definition at line 64 of file Array2Variable.h.


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