MeanComputation
sofa::component::engine::MeanComputation
BaseObject
Doc (from source)
Compute the mean of the input elements. This class merge 2 coordinate vectors.
Abstract (AI generated)
The MeanComputation component computes the mean of input coordinate vectors from multiple mechanical objects within the simulation environment, storing the result in a VecCoord data field.
Metadata
- module
- MultiThreading
- namespace
- sofa::component::engine
- include
- MultiThreading/MeanComputation.h
- inherits
-
- BaseObject
- templates
-
- sofa::defaulttype::Rigid2Types
- sofa::defaulttype::Rigid3Types
- sofa::defaulttype::Vec3Types
- description
The `MeanComputation` component in the SOFA framework is designed to compute the mean of input coordinate vectors from multiple mechanical objects within a simulation environment. This component performs an averaging operation on the coordinates provided by various mechanical objects, which can be useful for scenarios such as processing sensor data or averaging deformation states in soft tissue models.
where \ is the number of input vectors.
- Output Vector: The result of this computation, \wzxhzdk:2, is stored in the
The component does not directly involve any constitutive laws (such as stress-strain relationships) or kinematic laws (such as deformation gradients). Instead, it focuses on simple arithmetic averaging of coordinate vectors.
Governing Equations and Operators
- Input Vectors: The
MeanComputationcomponent takes multiple coordinate vectors \wzxhzdk:3 from differentMechanicalObjectinstances within its context. These coordinates represent the positions of points or nodes in a mechanical system. - Mean Computation: The mean vector \wzxhzdk:4 is computed as the average of all input vectors:
where \ is the number of input vectors.
- Output Vector: The result of this computation, \wzxhzdk:2, is stored in the
d_result data field as a vector of coordinates (VecCoord).Constitutive or Kinematic Laws Involved
The component does not directly involve any constitutive laws (such as stress-strain relationships) or kinematic laws (such as deformation gradients). Instead, it focuses on simple arithmetic averaging of coordinate vectors.
Role in the Global FEM Pipeline
- Initialization (
init()): During initialization, the component identifies and collects position data from allMechanicalObjectinstances within its context that do not have the
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_result |
VecCoord | |
Result: mean computed from the input values |
Methods
void
compute
()
void
init
()
virtual
void
reinit
()
virtual
void
handleEvent
(core::objectmodel::Event * event)
virtual
{
"name": "MeanComputation",
"namespace": "sofa::component::engine",
"module": "MultiThreading",
"include": "MultiThreading/MeanComputation.h",
"doc": "Compute the mean of the input elements.\n\nThis class merge 2 coordinate vectors.",
"inherits": [
"BaseObject"
],
"templates": [
"sofa::defaulttype::Rigid2Types",
"sofa::defaulttype::Rigid3Types",
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_result",
"type": "VecCoord",
"xmlname": "result",
"help": "Result: mean computed from the input values"
}
],
"links": [],
"methods": [
{
"name": "compute",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "reinit",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "handleEvent",
"return_type": "void",
"params": [
{
"name": "event",
"type": "core::objectmodel::Event *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `MeanComputation` component is part of the MultiThreading module in SOFA and is designed to compute the mean of input coordinate vectors from multiple mechanical objects within the simulation environment. This class merges two or more coordinate vectors by calculating their average values.\n\n### Role and Purpose\nThis component is useful for scenarios where an aggregated measure (mean) of several sets of coordinates needs to be calculated, such as when processing sensor data or averaging multiple deformation states in a soft tissue model.\n\n### Interactions with Other Components\n`MeanComputation` interacts primarily with `MechanicalObject`s from the state container framework. During initialization (`init()`), it retrieves and processes position data from all `MechanicalObject` instances within its context that do not have the \"MeanOutput\" tag. It also handles events, specifically the `AnimateBeginEvent`, to trigger re-computation of the mean values.\n\n### Practical Usage Guidance and Data Fields\nThe component provides a single data field:\n- **d_result**: This is where the computed mean coordinates are stored. The result is accessible as a `VecCoord` type vector, representing the average of input coordinate vectors.\n\nTo use this component effectively, ensure that multiple `MechanicalObject`s are available in the simulation context to provide inputs for computation.",
"maths": "The `MeanComputation` component in the SOFA framework is designed to compute the mean of input coordinate vectors from multiple mechanical objects within a simulation environment. This component performs an averaging operation on the coordinates provided by various mechanical objects, which can be useful for scenarios such as processing sensor data or averaging deformation states in soft tissue models.\n\n### Governing Equations and Operators\n- **Input Vectors**: The `MeanComputation` component takes multiple coordinate vectors \\\\(\\mathbf{v}_i\\\\) from different `MechanicalObject` instances within its context. These coordinates represent the positions of points or nodes in a mechanical system.\n- **Mean Computation**: The mean vector \\\\(\\bar{\\mathbf{v}}\\\\) is computed as the average of all input vectors:\n \\[\n \\bar{\\mathbf{v}} = \\frac{1}{N} \\sum_{i=1}^N \\mathbf{v}_i\n \\]\n where \\\\(N\\\\) is the number of input vectors.\n- **Output Vector**: The result of this computation, \\\\(\\bar{\\mathbf{v}}\\\\), is stored in the `d_result` data field as a vector of coordinates (`VecCoord`).\n\n### Constitutive or Kinematic Laws Involved\nThe component does not directly involve any constitutive laws (such as stress-strain relationships) or kinematic laws (such as deformation gradients). Instead, it focuses on simple arithmetic averaging of coordinate vectors.\n\n### Role in the Global FEM Pipeline\n- **Initialization (`init()`)**: During initialization, the component identifies and collects position data from all `MechanicalObject` instances within its context that do not have the ",
"abstract": "The MeanComputation component computes the mean of input coordinate vectors from multiple mechanical objects within the simulation environment, storing the result in a VecCoord data field.",
"sheet": "# MeanComputation\n\n## Overview\n\nMeanComputation is an engine that calculates the average (mean) of input coordinate vectors from multiple `MechanicalObject` instances. It stores the computed mean coordinates in its `d_result` data field.\n\n## Mathematical Model\n\nThe component computes the mean vector \\(\\bar{\\mathbf{v}}\\) as follows:\n\n\begin{equation}\n \\bar{\\mathbf{v}} = \\frac{1}{N} \\sum_{i=1}^N \\mathbf{v}_i,\n\tag{1}\\end{equation}\n\nwhere \\(\\mathbf{v}_i\\) are the input coordinate vectors and \\(N\\) is the number of these vectors.\n\n## Parameters and Data\n\n- **d_result**: The computed mean coordinates stored as a `VecCoord` type vector."
}