Since the memory is held by the C++, resizing operations cannot be performed on c++-owned arrays, even in writeable contexts.
The only clean way is to implement the basic resizing methods in Sofa.Core.DataContainer such as:
- resize
- push_back / front
- pop_back / front
- insert / erase
- ...
And also, we want to reimplement setattr(s = "value") in DataContainer to be able to reallocate & copy lists from python to be able to do stuff like:
myComponent.myVector.value = [a list with different shape] # won't work
Meanwhile, workaround hack is to retrieve a Sofa.Core.Data instead of DataContainer to use its setattr method:
myComponent.getData("myVector").value = [array with different shape] # works
Since the memory is held by the C++, resizing operations cannot be performed on c++-owned arrays, even in writeable contexts.
The only clean way is to implement the basic resizing methods in Sofa.Core.DataContainer such as:
And also, we want to reimplement setattr(s = "value") in DataContainer to be able to reallocate & copy lists from python to be able to do stuff like:
Meanwhile, workaround hack is to retrieve a Sofa.Core.Data instead of DataContainer to use its setattr method: