-
Notifications
You must be signed in to change notification settings - Fork 100
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
add update_density and update_parameter function #298
base: development
Are you sure you want to change the base?
add update_density and update_parameter function #298
Conversation
…xists. additionally, update_parameter functions were implemented and an update_variables argument with default setting false was added to the load_PhysiCell_config_file, parameters.read_from_pugixml, and setup_microenvironment_from_XML functions.
…through an error, if one tries to update a density or parameter that not already exists.
…through an error, if one tries to update a density or parameter that not already exists.
as discussed, update_density and update_parameter through an error, if one tries to update a density or parameter that not already exists. the rest is the same. |
return; | ||
} | ||
|
||
template <class T> |
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.
Can you call the above implementation of update_parameter
to simplify this function and the codebase?
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.
@drbergman i am not sure if i really can do what you ask for, as i try to update parameters.
i don't have "default values", as in the add case.
this is as concise as i can do it.
please write here how i really should do it so that it is acceptable for you. thank you.
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.
My intention is something super simple and it seems you took a big step towards it having all 3 of these call assert_exists
. But something like this could make it even tighter:
void Parameters<T>::update_parameter( std::string my_name , T my_value , std::string my_units )
{
update_parameters( my_name, my_value); // will check my_name exists and then set the value to my_value
parameters[find_index(my_name)].units = my_units;
return;
}
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.
or I think you could even use parameters[my_name]
instead of parameters[find_index(my_name)]
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.
also, looking at the []
operator on strings, it already checks for existence.
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.
oh yeah? I mean, we could throw in some const
and pass by reference to reduce any overhead costs. I imagine these functions won't be called nearly enough though to make a noticeable impact on performance. Or will they?
Finally, I personally find this kind of coding to be so much easier to maintain that it easily makes it worth the computational tradeoff (at least as I imagine the magnitude of the cost)
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.
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.
hmmm...I don't think I'm able to communicate this...your original is the best of these, in my opinion
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.
oh yes, it will get called often. I my case every iteration.
but i know, the PhysiCell core code is not written for only one project. so this argument has no weight.
at this moment i just try to get the code, the new functions, into the base. that's all.
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.
@drbergman could you please confirm that the conflict / conversation / change you requested has resolved (as i think so ).
or let me know if otherwise?
i don't think it is appropriate when i click the resolved button.
thank you, Elmar
return; | ||
} | ||
|
||
void Microenvironment::update_density( std::string name , std::string units, double diffusion_constant, double decay_rate ) |
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.
Can you use the above implementation of update_density
to simplify this function and the codebase?
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.
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.
yup
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 still think it is odd to have to implement a slower version because of code maintenance.
before we had to call the find_index function 1 time, now 3 or 4 times.
just to avoid storing the value in a variable?
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.
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.
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 pushed these changes and hope they are ok and get merged.
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.
@drbergman could you please confirm that the conflict / conversation / change you requested has resolved (as i think so ).
or let me know if otherwise?
i don't think it is appropriate when i click the resolved button.
thank you, Elmar
@drbergman can you please give your ok to this change? |
pull request for the staled pull request #264, #250 and #232.
this pull request is compatible with physicell version 1.14.0 and keeps the changes to the existing code bases as small as possible.
default settings were chosen so that the current models not will break through these changes.
each case was manually tested, the code works as expected.
add_density and add_parameter functions:
update_density and update_parameter functions:
function calls arguments: