#include <arcane/impl/internal/VariableMng.h>
Classes | |
| class | VariableNameInfo |
| class | VNIComparer |
| class | InternalApi |
Public Types | |
| using | VNIMap = HashTableMapT<VariableNameInfo, IVariable*, VNIComparer> |
Public Member Functions | |
| VariableMng (ISubDomain *sd) | |
| Constructs a variable manager for the case pn. | |
| ~VariableMng () override | |
| Destroys the manager. | |
| void | build () override |
| Constructs the instance members. | |
| void | initialize () override |
| Initializes the instance. The instance is not usable until this method has been called. | |
| void | removeAllVariables () override |
| Removes and destroys the variables managed by this manager. | |
| void | detachMeshVariables (IMesh *mesh) override |
| Detaches variables associated with the mesh mesh. | |
| ISubDomain * | subDomain () override |
| Sub-domain manager. | |
| IParallelMng * | parallelMng () const override |
| Associated parallelism manager. | |
| ITraceMng * | traceMng () override |
| Message manager. | |
| IVariable * | checkVariable (const VariableInfo &infos) override |
| Checks a variable. | |
| void | addVariableRef (VariableRef *ref) override |
| Adds a reference to a variable. | |
| void | addVariable (IVariable *var) override |
| Adds a variable. | |
| void | removeVariableRef (VariableRef *) override |
| Removes a reference to a variable. | |
| void | removeVariable (IVariable *var) override |
| Removes a variable. | |
| void | dumpList (std::ostream &, IModule *) override |
| Displays the list of variables managed by a module. | |
| void | dumpList (std::ostream &) override |
| Displays the list of all variables managed by the manager. | |
| void | initializeVariables (bool) override |
| Initializes the variables. | |
| String | generateTemporaryVariableName () override |
| Generates a name for a temporary variable. | |
| void | variables (VariableRefCollection, IModule *) override |
| Gets all variables of module i. | |
| VariableCollection | variables () override |
| List of variables. | |
| VariableCollection | usedVariables () override |
| List of used variables. | |
| void | notifyUsedVariableChanged () override |
| Notifies the manager that a variable's state has changed. | |
| Real | exportSize (const VariableCollection &vars) override |
| IObservable * | writeObservable () override |
| Observable for variables being written. | |
| IObservable * | readObservable () override |
| Observable for variables being read. | |
| void | writeVariables (IDataWriter *, const VariableCollection &vars) override |
| Exports the variables. | |
| void | writeVariables (IDataWriter *, IVariableFilter *) override |
| Writes the variables. | |
| void | writeCheckpoint (ICheckpointWriter *) override |
| Writes variables for a checkpoint. | |
| void | writePostProcessing (IPostProcessorWriter *writer) override |
| Writes variables for post-processing. | |
| void | readVariables (IDataReader *, IVariableFilter *) override |
| Reads all variables. | |
| void | readCheckpoint (ICheckpointReader *) override |
| Reads all variables from a checkpoint. | |
| void | readCheckpoint (const CheckpointReadInfo &infos) override |
| Reads all variables from a checkpoint. | |
| IVariable * | findVariable (const String &name) override |
| Returns the variable named name or 0 if no such name exists. | |
| IVariable * | findMeshVariable (IMesh *mesh, const String &name) override |
| Returns the mesh variable named name or 0 if no such name exists. | |
| IVariable * | findVariableFullyQualified (const String &name) override |
| Returns the fully qualified variable named name or 0 if no such name exists. | |
| void | dumpStats (std::ostream &ostr, bool is_verbose) override |
| Writes statistics about variables to the stream ostr. | |
| void | dumpStatsJSON (JSONWriter &writer) override |
| Writes statistics with the writer writer. | |
| IVariableUtilities * | utilities () const override |
| Interface of associated utility functions. | |
| EventObservable< const VariableStatusChangedEventArgs & > & | onVariableAdded () override |
| Event sent when a variable is created. | |
| EventObservable< const VariableStatusChangedEventArgs & > & | onVariableRemoved () override |
| Event sent when a variable is destroyed. | |
| IVariableSynchronizerMng * | synchronizerMng () const override |
| Interface of the variable synchronization manager. | |
| ISubDomain * | _internalSubDomain () const override |
| IVariableMngInternal * | _internalApi () override |
| Internal Arcane API. | |
| Public Member Functions inherited from Arcane::TraceAccessor | |
| TraceAccessor (ITraceMng *m) | |
| Constructs an accessor via the trace manager m. | |
| TraceAccessor (const TraceAccessor &rhs) | |
| Copy constructor. | |
| TraceAccessor & | operator= (const TraceAccessor &rhs) |
| Copy assignment operator. | |
| virtual | ~TraceAccessor () |
| Frees resources. | |
| ITraceMng * | traceMng () 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::IVariableMng | |
| virtual | ~IVariableMng ()=default |
| Frees resources. | |
Static Public Member Functions | |
| static bool | isVariableToSave (IVariable &var) |
Private Types | |
| using | FullNameVariableMap = std::map<String, IVariable*> |
| Type of the list of variables by full name. | |
| using | FullNameVariablePair = FullNameVariableMap::value_type |
| Pair of the list of variables by full name. | |
| using | VariableFactoryMap = std::map<String, IVariableFactory*> |
| Type of the list of variable factories by full name. | |
| using | VariableFactoryPair = VariableFactoryMap::value_type |
| Pair of the list of variables by full name. | |
Private Member Functions | |
| void | _dumpVariable (const VariableRef &v, std::ostream &o) |
| Writes the value of variable v to the stream o. | |
| VariableRef * | _createVariableFromType (const String &full_type, const VariableBuildInfo &vbi) |
| void | _removeAllShMemVariables () |
Static Private Member Functions | |
| static const char * | _msgClassName () |
Friends | |
| class | VariableIOWriterMng |
| class | VariableIOReaderMng |
Additional Inherited Members | |
| Protected Member Functions inherited from Arcane::TraceAccessor | |
| void | _setLocalVerboseLevel (Int32 v) |
| Int32 | _localVerboseLevel () const |
Variable manager.
Definition at line 54 of file VariableMng.h.
|
private |
Type of the list of variables by full name.
Definition at line 223 of file VariableMng.h.
|
private |
Pair of the list of variables by full name.
Definition at line 225 of file VariableMng.h.
|
private |
Type of the list of variable factories by full name.
Definition at line 228 of file VariableMng.h.
|
private |
Pair of the list of variables by full name.
Definition at line 230 of file VariableMng.h.
| using Arcane::VariableMng::VNIMap = HashTableMapT<VariableNameInfo, IVariable*, VNIComparer> |
Definition at line 151 of file VariableMng.h.
|
explicit |
Constructs a variable manager for the case pn.
Definition at line 76 of file VariableMng.cc.
References m_sub_domain, parallelMng(), Arcane::TraceAccessor::TraceAccessor(), and traceMng().
|
override |
Destroys the manager.
The manager performs memory release of the variables it manages.
Definition at line 99 of file VariableMng.cc.
|
private |
Definition at line 644 of file VariableMng.cc.
|
private |
Writes the value of variable v to the stream o.
Definition at line 507 of file VariableMng.cc.
References Arcane::VariableRef::dataType(), Arcane::VariableRef::name(), and Arcane::VariableRef::print().
Referenced by dumpList(), and dumpList().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Temporary internal function to retrieve the sub-domain.
Implements Arcane::IVariableMng.
Definition at line 213 of file VariableMng.h.
References m_sub_domain.
|
inlinestaticprivate |
Definition at line 273 of file VariableMng.h.
|
private |
Definition at line 992 of file VariableMng.cc.
|
overridevirtual |
Adds a variable.
Adds the variable var.
The validity of the variable is not checked (void checkVariable()).
Implements Arcane::IVariableMng.
Definition at line 257 of file VariableMng.cc.
References Arcane::VariableStatusChangedEventArgs::Added, ARCANE_FATAL, Arcane::ISubDomain::checkId(), Arcane::ITimeLoopMng::currentEntryPoint(), Arcane::IVariable::dataType(), Arcane::IVariable::fullName(), Arcane::IK_Unknown, Arcane::TraceAccessor::info(), Arcane::IVariable::itemFamilyName(), Arcane::IVariable::itemKind(), m_full_name_variable_map, Arcane::IVariable::meshName(), Arcane::IVariable::name(), Arcane::String::null(), subDomain(), and Arcane::ISubDomain::timeLoopMng().
|
overridevirtual |
Adds a reference to a variable.
Adds the reference var to the manager.
Implements Arcane::IVariableMng.
Definition at line 238 of file VariableMng.cc.
|
overridevirtual |
Constructs the instance members.
The instance is not usable until this method has been called. This method must be called before initialize().
Implements Arcane::IVariableMng.
Definition at line 120 of file VariableMng.cc.
References Arcane::platform::getEnvironmentVariable(), and Arcane::String::null().
|
overridevirtual |
Checks a variable.
Checks that the variable named name characterized by infos is valid. This is true if and only if:
If the variable is not valid, an exception is thrown.
This operation is used when you want to create a new reference to a variable and ensure that it will be valid.
| ExBadVariableKindType | if the variable named infos.name() exists and its type and kind do not match those of infos. |
Implements Arcane::IVariableMng.
Definition at line 330 of file VariableMng.cc.
References ARCANE_FATAL, Arcane::arcaneIsCheck(), Arcane::IVariable::dataType(), Arcane::VariableInfo::dataType(), Arcane::IVariable::dimension(), Arcane::VariableInfo::dimension(), findVariableFullyQualified(), Arcane::VariableInfo::fullName(), Arcane::IK_Unknown, Arcane::VariableInfo::isPartial(), Arcane::VariableInfo::itemFamilyName(), Arcane::IVariable::itemGroupName(), Arcane::VariableInfo::itemGroupName(), Arcane::IVariable::itemKind(), Arcane::VariableInfo::itemKind(), Arcane::VariableInfo::localName(), Arcane::VariableInfo::meshName(), and Arcane::String::null().
|
overridevirtual |
Detaches variables associated with the mesh mesh.
Implements Arcane::IVariableMng.
Definition at line 221 of file VariableMng.cc.
References Arcane::IVariable::itemGroup(), m_full_name_variable_map, Arcane::ItemGroup::mesh(), Arcane::ItemGroup::null(), and Arcane::IVariable::setUsed().
|
overridevirtual |
Displays the list of all variables managed by the manager.
Implements Arcane::IVariableMng.
Definition at line 486 of file VariableMng.cc.
References _dumpVariable(), and m_full_name_variable_map.
|
overridevirtual |
Displays the list of variables managed by a module.
Implements Arcane::IVariableMng.
Definition at line 470 of file VariableMng.cc.
References _dumpVariable(), and m_full_name_variable_map.
|
overridevirtual |
Writes statistics about variables to the stream ostr.
Implements Arcane::IVariableMng.
Definition at line 748 of file VariableMng.cc.
References Arcane::Array< T >::add(), Arcane::IMeshBase::allCells(), Arcane::IVariable::allocatedMemory(), Arcane::ISubDomain::defaultMesh(), Arcane::IVariable::dimension(), Arcane::IK_Cell, Arcane::IK_DoF, Arcane::IK_Edge, Arcane::IK_Face, Arcane::IK_Node, Arcane::IK_Particle, Arcane::IK_Unknown, Arcane::IVariable::isUsed(), Arcane::IVariable::itemKind(), Arcane::itemKindName(), m_full_name_variable_map, m_variables_ref, Arcane::math::min(), Arcane::VariableRef::module(), Arcane::IVariable::name(), Arcane::IVariable::nbReference(), Arcane::IVariable::PNoDump, Arcane::IVariable::PNoExchange, Arcane::IVariable::PNoRestore, Arcane::IVariable::property(), Arcane::AbstractArray< T >::size(), Arcane::ItemGroup::size(), and subDomain().
|
overridevirtual |
Writes statistics with the writer writer.
Implements Arcane::IVariableMng.
Definition at line 962 of file VariableMng.cc.
References Arcane::IVariable::allocatedMemory(), Arcane::IVariable::dataType(), Arcane::dataTypeName(), Arcane::IVariable::dimension(), Arcane::IVariable::isUsed(), Arcane::IVariable::itemFamilyName(), Arcane::IVariable::itemGroupName(), m_full_name_variable_map, Arcane::IVariable::meshName(), Arcane::IVariable::name(), Arcane::IVariable::nbElement(), and Arcane::IVariable::property().
|
overridevirtual |
Implements Arcane::IVariableMng.
Definition at line 700 of file VariableMng.cc.
References Arcane::IVariable::allocatedMemory(), Arcane::IVariable::isUsed(), and m_full_name_variable_map.
|
overridevirtual |
Returns the mesh variable named name or 0 if no such name exists.
Implements Arcane::IVariableMng.
Definition at line 412 of file VariableMng.cc.
References findVariableFullyQualified().
Returns the variable named name or 0 if no such name exists.
Implements Arcane::IVariableMng.
Definition at line 388 of file VariableMng.cc.
References findVariableFullyQualified().
Referenced by generateTemporaryVariableName().
Returns the fully qualified variable named name or 0 if no such name exists.
Implements Arcane::IVariableMng.
Definition at line 438 of file VariableMng.cc.
References m_full_name_variable_map.
Referenced by checkVariable(), findMeshVariable(), and findVariable().
|
overridevirtual |
Generates a name for a temporary variable.
To ensure the consistency of this name, all sub-domains must call this function.
Implements Arcane::IVariableMng.
Definition at line 450 of file VariableMng.cc.
References findVariable(), Arcane::TraceAccessor::info(), and m_generate_name_id.
|
overridevirtual |
Initializes the instance. The instance is not usable until this method has been called.
Implements Arcane::IVariableMng.
Definition at line 131 of file VariableMng.cc.
References ARCANE_FATAL, Arcane::VariableFactoryRegisterer::createFactory(), Arcane::VariableFactoryRegisterer::dataType(), Arcane::VariableFactoryRegisterer::dimension(), Arcane::IVariableFactory::fullTypeName(), Arcane::TraceAccessor::info(), Arcane::VariableFactoryRegisterer::itemKind(), Arcane::VariableFactoryRegisterer::multiTag(), and Arcane::VariableFactoryRegisterer::nextVariableFactory().
|
overridevirtual |
Initializes the variables.
Iterates through the list of variables and initializes them. Only variables of a used module are initialized.
| is_continue | true if resuming. |
Implements Arcane::IVariableMng.
Definition at line 520 of file VariableMng.cc.
References Arcane::TraceAccessor::info(), Arcane::IVariable::isUsed(), m_full_name_variable_map, Arcane::VariableRef::module(), Arcane::IModule::used(), and Arcane::VariableRef::variable().
|
static |
Definition at line 591 of file VariableMng.cc.
|
inlineoverridevirtual |
Notifies the manager that a variable's state has changed.
Implements Arcane::IVariableMng.
Definition at line 182 of file VariableMng.h.
|
inlineoverridevirtual |
Event sent when a variable is created.
Implements Arcane::IVariableMng.
Definition at line 202 of file VariableMng.h.
|
inlineoverridevirtual |
Event sent when a variable is destroyed.
Implements Arcane::IVariableMng.
Definition at line 208 of file VariableMng.h.
|
inlineoverridevirtual |
Associated parallelism manager.
Implements Arcane::IVariableMng.
Definition at line 168 of file VariableMng.h.
Referenced by VariableMng().
|
overridevirtual |
Reads all variables from a checkpoint.
Reads a checkpoint using the information contained in infos.
This method is collective.
This method is internal to Arcane. Generally, reading a checkpoint is done via an instance of ICheckpointMng, accessible via ISubDomain::checkpointMng().
Implements Arcane::IVariableMng.
Definition at line 679 of file VariableMng.cc.
|
overridevirtual |
Reads all variables from a checkpoint.
Reads a checkpoint using the service reader on all variables.
This method is collective.
This method is internal to Arcane. Generally, reading a checkpoint is done via an instance of ICheckpointMng, accessible via ISubDomain::checkpointMng().
Implements Arcane::IVariableMng.
Definition at line 670 of file VariableMng.cc.
|
inlineoverridevirtual |
Observable for variables being read.
Observers registered in this observable are called after reading variables (operation readVariables() or readCheckpoint()).
Implements Arcane::IVariableMng.
Definition at line 185 of file VariableMng.h.
|
overridevirtual |
Reads all variables.
Iterates through all variables managed by the manager and applies the reader reader to them. If filter is not null, it is applied to each variable and a variable is read only if the filter is true for that variable. Variables that are not read are not modified by this operation.
This method is collective.
Implements Arcane::IVariableMng.
Definition at line 688 of file VariableMng.cc.
|
overridevirtual |
Removes and destroys the variables managed by this manager.
Implements Arcane::IVariableMng.
Definition at line 162 of file VariableMng.cc.
References Arcane::Array< T >::add(), Arcane::arcaneIsCheck(), Arcane::VariableRef::assignmentStackTrace(), Arcane::AbstractArray< T >::empty(), Arcane::IVariable::fullName(), Arcane::TraceAccessor::info(), m_auto_create_variables, m_full_name_variable_map, Arcane::VariableRef::name(), Arcane::IVariable::nbReference(), and Arcane::TraceAccessor::pwarning().
|
overridevirtual |
Removes a variable.
Removes the variable var.
After calling this method, the variable must no longer be used.
Implements Arcane::IVariableMng.
Definition at line 293 of file VariableMng.cc.
References Arcane::TraceAccessor::debug(), Arcane::ItemGroupImpl::detachObserver(), Arcane::IVariable::fullName(), Arcane::ItemGroup::internal(), Arcane::IVariable::itemFamilyName(), Arcane::IVariable::itemGroup(), m_full_name_variable_map, Arcane::IVariable::meshName(), Arcane::IVariable::name(), Arcane::IVariable::nbReference(), Arcane::ItemGroup::null(), Arcane::IVariable::PNoDump, Arcane::IVariable::PNoRestore, Arcane::IVariable::property(), Arcane::IVariable::PTemporary, and Arcane::VariableStatusChangedEventArgs::Removed.
|
overridevirtual |
Removes a reference to a variable.
Removes the reference var from the manager.
If var is not referenced by the manager, nothing is done.
Implements Arcane::IVariableMng.
Definition at line 248 of file VariableMng.cc.
|
inlineoverridevirtual |
Sub-domain manager.
Implements Arcane::IVariableMng.
Definition at line 167 of file VariableMng.h.
References m_sub_domain.
Referenced by addVariable(), and dumpStats().
|
overridevirtual |
Interface of the variable synchronization manager.
Implements Arcane::IVariableMng.
Definition at line 728 of file VariableMng.cc.
|
inlineoverridevirtual |
Message manager.
Implements Arcane::IVariableMng.
Definition at line 169 of file VariableMng.h.
References Arcane::TraceAccessor::traceMng().
Referenced by VariableMng().
|
overridevirtual |
List of used variables.
Implements Arcane::IVariableMng.
Definition at line 573 of file VariableMng.cc.
References Arcane::IVariable::isUsed(), and m_full_name_variable_map.
|
inlineoverridevirtual |
Interface of associated utility functions.
Implements Arcane::IVariableMng.
Definition at line 199 of file VariableMng.h.
|
overridevirtual |
List of variables.
Implements Arcane::IVariableMng.
Definition at line 557 of file VariableMng.cc.
References m_full_name_variable_map.
|
overridevirtual |
Gets all variables of module i.
Implements Arcane::IVariableMng.
Definition at line 543 of file VariableMng.cc.
References m_full_name_variable_map.
|
overridevirtual |
Writes variables for a checkpoint.
Uses the protection service writer to write the variables.
This method is collective.
This method is internal to Arcane. Generally, writing a checkpoint is done via an instance of ICheckpointMng, accessible via ISubDomain::checkpointMng().
Implements Arcane::IVariableMng.
Definition at line 608 of file VariableMng.cc.
|
inlineoverridevirtual |
Observable for variables being written.
Observers registered in this observable are called before writing variables (operation writeCheckpoint(), writeVariables() or writePostProcessing()).
Implements Arcane::IVariableMng.
Definition at line 184 of file VariableMng.h.
|
overridevirtual |
Writes variables for post-processing.
Uses the post-processing service writer to write the variables. The caller must have positioned the fields of writer before this call, notably the list of variables to be post-processed. This method calls IPostProcessorWriter::notifyBeginWrite() before writing and IPostProcessorWriter::notifyEndWriter() at the end.
This method is collective.
Implements Arcane::IVariableMng.
Definition at line 617 of file VariableMng.cc.
|
overridevirtual |
Exports the variables.
Exports the variables in the list vars. If vars is empty, it exports all variables in the base that are used.
Implements Arcane::IVariableMng.
Definition at line 626 of file VariableMng.cc.
|
overridevirtual |
Writes the variables.
Iterates through all variables managed by the manager and applies the writer writer to them. If filter is not null, it is applied to each variable and a variable is written only if the filter is true for that variable.
This method is collective
Implements Arcane::IVariableMng.
Definition at line 635 of file VariableMng.cc.
|
friend |
Definition at line 59 of file VariableMng.h.
|
friend |
Definition at line 58 of file VariableMng.h.
|
private |
Definition at line 266 of file VariableMng.h.
|
private |
List of variables created automatically during a restart.
Definition at line 251 of file VariableMng.h.
Referenced by removeAllVariables().
|
private |
List of variables by full name.
Definition at line 243 of file VariableMng.h.
Referenced by addVariable(), detachMeshVariables(), dumpList(), dumpList(), dumpStats(), dumpStatsJSON(), exportSize(), findVariableFullyQualified(), initializeVariables(), removeAllVariables(), removeVariable(), usedVariables(), variables(), and variables().
|
private |
Number used to generate a variable name.
Definition at line 254 of file VariableMng.h.
Referenced by generateTemporaryVariableName().
|
private |
Definition at line 236 of file VariableMng.h.
|
private |
Definition at line 257 of file VariableMng.h.
|
private |
Definition at line 256 of file VariableMng.h.
|
private |
Definition at line 247 of file VariableMng.h.
|
private |
Definition at line 248 of file VariableMng.h.
|
private |
Definition at line 234 of file VariableMng.h.
|
private |
Definition at line 246 of file VariableMng.h.
|
private |
Subdomain manager.
Definition at line 233 of file VariableMng.h.
Referenced by _internalSubDomain(), subDomain(), and VariableMng().
|
private |
Definition at line 235 of file VariableMng.h.
|
private |
Definition at line 239 of file VariableMng.h.
|
private |
Definition at line 241 of file VariableMng.h.
|
private |
Definition at line 261 of file VariableMng.h.
Definition at line 259 of file VariableMng.h.
|
private |
Definition at line 249 of file VariableMng.h.
|
private |
Definition at line 252 of file VariableMng.h.
|
private |
Definition at line 263 of file VariableMng.h.
|
private |
Definition at line 262 of file VariableMng.h.
|
private |
Definition at line 264 of file VariableMng.h.
|
private |
Definition at line 238 of file VariableMng.h.
|
private |
Definition at line 240 of file VariableMng.h.
|
private |
|
private |
Definition at line 244 of file VariableMng.h.
|
private |
Definition at line 245 of file VariableMng.h.