-
Notifications
You must be signed in to change notification settings - Fork 244
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
[GeoMechanicsApplication] Support residual_criterion in c++ interface #11833
Conversation
… usable in the factory (and other factories)
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.
Meets the objective of making residual_criterion available and having a unit test for it.
|
||
for (const std::string& entry : rNamesOfParametersToCopy) | ||
{ | ||
if (rSourceParameters.Has(entry)) | ||
{ | ||
result.AddValue(entry, rSourceParameters[entry]); | ||
} | ||
} | ||
|
||
return result; | ||
} |
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.
Good that this is now shared i.s.o. copied.
applications/GeoMechanicsApplication/custom_utilities/convergence_criteria_factory.hpp
Outdated
Show resolved
Hide resolved
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 like a clear and clean extension of existing functionality. I also like it a lot that you have eliminated some duplicated code. Well done! I only have a few minor suggestions, nothing blocking.
const std::vector<std::string> entries_to_copy = { | ||
"displacement_absolute_tolerance", | ||
"displacement_relative_tolerance"}; | ||
Parameters convergence_inputs = ParametersUtilities::ExtractParameters(rSolverSettings, entries_to_copy); |
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 would make this variable const
:
Parameters convergence_inputs = ParametersUtilities::ExtractParameters(rSolverSettings, entries_to_copy); | |
const auto convergence_inputs = ParametersUtilities::ExtractParameters(rSolverSettings, entries_to_copy); |
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.
Done, for some other constructors this was not possible, but here it seems okay
applications/GeoMechanicsApplication/custom_utilities/convergence_criteria_factory.hpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/convergence_criteria_factory.hpp
Outdated
Show resolved
Hide resolved
|
||
for (const std::string& entry : rNamesOfParametersToCopy) | ||
{ | ||
if (rSourceParameters.Has(entry)) | ||
{ | ||
result.AddValue(entry, rSourceParameters[entry]); | ||
} | ||
} | ||
|
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.
Now that we have changed the behavior of this function, I'm pondering whether we should rename it to indicate that it will only copy parameters that exist in rSourceParameters
. The supplied parameter names don't have to be present there and they are silently skipped if they don't. The only suggestion that comes to my mind now is CopyOptionalParameters
. (Its counterpart could then be named CopyRequiredParameters
.) What do you think?
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.
Good suggestion, I brought back the old function so we can use both
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.
We are very happy with these changes, so please merge this PR.
This PR adds support for another convergence criterion, including the following changes: