Sofa.Core.Context

class Sofa.Core.Context

Bases: BaseContext

class SearchDirection(self: Sofa.Core.BaseContext.SearchDirection, value: int)

Bases: pybind11_object

property name
addData(*args, **kwargs)

Overloaded function.

  1. addData(self: object, name: str, value: object = None, default: object = None, help: str = ‘’, group: str = ‘’, type: str = ‘’) -> sofa::core::objectmodel::BaseData

    Create a data field, then adds it to the base

    Note that this method should only be called if the field was not initialized with the initData method

    param self:

    the base itself

    param name:

    the name of the data to be added

    param value:

    the value from which the data can be created

    param help:

    help message that describes the data to be created

    param group:

    the group the data belongs to

    param type:

    the type of the data

    type self:

    object

    type name:

    string

    type value:

    object

    type help:

    string

    type group:

    string

    type type:

    string

  2. addData(self: Sofa.Core.Base, arg0: object) -> sofa::core::objectmodel::BaseData

    Add a data field

    param self:

    the base itself

    param d:

    the data to be added

    type self:

    Base*

    type d:

    object

    This method should only be called if the field was not initialized with the initData method

Create a Link to a SOFA component and adds it to the base

Parameters:
  • self (object) – the base itself

  • name (string) – the name of the link to be added

  • value (object) – the value from which the data can be created (either a pathname or a SofaBase)

  • help (string) – help message that describes the link to be created

This method should only be called if the field was not initialized with the initLink method

canChangeSleepingState(self: Sofa.Core.BaseContext) bool

Whether the context can change its sleeping state or not

clearLoggedMessages(self: Sofa.Core.Base) object

Remove all logged messages in the object’s logs

countLoggedMessages(self: Sofa.Core.Base) object

Returns the number of messages in the object’s logs

findData(self: Sofa.Core.Base, arg0: str) sofa::core::objectmodel::BaseData

Find a data field given its name

If more than one field is found (due to aliases), only the first is returned.

:param name :type name: string :return: the data field or None

Find a link given its name

Return NULL if not found. If more than one link is found (due to aliases), only the first is returned.

Parameters:

name (string) – the name of the link

Returns:

the link

getAnimate(self: Sofa.Core.BaseContext) bool

Animation flag

getClass(self: Sofa.Core.Base) sofa::core::objectmodel::BaseClass

Return the class of the object

getClassName(self: Sofa.Core.Base) str

Get the name of the class of the Base.

getData(self: Sofa.Core.Base, arg0: str) object

Get the data field given its name

Parameters:
  • self (Base&) –

  • s (string) –

Returns:

the first data found of this name

getDataFields(self: Sofa.Core.Base) list

Accessor to the vector containing all the fields of this object :return: A vector containing the data fields

getDefinitionSourceFileName(self: Sofa.Core.Base) str

Returns the name of the file that contains the object definition.

getDefinitionSourceFilePos(self: Sofa.Core.Base) int

Returns the line number where the object is defined.

getDt(self: Sofa.Core.BaseContext) float

Simulation timestep

getGravity(self: Sofa.Core.BaseContext) sofa::type::Vec<3u, double>

Gravity in local coordinates

getInstanciationFileName(self: Sofa.Core.Base) str

Returns the line number where the object is instanciatiated.

getInstanciationSourceFilePos(self: Sofa.Core.Base) int

Returns the line number where the object is instanciatiated.

getLinkPath(self: Sofa.Core.Base) str

Returns the path name as a parsable string

Accessor to the vector containing all the links of this object

Returns:

A vector containing the links

getLoggedMessagesAsString(self: Sofa.Core.Base) object

Returns a single string with all the messages logged in the internal buffer of a sofa object. Return empty string if there is no messages.

getMass(self: Sofa.Core.BaseContext) sofa::core::behavior::BaseMass

Mass

getMechanicalState(self: Sofa.Core.BaseContext) sofa::core::behavior::BaseMechanicalState

Mechanical Degrees-of-Freedom

getMeshTopology(self: Sofa.Core.BaseContext, SearchDirection: Sofa.Core.BaseContext.SearchDirection = <SearchDirection.SearchUp: -1>) sofa::core::topology::BaseMeshTopology

Mesh Topology (unified interface for both static and dynamic topologies)

Mesh Topology (unified interface for both static and dynamic topologies)

getName(self: Sofa.Core.Base) str

Return the name of the entity

Return type:

string

getPathName(self: Sofa.Core.Base) str

Returns the path name as a string

```

getRootContext(self: Sofa.Core.BaseContext) Sofa.Core.BaseContext

Get the root context of the graph

getState(self: Sofa.Core.BaseContext) sofa::core::BaseState

Mechanical Degrees-of-Freedom

getTemplateName(self: Sofa.Core.Base) str

Get the name of the template of the Base.

getTime(self: Sofa.Core.BaseContext) float

Simulation time

getTopology(self: Sofa.Core.BaseContext) sofa::core::topology::Topology

Topology

isActive(self: Sofa.Core.BaseContext) bool

The Context is active

isSleeping(self: Sofa.Core.BaseContext) bool

Sleeping state of the context

setActive(self: Sofa.Core.BaseContext, arg0: bool) None

State of the context

setAnimate(self: Sofa.Core.BaseContext, arg0: bool) None

Animation flag

setChangeSleepingState(self: Sofa.Core.BaseContext, arg0: bool) None

Sleeping state change of the context

setDataValues(self: Sofa.Core.Base, **kwargs) object

Set values for a the given data field, multiple pairs of args are allowed.

setDefinitionSourceFileName(self: Sofa.Core.Base, arg0: str) None

set the name of the file that contains the object definition.

setDefinitionSourceFilePos(self: Sofa.Core.Base, arg0: int) None

Set the line number where the object is defined.

setDt(self: Sofa.Core.BaseContext, arg0: float) None

Simulation timestep

setGravity(self: Sofa.Core.BaseContext, arg0: sofa::type::Vec<3u, double>) None

Gravity in local coordinates

setInstanciationSourceFileName(self: Sofa.Core.Base, arg0: str) None

Set the line number where the object is instanciatiated.

setInstanciationSourceFilePos(self: Sofa.Core.Base, arg0: int) None

Set the line number where the object is instanciatiated.

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

Set the name of this object

:param n :type n: string

setSleeping(self: Sofa.Core.BaseContext, arg0: bool) None

Sleeping state of the context