-
Notifications
You must be signed in to change notification settings - Fork 260
Refactored repeated code into lambda functions for readability. #6782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Refactored repeated code into lambda functions for readability. #6782
Conversation
3110ee8 to
38f1d44
Compare
bangerth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, nice -- that makes the code less repetitive!
source/simulator/solver_schemes.cc
Outdated
| auto recompute_rhs = [&]() | ||
| { | ||
| dcr.velocity_residual = system_rhs.block(velocity_block_index).l2_norm(); | ||
| dcr.pressure_residual = system_rhs.block(pressure_block_index).l2_norm(); | ||
| dcr.residual = std::sqrt(dcr.velocity_residual * dcr.velocity_residual + | ||
| dcr.pressure_residual * dcr.pressure_residual); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't quite the right name for the lambda. You're not actually computing right hand sides, just taking norms. Perhaps call it update_residuals?
38f1d44 to
aae3c92
Compare
gassmoeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good to me. I will start the testers, but if they succeed this should be ready to merge.
|
/rebuild |
I refactored some code in the function do_one_defect_correction_Stokes_step to enhance readability. This includes refactoring repeated, small sections of code into lambda functions.
[X ] I have followed the instructions for indenting my code.
[X ] I have tested my new feature locally to ensure it is correct.