-
Notifications
You must be signed in to change notification settings - Fork 98
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
avoid the possibility of having multiple parameters or multiple densities with the same name. #232
Conversation
…e and multiple densities with the same name.
This is a good improvement! Let's also take the opportunity to make this more maintainable and change the first two
|
} | ||
else | ||
{ | ||
std::cout << "Warning: density " << name << " alredy exist!" << std::endl; |
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 we ought to throw an error here. I know that's not strictly backwards compatible , but we should force the user to reckon with adding two identical substrates.
- For readability, let's have the current
else
block be the first case (if (find_density_index( name ) >= 0)
) so that we can throw an error (orreturn
if that's what we choose) and then do away with the brackets afterwards
I think this is a great idea, particularly in throwing an error in many cases. It seems like this is still under active diswcusssion / development, so let's not approve just yet. |
thank you @drbergman for the suggestions. I will look into it. |
Hmm, @drbergman and @MathCancer, throwing an Error will cause troubles with the very project that made me aware of this issue. I argue, so far, for running PhysiCell the common way, it was never a problem that it would have been possible to have multiple same named densities or parameters. So, spitting out a Waring and simply having the values overwritten should be good enough for the common user. There has not to be an Error. |
in that case, I think it's ok to leave it as a warning for now. it's how PhysiCell has operated all this time anyways. |
@elmbeech The framework cannot be designed project specific, if we think about the future and troubleshooting simulations, throwing a error should be more appropriate, as this can avoid potential issues in duplication in the grammar keys. |
@heberlr in I do not agree. in any case, we talk here about a subject that was not a problem for the last 10 years at all. |
Let's try to list the pros and cons:
Cons:
The dilemma is: Should we help the user build the model and prevent unexpected behavior by not allowing duplicate names, or should we expect them to look for the outcomes by checking the warning messages? One argument in favor of your PR is that nowadays the likelihood of an user developing a model by editing the XML is very low. |
ok. you don't get the real problem. anyhow through an error. it's ok with me. i don't care. |
superseded by pull request #250 . NF |
I think you mean #250. but yes, this one can be closed |
In the current PhysiCell implementation, it is possible to generate multiple parameters with the same name. It is also possible to multiple substrates (density) with the same name.
I changed the modules/PhysiCell_settings.cpp add_parameter functions so that they first check if a parameter with this name already exists, before pushing a new entry to the container.
I changed the BioFVM/BioFVM_microenvironment.cpp add_density functions so, that they first check if a density with this name already exist, before pushing a new entry to the containers.
This change will avoid having more than one parameter or density with the same name.