14#include "arcane/impl/DefaultBackwardMng.h"
16#include "arcane/core/IVariableFilter.h"
17#include "arcane/core/IVariable.h"
18#include "arcane/core/IVariableMng.h"
19#include "arcane/core/ISubDomain.h"
20#include "arcane/core/IParallelMng.h"
21#include "arcane/core/CommonVariables.h"
22#include "arcane/core/Timer.h"
23#include "arcane/core/VariableCollection.h"
25#include "arcane/utils/ITraceMng.h"
27#include "arcane/impl/MemoryDataReaderWriter.h"
57DefaultBackwardMng(ITraceMng* trace, ISubDomain* sub_domain)
59, m_sub_domain(sub_domain)
65, m_action_refused(true)
66, m_sequence(SEQNothing)
68 ARCANE_ASSERT((m_trace), (
"ITraceMng pointer null"));
69 ARCANE_ASSERT((m_sub_domain), (
"ISubDomain pointer null"));
71 m_filter =
new RestoreVariableFilter();
73 m_data_io =
new MemoryDataReaderWriter(trace);
103 m_trace->pfatal() <<
"Trying to go backward during an action phase";
108 m_trace->pfatal() <<
"Impossible to go backward while it is already going backward";
113 m_trace->info() <<
"Execution of the backward mode !";
119void DefaultBackwardMng::
148 _checkSave(is_forced);
155 m_trace->info() <<
"Physical time of the last backward reached or passed. Save is forced";
166void DefaultBackwardMng::
179void DefaultBackwardMng::
182 Timer::Action ts_action(m_sub_domain,
"RestoreSave");
184 m_trace->
info() <<
"Saving variable before going backward";
195 m_trace->
info() <<
"Memory allocated for the variables (in Mo): used="
196 << var_mem <<
" max=" << max_var_mem;
208 m_trace->pfatal() <<
"Begin of action requested before the end";
217void DefaultBackwardMng::
218_checkSave(
bool is_forced)
241 const Integer iteration = m_sub_domain->commonVariables().globalIteration();
243 bool do_save =
false;
247 do_save |= (iteration %
m_period) == 0;
Real globalTime() const
Current time.
bool m_first_save
First save.
virtual bool checkAndApplyRestore() override
Checks and applies restoration if necessary.
virtual bool checkAndApplySave(bool is_forced) override
Checks and applies variable saving if necessary. If is_forced is true, forces the save.
void beginAction() override
Indicates that the save/restore actions have started.
void endAction() override
Indicates that the save/restore actions are finished.
void clear() override
Deletes resources associated with the backward rollback.
Integer m_period
Period between two saves for backward tracking.
eSequence m_sequence
Sequence.
void goBackward() override
Signals that a backward rollback is desired.
bool m_action_refused
Actions allowed?
Real m_backward_time
Time of the last requested backward action.
@ SEQForceSave
Forced save.
Exception when a fatal error has occurred.
virtual char reduce(eReduceType rt, char v)=0
Performs a reduction of type rt on the real v and returns the value.
virtual const CommonVariables & commonVariables() const =0
Information on standard variables.
virtual IParallelMng * parallelMng()=0
Returns the parallelism manager.
virtual IVariableMng * variableMng()=0
Returns the variable manager.
virtual TraceMessage info()=0
Stream for an information message.
Functor of a filter applicable to variables.
virtual void readVariables(IDataReader *reader, IVariableFilter *filter=0)=0
Reads all variables.
virtual void writeVariables(IDataWriter *writer, IVariableFilter *filter=0)=0
Writes the variables.
virtual Real exportSize(const VariableCollection &vars)=0
Estimated size for exporting variables.
@ PTemporary
Indicates that the variable is temporary.
@ PNoRestore
Indicates that the variable should not be restored.
virtual int property() const =0
Returns the properties of the variable.
virtual bool isUsed() const =0
Usage state of the variable.
virtual bool applyFilter(IVariable &var)
Applies the filter to the variable var.
@ ReduceMax
Maximum of values.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.