Skip to content
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

ParameterHandler::add_parameter(): do not call action #14562

Merged
merged 1 commit into from Mar 13, 2023

Conversation

peterrum
Copy link
Member

@peterrum peterrum commented Dec 11, 2022

closes #13970

FYI @mschreter

Comment on lines 2 to 5
call the internal action. Since the action converts during
that step the default value to a string and afterwards back,
this could lead to rounding-off errors so that the default
values might change in the case of floating-point numbers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
call the internal action. Since the action converts during
that step the default value to a string and afterwards back,
this could lead to rounding-off errors so that the default
values might change in the case of floating-point numbers.
call the internal action. Within that step, the action
converts the default value to a string and back afterwards.
This can lead to round-off errors so that the default
values might change in the case of floating-point numbers.

const std::string default_value = entries->get<std::string>(
get_current_full_path(entry) + path_separator + "default_value");
action(default_value);
if (excecute_action)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (excecute_action)
if (execute_action)

@peterrum
Copy link
Member Author

@masterleinad Thanks for the review!

Copy link
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost.

Comment on lines 1159 to +1181
void
add_action(const std::string & entry,
const std::function<void(const std::string &value)> &action);
const std::function<void(const std::string &value)> &action,
const bool execute_action = true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to adjust the documentation of the function accordingly. The first bullet point of the documentation states that the action is executed at the end of the call to this function, but this is now no longer generally true.

action(default_value);
if (execute_action)
{
// as documented, run the action on the default value at the very end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove this line -- it is no longer actually true.

@bangerth
Copy link
Member

Ping?

@peterrum
Copy link
Member Author

Ping?

We (@mschreter) made the changes! Thanks for the review!

@mschreter
Copy link
Contributor

@bangerth Ping :-)?

@bangerth
Copy link
Member

My apologies for forgetting about this :-( The logs are no longer available for the CI checks (they get deleted after some time), but I'm pretty sure that the patch is safe and so I will merge. Let's hope that I'm not going to make a fool out of myself for it...

@bangerth bangerth merged commit ad2c738 into dealii:master Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should ParameterHandler::add_parameter() execute the action?
4 participants