Skip to content

Sofa.Core.DataContainer: add basic vector manipulations #139

Open

Description

@marques-bruno

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

Activity

  1. self-assigned this
    on Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug (minor)enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions