Sofa.Core.DataContainer

class Sofa.Core.DataContainer

Bases: Data

Classic python container implemented for SOFA data fields

apply(self: Sofa.Core.DataContainer, arg0: function) None
array(self: Sofa.Core.DataContainer) numpy.ndarray
getCounter(self: Sofa.Core.Data) int

Return the number of changes since creation. This can be used to efficiently detect changes. :rtype: integer

getHelp(self: Sofa.Core.Data) str

Get the help message. :rtype: string

getLinkPath(self: Sofa.Core.Data) str

Return the path of the link to the data. :rtype: string

getName(self: Sofa.Core.Data) str

Get the name of the data. :rtype: string

getOwner(self: Sofa.Core.Data) object

Return the Base component owning this data. :rtype: Base

getParent(self: Sofa.Core.Data) Sofa.Core.Data

Return the parent data of this data. :rtype: BaseData

getPathName(self: Sofa.Core.Data) str

Return the name of the path of the data. :rtype: string

getValueString(self: Sofa.Core.Data) str

Print the value of the associated variable.

getValueTypeString(self: Sofa.Core.Data) str

Print the value of the associated variable.

getValueVoidPtr(self: Sofa.Core.Data) capsule

Get a constant void pointer to the value held in this data.

hasChanged(self: Sofa.Core.Data) bool

Update the data if it is dirty. :return: true if it is updated, false otherwise. ;rtype: boolean

hasParent(self: Sofa.Core.Data) bool

Check whether the data has a parent. :return: true if the data has a parent. :rtype: boolean

isDirty(self: Sofa.Core.Data) bool

Return true if the DDGNode needs to be updated.

isPersistent(self: Sofa.Core.Data) bool

Alias to match BaseData API. Checks whether the link requires a path in order to be created. :return: true if the link requires a path. :rtype: boolean

isReadOnly(self: Sofa.Core.Data) bool

Return whether this data will be read-only in GUIs. :return: True for read-only

isRequired(self: Sofa.Core.Data) bool

Check whether a data is flagged as required for the creation of an object. :return: true if it is required.

isSet(self: Sofa.Core.Data) bool

Check if the value has been modified If this data is linked, the value of this data will be considered as modified (even if the parent’s value has not been modified) :return: True if the data has been modified

property ndim

Return the number of dimensions in the container

read(self: Sofa.Core.Data, arg0: str) bool

Read the command line, set the value of the data to the given content of the command line. :param str: the content of the command line :type str: string

setName(self: Sofa.Core.Data, arg0: str) None

Set a new name for the data. :param name: the new name :type name: string

setParent(*args, **kwargs)

Overloaded function.

  1. setParent(self: Sofa.Core.Data, arg0: Sofa.Core.Data) -> None

    Set a new parent and a new path for the data. :param parent: the new parent of the data :param path: the new path of the data :type parent: BaseData :type path: string

  2. setParent(self: Sofa.Core.Data, arg0: str) -> None

    Set a new parent and a new path for the data. :param parent: the new parent of the data :param path: the new path of the data :type parent: BaseData :type path: string

  3. setParent(self: Sofa.Core.Data, arg0: sofapython3::LinkPath) -> None

    Set a new parent and a new path for the data. :param parent: the new parent of the data :param path: the new path of the data :type parent: BaseData :type path: string

setPersistent(self: Sofa.Core.Data, arg0: bool) None

Alias to match BaseData API. Changes the value of a flag, that should be set to true if link requires a path string in order to be created. :param bool: new value for the flag. :type bool: boolean

setReadOnly(self: Sofa.Core.Data, arg0: bool) None

Set whether this data is read-only. (True for read-only) :param bool: value of the read-only property :type bool: boolean

property shape

Return the shape of the container (a tuple of length ndim, with each value being equal to the length of the given dimension)

property size

Return the total number of elements in the container ( equivalent to math.prod(self.shape()) )

toList(self: Sofa.Core.DataContainer) object
typeName(self: Sofa.Core.Data) str

Return the name of the type of the data. :rtype: string

unset(self: Sofa.Core.Data) None

Reset the isSet flag to false, to indicate that the current value is the default for this data.

updateIfDirty(self: Sofa.Core.Data) None

Utility method to call update if necessary. This method should be called before reading or writing the value of this node.

writeable(*args, **kwargs)

Overloaded function.

  1. writeable(self: Sofa.Core.DataContainer, arg0: object) -> Sofa.Core.DataContainerContextManager

  2. writeable(self: Sofa.Core.DataContainer) -> Sofa.Core.DataContainerContextManager

writeableArray(*args, **kwargs)

Overloaded function.

  1. writeableArray(self: Sofa.Core.Data, arg0: object) -> sofapython3::DataContainerContext

    Return a writable array of the data given an Object. :param f: the object to convert into an array. :type f: python object :rtype: writeable array

  2. writeableArray(self: Sofa.Core.Data) -> sofapython3::DataContainerContext

    Return a new empty array. :rtype: writeable array