Skip to content
Snippets Groups Projects
Commit f1c90be9 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

[Cleanup] Move parset.get() out of a loop

parent 66d2fbc5
No related branches found
No related tags found
No related merge requests found
......@@ -423,6 +423,12 @@ int main(int argc, char *argv[]) {
SingletonVectorType alpha = alpha_initial;
auto const state_fpi_max =
parset.get<size_t>("solver.tnnmg.fixed_point_iterations");
auto const fixedPointTolerance =
parset.get<double>("solver.tnnmg.fixed_point_tolerance");
auto const damping = parset.get<double>("solver.damping");
auto const minimalCorrectionReduction =
parset.get<double>("solver.minimal_correction_reduction");
auto const printProgress = parset.get<bool>("printProgress");
for (size_t run = 1; run <= timesteps; ++run) {
VectorType u;
double lastCorrection;
......@@ -469,12 +475,6 @@ int main(int argc, char *argv[]) {
// Since the velocity explodes in the quasistatic case, use the
// displacement as a convergence criterion
VectorType u_saved;
double const fixedPointTolerance =
parset.get<double>("solver.tnnmg.fixed_point_tolerance");
double const damping = parset.get<double>("solver.damping");
double const minimalCorrectionReduction =
parset.get<double>("solver.minimal_correction_reduction");
for (size_t state_fpi = 1; state_fpi <= state_fpi_max; ++state_fpi) {
stateUpdater->solve(v);
{
......@@ -499,14 +499,14 @@ int main(int argc, char *argv[]) {
timeSteppingScheme->extractVelocity(v);
iterationWriter << iterationCounter << " ";
if (parset.get<bool>("printProgress")) {
if (printProgress) {
std::cerr << '.';
std::cerr.flush();
}
if (state_fpi > 1) {
double const correctionNorm = velocityEnergyNorm.diff(u_saved, u);
if (correctionNorm < fixedPointTolerance) {
if (parset.get<bool>("printProgress")) {
if (printProgress)) {
std::cerr << '#';
std::cerr.flush();
}
......@@ -518,7 +518,7 @@ int main(int argc, char *argv[]) {
u_saved = u;
}
if (parset.get<bool>("printProgress"))
if (printProgress)
std::cerr << std::endl;
for (size_t i = 0; i < frictionalNodes.size(); ++i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment