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

disconnect between Studio and C++ for custom cell functions, etc. #265

Open
rheiland opened this issue Jul 14, 2024 · 1 comment
Open

disconnect between Studio and C++ for custom cell functions, etc. #265

rheiland opened this issue Jul 14, 2024 · 1 comment

Comments

@rheiland
Copy link
Collaborator

I'd welcome a discussion about this issue. In the C++ custom.cpp, create_cell_types(), we define cell types' functions. But this assumes those cell types (beyond cell_defaults) have been defined, e.g. via initialize_cell_definitions_from_pugixml. The Studio allows dynamic creation of cell types, but this only defines them in the XML. When a Copy of a cell type is created in the Studio, we somehow want it to also inherent the functions of the original cell type (or at least have that option). Actually, the issue goes beyond just wanting to copy custom cell functions.

I noticed this as a "problem" when I was playing with a potential reference model for the POSE grant where I had defined a horizontal motility vector for cell_defaults and I wanted copies of this (in the Studio) to inherent the same motility vector. More recently, I've been experimenting with a new custom_division_function which gets invoked in the divide() function. Once again, it works fine for the cell_defaults, but not for any copied cell type.

@drbergman
Copy link
Collaborator

Isn't this the purpose of the parent attribute for cell types? That's what I assume these lines were written for:

Cell_Definition* pParent = NULL;
if( cd_node.attribute( "parent_type" ) )
{ pParent = find_cell_definition( cd_node.attribute( "parent_type" ).value() ); }
// if it's not the default and no parent stated, inherit from default
bool use_default_as_parent_without_specifying = false;
if( pParent == NULL && pCD != &cell_defaults )
{
pParent = &cell_defaults;
use_default_as_parent_without_specifying = true;
}
// if we found something to inherit from, then do it!
if( pParent != NULL )
{
std::cout << "\tCopying from type " << pParent->name << " ... " << std::endl;
*pCD = *pParent;
// but recover the name and ID (type)
pCD->name = cd_node.attribute("name").value();
pCD->type = cd_node.attribute("ID").as_int();
}

Could we just add a way to set the parent type in studio and be good on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants