-
Notifications
You must be signed in to change notification settings - Fork 248
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
[Core] Forbid Renaming ModelParts #12148
base: master
Are you sure you want to change the base?
Conversation
What about update the hash map? |
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.
Requires further discussion
We can make the Name() method const and update the implementation of the Rename method |
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.
makes full sense to me, I think this is a leftover from early Model
days
std::string& Name() | ||
{ | ||
return mName; | ||
} | ||
|
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.
yikes, time to go 👋
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.
In this particualr case yes, it makes sense
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.
add_model_part_to_python.cpp:46:25: error: no match for 'operator=' (operand types are 'const std::string' {aka 'const std::__cxx11::basic_string<char>'} and 'const std::string' {aka 'const std::__cxx11::basic_string<char>'})
Looks like python binding is a bit hardcoded
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.
Algo agree with this one
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.
😮
Is there a valid use case tho? I'd rather just remove the entire thing than move |
Well, i guess if the method was there is beacuse somone was using it |
@loumalouomega @KratosMultiphysics/technical-committee can you please come to a consensus on this one? |
I agree about making Name const, but I am.a bit afraid of not having any way of renting a smodelpart. Shouldnt we allow it at least from model? |
Description
ModelPart
allows resetting its name, which breaks sub model part containers. These containers are hash maps that generate their hashes based on the model part's name. However, when aModelPart
is renamed, the sub model part container of its parent doesn't update its hash map, which completely breaks access to sub model parts.Changelog
std::string& ModelPart::Name()
(the mutable overload)Model::RenameModelPart
and its corresponding test