Skip to content
Snippets Groups Projects
Commit 16ab8dfc authored by Tom Fischer's avatar Tom Fischer
Browse files

[PL/TimeLoop] Pass information as parameters instead directly access private attributes

The goal is to make the function independent from the TimeLoop class
parent 9b058afd
No related branches found
No related tags found
No related merge requests found
......@@ -327,8 +327,14 @@ std::pair<double, bool> TimeLoop::computeTimeStepping(
auto& ppd = *_per_process_data[i];
const auto& timestep_algorithm = ppd.timestep_algorithm;
auto const& conv_crit = ppd.conv_crit;
auto const& x = *_process_solutions[i];
auto const& x_prev = *_process_solutions_prev[i];
const double solution_error =
computeRelativeSolutionChangeFromPreviousTimestep(t, i);
computeRelativeSolutionChangeFromPreviousTimestep(
t, timestep_algorithm.get(), conv_crit.get(), x, x_prev);
ppd.timestep_current.setAccepted(
ppd.nonlinear_solver_status.error_norms_met);
......@@ -878,18 +884,15 @@ TimeLoop::~TimeLoop()
}
double TimeLoop::computeRelativeSolutionChangeFromPreviousTimestep(
double const t, std::size_t process_index) const
double const t, NumLib::TimeStepAlgorithm const* timestep_algorithm,
NumLib::ConvergenceCriterion const* conv_crit, GlobalVector const& x,
GlobalVector const& x_prev) const
{
auto const& ppd = *_per_process_data[process_index];
if (!computationOfChangeNeeded(ppd.timestep_algorithm.get(), t))
if (!computationOfChangeNeeded(timestep_algorithm, t))
{
return 0.0;
}
auto const& x = *_process_solutions[process_index];
auto const& x_prev = *_process_solutions_prev[process_index];
auto const& conv_crit = ppd.conv_crit;
const MathLib::VecNormType norm_type = (conv_crit)
? conv_crit->getVectorNormType()
: MathLib::VecNormType::NORM2;
......
......@@ -132,7 +132,9 @@ private:
std::vector<std::function<double(double, double)>>
generateOutputTimeStepConstraints(std::vector<double>&& fixed_times) const;
double computeRelativeSolutionChangeFromPreviousTimestep(
double const t, std::size_t process_index) const;
double const t, NumLib::TimeStepAlgorithm const* timestep_algorithm,
NumLib::ConvergenceCriterion const* conv_crit, GlobalVector const& x,
GlobalVector const& x_prev) const;
void preOutputInitialConditions(const double t) const;
std::vector<GlobalVector*> _process_solutions;
std::vector<GlobalVector*> _process_solutions_prev;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment