12#ifndef ARCANE_IMPL_INTERNAL_VARIABLEMNG_H
13#define ARCANE_IMPL_INTERNAL_VARIABLEMNG_H
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/utils/String.h"
19#include "arcane/utils/HashTableMap.h"
20#include "arcane/utils/List.h"
21#include "arcane/utils/Ref.h"
23#include "arcane/core/IVariableMng.h"
24#include "arcane/core/IVariableFilter.h"
25#include "arcane/core/VariableCollection.h"
26#include "arcane/core/internal/IVariableMngInternal.h"
28#include "arcane/accelerator/core/IAcceleratorMng.h"
58 friend class VariableIOWriterMng;
59 friend class VariableIOReaderMng;
70 return m_local_name == vni.m_local_name && m_family_name == vni.m_family_name && m_mesh_name == vni.m_mesh_name;
78 if (!m_mesh_name.null()) {
79 h = hash(h, m_mesh_name.localstr());
82 if (!m_family_name.null()) {
83 h = hash(h, m_family_name.localstr());
86 h = hash(h, m_local_name.localstr());
96 for (; *p !=
'\0'; ++p)
97 h = (h << 5) - h + *p;
110 typedef Int32 HashValueType;
114 return key.hash() & 0x7fffffff;
129 void build()
override { m_variable_mng->build(); }
160 void build()
override;
176 void dumpList(std::ostream&)
override;
197 void dumpStats(std::ostream& ostr,
bool is_verbose)
override;
204 return m_on_variable_added;
210 return m_on_variable_removed;
218 static bool isVariableToSave(
IVariable& var);
238 VariableList m_variables;
239 VariableList m_used_variables;
240 bool m_variables_changed =
true;
241 bool m_used_variables_changed =
true;
256 Int64 m_nb_created_variable_reference = 0;
257 Int64 m_nb_created_variable = 0;
259 std::map<IVariable*, IModule*> m_variable_creation_modules;
262 VariableIOWriterMng* m_variable_io_writer_mng =
nullptr;
263 VariableIOReaderMng* m_variable_io_reader_mng =
nullptr;
273 static const char* _msgClassName() {
return "Variable"; }
277 void _removeAllShMemVariables();
286class VariableIOWriterMng
298 return VariableMng::isVariableToSave(var);
316 bool m_use_hash_v2 =
false;
325 static const char* _msgClassName() {
return "Variable"; }
334class VariableIOReaderMng
357 bool m_is_use_json_metadata =
true;
366 void _readMeshesMetaData(
JSONValue meshes_json,
const XmlNode& meshes_node);
368 void _finalizeReadVariables(
const VariableList& vars_to_read);
369 static const char* _msgClassName() {
return "Variable"; }
Accelerator manager interface.
Checkpoint reading information.
Base class for an event handler.
Hash table for associative arrays.
Interface for the protection/recovery reading service.
Interface of the checkpoint/recovery write service.
Interface for reading variable data.
Interface for writing variable data.
Interface of a hashing algorithm.
Interface of an observable.
Interface of the parallelism manager for a subdomain.
Interface for a writer for post-processing information.
Interface of the subdomain manager.
Interface managing execution time statistics.
Functor of a filter applicable to variables.
Interface of the variable manager.
Variable manager interface.
Interface of the variable synchronization manager.
Interface providing utility functions on variables.
Implementation of a collection of elements in vector form.
Reference to an instance.
View of an array of elements of type T.
Unicode character string.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
ITraceMng * traceMng() const
Trace manager.
Parameters necessary for building a variable.
Wrapper for IDataReader2.
Interface to use IDataReader or IDataReader2.
Reading management for variables.
void _readMetaData(VariableMetaDataList &vmd_list, Span< const Byte > bytes)
Reading metadata.
void _checkHashFunction(const VariableMetaDataList &vmd_list)
Checks hash function values.
bool applyFilter(IVariable &var) override
Applies the filter to the variable var.
Writing management for variables.
void _generateMeshesMetaData(JSONWriter &json_writer, XmlNode meshes_node)
void writeVariables(IDataWriter *writer, const VariableCollection &vars, bool use_hash)
Information characterizing a variable.
void build() override
Constructs the instance members.
void initializeVariables(bool is_continue) override
Initializes the variables.
void addVariable(IVariable *var) override
Adds a variable.
void setAcceleratorMng(Ref< IAcceleratorMng > v) override
Sets the accelerator manager.
void removeVariableRef(VariableRef *var) override
Removes a reference to a variable.
void removeAllShMemVariables() override
void addAutoDestroyVariable(VariableRef *var) override
Adds the variable to the list of variables that are kept until the end of execution.
IAcceleratorMng * acceleratorMng() const override
Manager for accelerators.
void detachMeshVariables(IMesh *mesh) override
Detaches variables associated with the mesh mesh.
void initialize() override
Initializes the instance. The instance is not usable until this method has been called.
void removeVariable(IVariable *var) override
Removes a variable.
void addVariableRef(VariableRef *var) override
Adds a reference to a variable.
void removeAllVariables() override
Removes and destroys the variables managed by this manager.
ISubDomain * internalSubDomain() const override
Temporary internal function to retrieve the subdomain.
IVariable * checkVariable(const VariableInfo &infos) override
Checks a variable.
Real exportSize(const VariableCollection &vars) override
IObservable * writeObservable() override
Observable for variables being written.
IVariable * findVariableFullyQualified(const String &name) override
Returns the fully qualified variable named name or 0 if no such name exists.
void dumpList(std::ostream &, IModule *) override
Displays the list of variables managed by a module.
std::map< String, IVariableFactory * > VariableFactoryMap
Type of the list of variable factories by full name.
IVariableMngInternal * _internalApi() override
Internal Arcane API.
IObservable * readObservable() override
Observable for variables being read.
IVariableUtilities * utilities() const override
Interface of associated utility functions.
void _dumpVariable(const VariableRef &v, std::ostream &o)
Writes the value of variable v to the stream o.
void addVariable(IVariable *var) override
Adds a variable.
ISubDomain * m_sub_domain
Subdomain manager.
void dumpStatsJSON(JSONWriter &writer) override
Writes statistics with the writer writer.
Integer m_generate_name_id
Number used to generate a variable name.
List< VariableRef * > m_auto_create_variables
List of variables created automatically during a restart.
FullNameVariableMap m_full_name_variable_map
List of variables by full name.
void readVariables(IDataReader *, IVariableFilter *) override
Reads all variables.
void writeVariables(IDataWriter *, const VariableCollection &vars) override
Exports the variables.
void detachMeshVariables(IMesh *mesh) override
Detaches variables associated with the mesh mesh.
ITraceMng * traceMng() override
Message manager.
String generateTemporaryVariableName() override
Generates a name for a temporary variable.
void removeVariableRef(VariableRef *) override
Removes a reference to a variable.
ISubDomain * subDomain() override
Sub-domain manager.
IVariable * findVariable(const String &name) override
Returns the variable named name or 0 if no such name exists.
VariableFactoryMap::value_type VariableFactoryPair
Pair of the list of variables by full name.
EventObservable< const VariableStatusChangedEventArgs & > & onVariableAdded() override
Event sent when a variable is created.
VariableCollection usedVariables() override
List of used variables.
void removeVariable(IVariable *var) override
Removes a variable.
void build() override
Constructs the instance members.
void notifyUsedVariableChanged() override
Notifies the manager that a variable's state has changed.
void addVariableRef(VariableRef *ref) override
Adds a reference to a variable.
IVariable * findMeshVariable(IMesh *mesh, const String &name) override
Returns the mesh variable named name or 0 if no such name exists.
void initialize() override
Initializes the instance. The instance is not usable until this method has been called.
ISubDomain * _internalSubDomain() const override
void removeAllVariables() override
Removes and destroys the variables managed by this manager.
VariableRefList m_variables_ref
List of variables.
FullNameVariableMap::value_type FullNameVariablePair
Pair of the list of variables by full name.
void writeCheckpoint(ICheckpointWriter *) override
Writes variables for a checkpoint.
IParallelMng * parallelMng() const override
Associated parallelism manager.
void writePostProcessing(IPostProcessorWriter *writer) override
Writes variables for post-processing.
IVariableSynchronizerMng * synchronizerMng() const override
Interface of the variable synchronization manager.
std::map< String, IVariable * > FullNameVariableMap
Type of the list of variables by full name.
~VariableMng() override
Destroys the manager.
VariableCollection variables() override
List of variables.
void initializeVariables(bool) override
Initializes the variables.
EventObservable< const VariableStatusChangedEventArgs & > & onVariableRemoved() override
Event sent when a variable is destroyed.
void dumpStats(std::ostream &ostr, bool is_verbose) override
Writes statistics about variables to the stream ostr.
VariableMng(ISubDomain *sd)
Constructs a variable manager for the case pn.
void readCheckpoint(ICheckpointReader *) override
Reads all variables from a checkpoint.
Management of variable reading.
Variable synchronizer manager.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< VariableRef * > VariableRefCollection
Collection of variables.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.
List< VariableRef * > VariableRefList
Array of variable references.
std::int32_t Int32
Signed integer type of 32 bits.
Structure equivalent to the boolean value true.