37 mCancelDelegate = rCancelDelegate;
42 mProgressDelegate = rProgressDelegate;
47 mTimeStepExecutor->SetProcessObservables(rProcessObservables);
52 mTimeIncrementor = std::move(pTimeIncrementor);
57 mStrategyWrapper = std::move(pStrategyWrapper);
58 mTimeStepExecutor->SetSolverStrategy(mStrategyWrapper);
63 mStrategyWrapper->Initialize();
64 mStrategyWrapper->SaveTotalDisplacementFieldAtStartOfTimeLoop();
65 std::vector<TimeStepEndState> result;
68 while (mTimeIncrementor->WantNextStep(NewEndState) && !IsCancelled()) {
69 mStrategyWrapper->IncrementStepNumber();
71 mStrategyWrapper->CloneTimeStep();
72 NewEndState = RunCycleLoop(NewEndState);
73 mStrategyWrapper->AccumulateTotalDisplacementField();
74 mStrategyWrapper->FinalizeSolutionStep();
75 mStrategyWrapper->OutputProcess();
76 result.emplace_back(NewEndState);
86 const auto time_increment = mTimeIncrementor->GetIncrement();
87 mStrategyWrapper->SetTimeIncrement(time_increment);
88 const auto end_time = PreviousTime + time_increment;
89 mStrategyWrapper->SetEndTime(
end_time);
91 auto end_state = mTimeStepExecutor->Run(
end_time);
92 mTimeIncrementor->PostTimeStepExecution(end_state);
97 TimeStepEndState RunCycleLoop(
const TimeStepEndState& previous_state)
99 auto cycle_number = 0;
100 auto end_state = previous_state;
101 while (mTimeIncrementor->WantRetryStep(cycle_number, end_state) && !IsCancelled()) {
102 if (cycle_number > 0) mStrategyWrapper->RestorePositionsAndDOFVectorToStartOfStep();
103 end_state = RunCycle(previous_state.time);
107 end_state.num_of_cycles = cycle_number;
111 bool IsCancelled()
const {
return mCancelDelegate && mCancelDelegate(); }
113 void UpdateProgress(
double Time)
const
115 if (mProgressDelegate) {
116 mProgressDelegate(Time);
120 std::unique_ptr<TimeIncrementor> mTimeIncrementor;
121 std::function<
bool()> mCancelDelegate;
122 std::function<void(
double)> mProgressDelegate;
123 std::unique_ptr<TimeStepExecutor> mTimeStepExecutor = std::make_unique<TimeStepExecutor>();
124 std::shared_ptr<StrategyWrapper> mStrategyWrapper;
Definition: scoped_output_file_access.h:21
Definition: time_loop_executor.hpp:33
std::vector< TimeStepEndState > Run(const TimeStepEndState &EndState) override
Definition: time_loop_executor.hpp:61
void SetProgressDelegate(const std::function< void(double)> &rProgressDelegate) override
Definition: time_loop_executor.hpp:40
void SetSolverStrategyWrapper(std::shared_ptr< StrategyWrapper > pStrategyWrapper) override
Definition: time_loop_executor.hpp:55
void SetProcessObservables(const std::vector< std::weak_ptr< Process >> &rProcessObservables) override
Definition: time_loop_executor.hpp:45
void SetCancelDelegate(const std::function< bool()> &rCancelDelegate) override
Definition: time_loop_executor.hpp:35
void SetTimeIncrementor(std::unique_ptr< TimeIncrementor > pTimeIncrementor) override
Definition: time_loop_executor.hpp:50
Definition: time_loop_executor_interface.h:31
end_time
Definition: DEM_benchmarks.py:174
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
Definition: time_step_end_state.hpp:23