Base
The `Base` class in SOFA is the foundational class from which all other objects inherit. It provides essential functionality common to every object within the framework, such as managing data fields (including aliases), links between components, and retrieving information about an object like its name or type. **Role:** The primary role of `Base` is to define a consistent interface for querying and manipulating all SOFA objects. It ensures that every derived class can be queried for common attributes such as name, tags, bounding box, and component state. **Interactions with Other Components:** The `Base` class interacts with other components through its API by providing methods like `findData`, `findLink`, and `parseField`. These methods allow retrieval of data fields or links based on their names, setting field values from descriptions, and parsing configurations. The class also manages callbacks for updates to data fields, ensuring that the component state is correctly updated. **Usage Guidance:** The `Base` class should not be used directly; instead, it serves as a base for deriving specific components such as solvers, force fields, or visualizers. It includes mechanisms for managing logging, tags, and aliases for data fields and links. Data fields are initialized using the `initData` method, which ensures consistency across all derived classes. **Important Data Fields:** The class contains several important data fields: - `d_messageLogCount`: Counts logged messages. - `f_printLog`: Controls whether extra runtime messages are emitted. - `f_tags`: Represents subsets to which the object belongs. - `f_bbox`: Defines the bounding box for this object. - `d_componentState`: Stores the state of the component (e.g., Valid, Invalid). **Practical Usage:** The `Base` class provides mechanisms to add and remove data fields, links, and aliases through methods like `addData`, `removeData`, `addLink`, and `addAlias`. It also includes logging utilities for tracking messages generated during runtime. The component state can be queried using `getComponentState`, indicating the validity or status of an object in a simulation context.
- abstract
- `Base` class in SOFA defines essential functionality shared by all objects, including data field management, links, logging, and state tracking.
- sheet
- # Base ## Overview The `Base` class is the foundational component from which all other SOFA objects inherit. It provides core functionalities such as managing data fields, links between components, logging messages, and tracking the component's state. ## Parameters and Data The significant Data fields exposed by the `Base` class include: - **d_messageLogCount**: Counts logged messages (type: int). - **f_printLog**: Controls whether extra runtime messages are emitted (type: bool; default: false). - **f_tags**: Represents subsets to which the object belongs (type: sofa::core::objectmodel::TagSet). - **f_bbox**: Defines the bounding box for this object (type: sofa::type::BoundingBox). - **d_componentState**: Stores the state of the component, indicating whether it is valid or invalid (type: sofa::core::objectmodel::ComponentState). ## Dependencies and Connections The `Base` class interacts with other components through its API by providing methods for managing data fields and links. It ensures that all derived classes can be queried for common attributes like name, tags, bounding box, and component state.
- description
- The `Base` class in SOFA is the foundational class from which all other objects inherit. It provides essential functionality common to every object within the framework, such as managing data fields (including aliases), links between components, and retrieving information about an object like its name or type. **Role:** The primary role of `Base` is to define a consistent interface for querying and manipulating all SOFA objects. It ensures that every derived class can be queried for common attributes such as name, tags, bounding box, and component state. **Interactions with Other Components:** The `Base` class interacts with other components through its API by providing methods like `findData`, `findLink`, and `parseField`. These methods allow retrieval of data fields or links based on their names, setting field values from descriptions, and parsing configurations. The class also manages callbacks for updates to data fields, ensuring that the component state is correctly updated. **Usage Guidance:** The `Base` class should not be used directly; instead, it serves as a base for deriving specific components such as solvers, force fields, or visualizers. It includes mechanisms for managing logging, tags, and aliases for data fields and links. Data fields are initialized using the `initData` method, which ensures consistency across all derived classes. **Important Data Fields:** The class contains several important data fields: - `d_messageLogCount`: Counts logged messages. - `f_printLog`: Controls whether extra runtime messages are emitted. - `f_tags`: Represents subsets to which the object belongs. - `f_bbox`: Defines the bounding box for this object. - `d_componentState`: Stores the state of the component (e.g., Valid, Invalid). **Practical Usage:** The `Base` class provides mechanisms to add and remove data fields, links, and aliases through methods like `addData`, `removeData`, `addLink`, and `addAlias`. It also includes logging utilities for tracking messages generated during runtime. The component state can be queried using `getComponentState`, indicating the validity or status of an object in a simulation context.
- maths
- The `Base` class in the SOFA framework serves as an abstract base for all components within the simulation environment. While it does not directly handle mathematical or physical operations, its role is pivotal for orchestrating and maintaining a consistent interface for data management and state tracking among various derived classes. Here’s a detailed breakdown of how this foundational aspect integrates into the broader computational and conceptual framework of SOFA simulations. ### Mathematical and Physical Context #### 1. Data Management and Field Initialization: - **Data Fields:** The `Base` class includes mechanisms for managing data fields (e.g., `findData`, `addData`). Each data field is a variable that holds information relevant to the component’s operation, such as physical properties or geometric attributes. These are often initialized using the `initData` method and can be accessed through their unique names. - **Aliases:** Aliases allow for flexible access to specific data fields by associating multiple names with a single field. This abstraction simplifies configuration and query processes across various derived classes. #### 2. Link Management: - The `Base` class also manages links between components using methods like `findLink`, `addLink`. These links represent dependencies or relationships that are crucial for the correct functioning of interconnected objects in the simulation. For example, a constraint force field might depend on a mechanical state object to compute forces. #### 3. State Tracking: - **ComponentState:** The `d_componentState` field tracks whether a component is valid (`Valid`) or invalid (`Invalid`). This state determines whether a component can be used in computations without errors and reflects the consistency of its internal data (e.g., geometric properties, constraints). #### 4. Logging Mechanisms: - **Message Tracking:** The `d_messageLogCount` field counts logged messages generated during runtime, facilitating debugging and monitoring. This is particularly useful for identifying issues or tracking events that affect the simulation. ### Physical Interpretation in Simulations: While the `Base` class itself does not directly handle physical computations (like forces, deformations, etc.), it provides a structured way to organize components that do perform such operations. For instance, a force field derived from `Base` would use its inherited methods to manage its data fields and links while computing physical interactions. #### Example Scenario: - **Force Field Interaction:** Consider a `LinearSolver`, which is derived from the `Base`. It uses the `findData` method to access properties like stiffness or damping. These values are then used in solving linear systems that determine deformations or displacements in the simulation based on Newtonian mechanics principles. #### Component Interactions: - **Dependency Resolution:** Components often depend on each other for data (e.g., a `ConstraintSolver` might require data from a `BaseMechanicalState`). The link management provided by `Base` ensures that these dependencies are correctly established and updated, maintaining the integrity of the simulation. ### Conclusion: The `Base` class in SOFA acts as an abstract layer that encapsulates essential functionalities for all derived components. It ensures consistency and ease of use across various physical simulations while facilitating complex interactions and state management within a larger system.
{
"name": "Base",
"main": {
"name": "Base",
"namespace": "sofa::core::objectmodel",
"module": "Sofa.framework.Core",
"include": "sofa/core/objectmodel/Base.h",
"doc": "Base class for everything\n This class contains all functionality shared by every objects in SOFA.\n Most importantly it defines how to retrieve information about an object (name, type, data fields).\n All classes deriving from Base should use the SOFA_CLASS macro within their declaration (see BaseClass.h).",
"inherits": [
"IntrusiveObject"
],
"templates": [],
"data_fields": [
{
"name": "d_messageLogCount",
"type": "int"
},
{
"name": "f_printLog",
"type": "bool",
"xmlname": "printLog",
"help": "if true, emits extra messages at runtime."
},
{
"name": "f_tags",
"type": "sofa::core::objectmodel::TagSet",
"xmlname": "tags",
"help": "list of the subsets the object belongs to"
},
{
"name": "f_bbox",
"type": "sofa::type::BoundingBox",
"xmlname": "bbox",
"help": "this object bounding box"
},
{
"name": "d_componentState",
"type": "sofa::core::objectmodel::ComponentState",
"xmlname": "componentState",
"help": "The state of the component among (Dirty, Valid, Undefined, Loading, Invalid)."
}
],
"links": [],
"methods": [
{
"name": "addDeprecatedAttribute",
"return_type": "void",
"params": [
{
"name": "attribute",
"type": "lifecycle::DeprecatedData *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addUpdateCallback",
"return_type": "void",
"params": [
{
"name": "name",
"type": "const int &"
},
{
"name": "inputs",
"type": "int"
},
{
"name": "function",
"type": "int"
},
{
"name": "outputs",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addOutputsToCallback",
"return_type": "void",
"params": [
{
"name": "name",
"type": "const int &"
},
{
"name": "outputs",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPathName",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getName",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setName",
"return_type": "void",
"params": [
{
"name": "n",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setName",
"return_type": "void",
"params": [
{
"name": "n",
"type": "const int &"
},
{
"name": "counter",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getNameSpaceName",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setDefinitionSourceFileName",
"return_type": "void",
"params": [
{
"name": "sourceFileName",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDefinitionSourceFileName",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setDefinitionSourceFilePos",
"return_type": "void",
"params": [
{
"name": "",
"type": "const int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDefinitionSourceFilePos",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setInstanciationSourceFileName",
"return_type": "void",
"params": [
{
"name": "sourceFileName",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getInstanciationSourceFileName",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setInstanciationSourceFilePos",
"return_type": "void",
"params": [
{
"name": "",
"type": "const int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getInstanciationSourceFilePos",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "parseField",
"return_type": "bool",
"params": [
{
"name": "attribute",
"type": "const int &"
},
{
"name": "value",
"type": "const int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "hasField",
"return_type": "bool",
"params": [
{
"name": "attribute",
"type": "const int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "parse",
"return_type": "void",
"params": [
{
"name": "arg",
"type": "BaseObjectDescription *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "parseFields",
"return_type": "void",
"params": [
{
"name": "str",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "writeDatas",
"return_type": "void",
"params": [
{
"name": "str",
"type": "int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "writeDatas",
"return_type": "void",
"params": [
{
"name": "out",
"type": "int &"
},
{
"name": "separator",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findData",
"return_type": "BaseData *",
"params": [
{
"name": "name",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findGlobalField",
"return_type": "int",
"params": [
{
"name": "name",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findLink",
"return_type": "BaseLink *",
"params": [
{
"name": "name",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findLinks",
"return_type": "int",
"params": [
{
"name": "name",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateLinks",
"return_type": "void",
"params": [
{
"name": "logErrors",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addData",
"return_type": "void",
"params": [
{
"name": "f",
"type": "BaseData *"
},
{
"name": "name",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addData",
"return_type": "void",
"params": [
{
"name": "f",
"type": "BaseData *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "removeData",
"return_type": "void",
"params": [
{
"name": "f",
"type": "BaseData *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addAlias",
"return_type": "void",
"params": [
{
"name": "field",
"type": "BaseData *"
},
{
"name": "alias",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addLink",
"return_type": "void",
"params": [
{
"name": "l",
"type": "BaseLink *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addAlias",
"return_type": "void",
"params": [
{
"name": "link",
"type": "BaseLink *"
},
{
"name": "alias",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDataFields",
"return_type": "const VecData &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDataAliases",
"return_type": "const MapData &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getLinks",
"return_type": "const VecLink &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getLinkAliases",
"return_type": "const MapLink &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findDataLinkDest",
"return_type": "bool",
"params": [
{
"name": "ptr",
"type": "BaseData *&"
},
{
"name": "path",
"type": "const int &"
},
{
"name": "link",
"type": "const BaseLink *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findLinkDestClass",
"return_type": "Base *",
"params": [
{
"name": "destType",
"type": "const BaseClass *"
},
{
"name": "path",
"type": "const int &"
},
{
"name": "link",
"type": "const BaseLink *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findLinkDest",
"return_type": "bool",
"params": [
{
"name": "ptr",
"type": "T *&"
},
{
"name": "path",
"type": "const int &"
},
{
"name": "link",
"type": "const BaseLink *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getTags",
"return_type": "const sofa::core::objectmodel::TagSet &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "hasTag",
"return_type": "bool",
"params": [
{
"name": "t",
"type": "Tag"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addTag",
"return_type": "void",
"params": [
{
"name": "t",
"type": "Tag"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "removeTag",
"return_type": "void",
"params": [
{
"name": "t",
"type": "Tag"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addMessage",
"return_type": "void",
"params": [
{
"name": "m",
"type": "const sofa::helper::logging::Message &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "countLoggedMessages",
"return_type": "int",
"params": [
{
"name": "t",
"type": "sofa::helper::logging::Message::TypeSet"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getLoggedMessages",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getLoggedMessagesAsString",
"return_type": "const int",
"params": [
{
"name": "t",
"type": "sofa::helper::logging::Message::TypeSet"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "clearLoggedMessages",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "notMuted",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initData0",
"return_type": "void",
"params": [
{
"name": "field",
"type": "BaseData *"
},
{
"name": "res",
"type": "BaseData::BaseInitData &"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "help",
"type": "const char *"
},
{
"name": "isDisplayed",
"type": "bool"
},
{
"name": "isReadOnly",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "initData0",
"return_type": "void",
"params": [
{
"name": "field",
"type": "BaseData *"
},
{
"name": "res",
"type": "BaseData::BaseInitData &"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "help",
"type": "const char *"
},
{
"name": "dataFlags",
"type": "BaseData::DataFlags"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "initData0",
"return_type": "void",
"params": [
{
"name": "field",
"type": "Data<T> *"
},
{
"name": "res",
"type": "typename Data<T>::InitData &"
},
{
"name": "value",
"type": "const T &"
},
{
"name": "n",
"type": "const char *"
},
{
"name": "help",
"type": "const char *"
},
{
"name": "isDisplayed",
"type": "bool"
},
{
"name": "isReadOnly",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "shortName",
"return_type": "int",
"params": [
{
"name": "ptr",
"type": "const T *"
},
{
"name": "",
"type": "BaseObjectDescription *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "public"
},
{
"name": "getComponentState",
"return_type": "ComponentState",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isComponentStateValid",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isComponentStateInvalid",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseState",
"return_type": "const core::BaseState *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseMapping",
"return_type": "const core::BaseMapping *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBehaviorModel",
"return_type": "const core::BehaviorModel *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toCollisionModel",
"return_type": "const core::CollisionModel *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toDataEngine",
"return_type": "const core::DataEngine *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseContext",
"return_type": "const objectmodel::BaseContext *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseObject",
"return_type": "const objectmodel::BaseObject *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseNode",
"return_type": "const objectmodel::BaseNode *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toContextObject",
"return_type": "const objectmodel::ContextObject *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toConfigurationSetting",
"return_type": "const objectmodel::ConfigurationSetting *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseAnimationLoop",
"return_type": "const behavior::BaseAnimationLoop *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toOdeSolver",
"return_type": "const behavior::OdeSolver *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseLinearSolver",
"return_type": "const behavior::BaseLinearSolver *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toLinearSolver",
"return_type": "const behavior::LinearSolver *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toConstraintSolver",
"return_type": "const behavior::ConstraintSolver *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseMass",
"return_type": "const behavior::BaseMass *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseMechanicalState",
"return_type": "const behavior::BaseMechanicalState *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseInteractionForceField",
"return_type": "const behavior::BaseInteractionForceField *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseInteractionConstraint",
"return_type": "const behavior::BaseInteractionConstraint *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseForceField",
"return_type": "const behavior::BaseForceField *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseProjectiveConstraintSet",
"return_type": "const behavior::BaseProjectiveConstraintSet *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseInteractionProjectiveConstraintSet",
"return_type": "const behavior::BaseInteractionProjectiveConstraintSet *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseConstraintSet",
"return_type": "const behavior::BaseConstraintSet *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseLagrangianConstraint",
"return_type": "const behavior::BaseLagrangianConstraint *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toVisualModel",
"return_type": "const visual::VisualModel *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toVisualManager",
"return_type": "const visual::VisualManager *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toVisualLoop",
"return_type": "const visual::VisualLoop *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toShader",
"return_type": "const visual::Shader *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toTopology",
"return_type": "const topology::Topology *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseMeshTopology",
"return_type": "const topology::BaseMeshTopology *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseTopologyObject",
"return_type": "const topology::BaseTopologyObject *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toCollisionGroupManager",
"return_type": "const collision::CollisionGroupManager *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toContactManager",
"return_type": "const collision::ContactManager *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toDetection",
"return_type": "const collision::Detection *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toIntersection",
"return_type": "const collision::Intersection *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toPipeline",
"return_type": "const collision::Pipeline *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseLoader",
"return_type": "const loader::BaseLoader *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "toBaseConstraint",
"return_type": "const behavior::BaseLagrangianConstraint *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
]
},
"desc": {
"description": "The `Base` class in SOFA is the foundational class from which all other objects inherit. It provides essential functionality common to every object within the framework, such as managing data fields (including aliases), links between components, and retrieving information about an object like its name or type.\n\n**Role:**\nThe primary role of `Base` is to define a consistent interface for querying and manipulating all SOFA objects. It ensures that every derived class can be queried for common attributes such as name, tags, bounding box, and component state.\n\n**Interactions with Other Components:**\nThe `Base` class interacts with other components through its API by providing methods like `findData`, `findLink`, and `parseField`. These methods allow retrieval of data fields or links based on their names, setting field values from descriptions, and parsing configurations. The class also manages callbacks for updates to data fields, ensuring that the component state is correctly updated.\n\n**Usage Guidance:**\nThe `Base` class should not be used directly; instead, it serves as a base for deriving specific components such as solvers, force fields, or visualizers. It includes mechanisms for managing logging, tags, and aliases for data fields and links. Data fields are initialized using the `initData` method, which ensures consistency across all derived classes.\n\n**Important Data Fields:**\nThe class contains several important data fields:\n- `d_messageLogCount`: Counts logged messages.\n- `f_printLog`: Controls whether extra runtime messages are emitted.\n- `f_tags`: Represents subsets to which the object belongs.\n- `f_bbox`: Defines the bounding box for this object.\n- `d_componentState`: Stores the state of the component (e.g., Valid, Invalid).\n\n**Practical Usage:**\nThe `Base` class provides mechanisms to add and remove data fields, links, and aliases through methods like `addData`, `removeData`, `addLink`, and `addAlias`. It also includes logging utilities for tracking messages generated during runtime. The component state can be queried using `getComponentState`, indicating the validity or status of an object in a simulation context."
},
"maths": {
"maths": "The `Base` class in the SOFA framework serves as an abstract base for all components within the simulation environment. While it does not directly handle mathematical or physical operations, its role is pivotal for orchestrating and maintaining a consistent interface for data management and state tracking among various derived classes. Here’s a detailed breakdown of how this foundational aspect integrates into the broader computational and conceptual framework of SOFA simulations.\n\n### Mathematical and Physical Context\n\n#### 1. Data Management and Field Initialization:\n- **Data Fields:** The `Base` class includes mechanisms for managing data fields (e.g., `findData`, `addData`). Each data field is a variable that holds information relevant to the component’s operation, such as physical properties or geometric attributes. These are often initialized using the `initData` method and can be accessed through their unique names.\n- **Aliases:** Aliases allow for flexible access to specific data fields by associating multiple names with a single field. This abstraction simplifies configuration and query processes across various derived classes.\n\n#### 2. Link Management:\n- The `Base` class also manages links between components using methods like `findLink`, `addLink`. These links represent dependencies or relationships that are crucial for the correct functioning of interconnected objects in the simulation. For example, a constraint force field might depend on a mechanical state object to compute forces.\n\n#### 3. State Tracking:\n- **ComponentState:** The `d_componentState` field tracks whether a component is valid (`Valid`) or invalid (`Invalid`). This state determines whether a component can be used in computations without errors and reflects the consistency of its internal data (e.g., geometric properties, constraints).\n\n#### 4. Logging Mechanisms:\n- **Message Tracking:** The `d_messageLogCount` field counts logged messages generated during runtime, facilitating debugging and monitoring. This is particularly useful for identifying issues or tracking events that affect the simulation.\n\n### Physical Interpretation in Simulations:\nWhile the `Base` class itself does not directly handle physical computations (like forces, deformations, etc.), it provides a structured way to organize components that do perform such operations. For instance, a force field derived from `Base` would use its inherited methods to manage its data fields and links while computing physical interactions.\n\n#### Example Scenario:\n- **Force Field Interaction:** Consider a `LinearSolver`, which is derived from the `Base`. It uses the `findData` method to access properties like stiffness or damping. These values are then used in solving linear systems that determine deformations or displacements in the simulation based on Newtonian mechanics principles.\n\n#### Component Interactions:\n- **Dependency Resolution:** Components often depend on each other for data (e.g., a `ConstraintSolver` might require data from a `BaseMechanicalState`). The link management provided by `Base` ensures that these dependencies are correctly established and updated, maintaining the integrity of the simulation.\n\n### Conclusion:\nThe `Base` class in SOFA acts as an abstract layer that encapsulates essential functionalities for all derived components. It ensures consistency and ease of use across various physical simulations while facilitating complex interactions and state management within a larger system."
},
"summary": {
"abstract": "`Base` class in SOFA defines essential functionality shared by all objects, including data field management, links, logging, and state tracking.",
"sheet": "# Base\n\n## Overview\nThe `Base` class is the foundational component from which all other SOFA objects inherit. It provides core functionalities such as managing data fields, links between components, logging messages, and tracking the component's state.\n\n## Parameters and Data\nThe significant Data fields exposed by the `Base` class include:\n- **d_messageLogCount**: Counts logged messages (type: int).\n- **f_printLog**: Controls whether extra runtime messages are emitted (type: bool; default: false).\n- **f_tags**: Represents subsets to which the object belongs (type: sofa::core::objectmodel::TagSet).\n- **f_bbox**: Defines the bounding box for this object (type: sofa::type::BoundingBox).\n- **d_componentState**: Stores the state of the component, indicating whether it is valid or invalid (type: sofa::core::objectmodel::ComponentState).\n\n## Dependencies and Connections\nThe `Base` class interacts with other components through its API by providing methods for managing data fields and links. It ensures that all derived classes can be queried for common attributes like name, tags, bounding box, and component state."
}
}