Cloning Components in PowerElectronics Module - #552
Conversation
ab34f6c to
1802d2f
Compare
1802d2f to
6e29664
Compare
superwhiskers
left a comment
There was a problem hiding this comment.
this change looks pretty inoffensive. one comment, however:
why are we adding isCloneable for only one component (the Bus) to not support cloning? additionally, might it be better to implement this by using a subclass of CircuitComponent that implies cloneability, or something else? it's not like cloning is going to change at runtime, so it might be cleaner to add some structural way to ensure a component being used supports cloning without doing a runtime check by calling isCloneable.
nkoukpaizan
left a comment
There was a problem hiding this comment.
A few comments. At a higher level:
- I don't see anything preventing calling the copy constructor on non-clonable components.
- It's not clear to me what is the intended functionality of the clones. More documentation would be helpful.
I added clone to I think having a cloneable subclass such as |
|
I talked to @abdourahmanbarry in person. I think it makes a lot more sense to have all components be cloneable and remove the The problem with a |
I am using clone as part of my implementation for partition interfaces in the next pull request on this stack. I have also updated the implementation of the copy constructor such that it should be okay to call it independently of the clone. Let me know if these changes look good. |
What I was trying to get at is that if |
7027694 to
9aae154
Compare
Description
This pull request implements clone functionality for components in the
PowerElectronicsmodule. This gives us the ability to create independent copies of components such that modifications to one do not affect the other.Proposed changes
Each component implements the
isCloneableandclonemethods. TheisCloneablemethod returnstrueif the component is cloneable andfalseotherwise. Theclonemethod returns a pointer to a new object with the same state as the component from which it was cloned. After cloning a component, the user should set the data pointers for the clone.Checklist
-Wall -Wpedantic -Wconversion -Wextra.Further Comments
This functionality is useful for the partitioning implementation.