-
Notifications
You must be signed in to change notification settings - Fork 21
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
Variable::clone() duplicates units without checking whether they exist in cloned model #558
Comments
The true location of the unexpected behaviour is deep inside the
|
ie: calling |
Yes it does so the fix is to make sure the referenced units are findable. I have a solution for this. It is not the fault of variable clone method. |
This isn't entirely true, although it has led me to find an issue with equivalent units. |
You're right, it's actually the level below ... if |
Ah, I think I've got it now. We don't take account of child units when creating the requiredUnits list - only those directly called by the variables. That means we end up with orphans later, so they can't be compared. |
I have been making changes all over the place right now trying to put it back together so you can see what I hvae done. |
The series of cloning methods used inside
Model::flatten()
result in a cloned component with more units references than the original. This is because:Variable::clone()
automatically creates a newUnits
instance whether or not one exists:usedUnits
function collects more than one copy of the units within theflattenComponent
method,At the model level this is fixed by calling the
linkUnits()
function, but since the flattening happens at a component level it's causing problems for the stuff happening within theflattenComponent()
function. Any thoughts @agarny @hsorby @nickerso ?The text was updated successfully, but these errors were encountered: