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

Scalar variable. More...

#include <arcane/core/VariableScalar.h>

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

Public Types

typedef T ValueType
typedef IScalarDataT< T > ValueDataType
typedef VariableScalarT< 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.
Real allocatedMemory () const override
 Memory size (in Bytes) used by the variable.
Integer nbElement () const override
 Number of elements of the variable.
ValueType & value ()
void shrinkMemory () override
 Frees any additional memory allocated for the data.
void print (std::ostream &o) const override
 Prints the variable's values to the stream o.
IDatadata () override
 Data associated with the variable.
const IDatadata () const override
 Data associated with the variable.
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 new_to_old_ids) override
 Compresses the variable's values.
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.
void swapValues (ThatClass &rhs)
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 (const VariableBuildInfo &v, const VariableInfo &vi)
static ThatClass * getReference (IVariable *var)
static Int64 incrementModifiedTime ()
 Increments the modification counter and returns its value before modification.

Protected Member Functions

 VariableScalarT (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

Private Attributes

ValueDataType * m_value

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::VariableScalarT< T >

Scalar variable.

Definition at line 33 of file VariableScalar.h.

Member Typedef Documentation

◆ BaseClass

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

Definition at line 41 of file VariableScalar.h.

◆ ThatClass

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

Definition at line 40 of file VariableScalar.h.

◆ ValueDataType

template<class T>
typedef IScalarDataT<T> Arcane::VariableScalarT< T >::ValueDataType

Definition at line 39 of file VariableScalar.h.

◆ ValueType

template<class T>
typedef T Arcane::VariableScalarT< T >::ValueType

Definition at line 38 of file VariableScalar.h.

Constructor & Destructor Documentation

◆ VariableScalarT()

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

Constructs a variable based on the reference v.

Definition at line 166 of file VariableScalar.cc.

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

Here is the call graph for this function:

Member Function Documentation

◆ _compareVariable()

template<typename T>
VariableComparerResults Arcane::VariableScalarT< T >::_compareVariable ( const VariableComparerArgs & compare_args)
finalprotectedvirtual

Comparison of values between variables.

Implements Arcane::Variable.

Definition at line 242 of file VariableScalar.cc.

References ARCANE_CHECK_POINTER, ARCANE_FATAL, Arcane::RefImpl< InstanceType, RefClassType, ImplTagId >::get(), Arcane::IK_Particle, Arcane::Variable::itemKind(), Arcane::IDataReader::read(), Arcane::Same, Arcane::SameOnAllReplica, and Arcane::Sync.

Here is the call graph for this function:

◆ _internalResize()

template<class T>
void Arcane::VariableScalarT< T >::_internalResize ( const VariableResizeArgs & resize_args)
inlineoverrideprotectedvirtual

Implements Arcane::Variable.

Definition at line 81 of file VariableScalar.h.

◆ allocatedMemory()

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

Memory size (in Bytes) used by the variable.

Implements Arcane::IVariable.

Definition at line 304 of file VariableScalar.cc.

◆ compact()

template<typename T>
void Arcane::VariableScalarT< 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 336 of file VariableScalar.cc.

◆ copyItemsMeanValues()

template<typename T>
void Arcane::VariableScalarT< 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 323 of file VariableScalar.cc.

◆ copyItemsValues()

template<typename T>
void Arcane::VariableScalarT< 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 313 of file VariableScalar.cc.

◆ data() [1/2]

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

Data associated with the variable.

Implements Arcane::IVariable.

Definition at line 63 of file VariableScalar.h.

◆ data() [2/2]

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

Data associated with the variable.

Implements Arcane::IVariable.

Definition at line 62 of file VariableScalar.h.

Referenced by VariableScalarT().

Here is the caller graph for this function:

◆ getReference() [1/2]

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

Definition at line 182 of file VariableScalar.cc.

◆ getReference() [2/2]

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

Definition at line 201 of file VariableScalar.cc.

◆ nbElement()

template<class T>
Integer Arcane::VariableScalarT< 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 58 of file VariableScalar.h.

◆ print()

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

Prints the variable's values to the stream o.

Implements Arcane::IVariable.

Definition at line 276 of file VariableScalar.cc.

◆ setIsSynchronized() [1/2]

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

Indicates that the variable is synchronized.

This operation is collective.

Implements Arcane::IVariable.

Definition at line 345 of file VariableScalar.cc.

◆ setIsSynchronized() [2/2]

template<typename T>
void Arcane::VariableScalarT< 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 353 of file VariableScalar.cc.

◆ shrinkMemory()

template<class T>
void Arcane::VariableScalarT< T >::shrinkMemory ( )
inlineoverridevirtual

Frees any additional memory allocated for the data.

This method is only useful for non-scalar variables

Implements Arcane::IVariable.

Definition at line 60 of file VariableScalar.h.

◆ swapValues()

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

Definition at line 363 of file VariableScalar.cc.

◆ synchronize() [1/2]

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

Synchronizes the variable.

La synchronisation ne peut se faire que sur les variables du maillage.

Implements Arcane::IVariable.

Definition at line 285 of file VariableScalar.cc.

◆ synchronize() [2/2]

template<typename T>
void Arcane::VariableScalarT< 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 294 of file VariableScalar.cc.

◆ value()

template<class T>
ValueType & Arcane::VariableScalarT< T >::value ( )
inline

Definition at line 59 of file VariableScalar.h.

Member Data Documentation

◆ m_value

template<class T>
ValueDataType* Arcane::VariableScalarT< T >::m_value
private

Definition at line 89 of file VariableScalar.h.


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