BeamLinearMapping_mt
Set the positions and velocities of points attached to a beam using linear interpolation between DOFs.
The `BeamLinearMapping_mt` sets positions and velocities of points attached to a beam using linear interpolation between degrees-of-freedom (DOFs) with multithreaded support.
- module
- MultiThreading
- namespace
- multithreading::component::mapping::linear
- include
- MultiThreading/component/mapping/linear/BeamLinearMapping_mt.h
- inherits
-
- BeamLinearMapping
- templates
-
- sofa::defaulttype::Rigid3Types, sofa::defaulttype::Vec3Types
- description
Mathematical and Physical Description of BeamLinearMapping_mt Component
Overview
The BeamLinearMapping_mt is an extension of the base BeamLinearMapping class in the SOFA framework, designed to support multithreaded operations. This component facilitates setting positions and velocities for points attached to a beam using linear interpolation between degrees-of-freedom (DOFs). The primary objective is to leverage parallel processing for enhanced computational efficiency.
Mathematical Foundation
Linear Interpolation
The core functionality of the BeamLinearMapping_mt involves performing linear interpolation. Consider a set of DOFs along a beam, where each DOF has associated position and velocity data. Let's denote these DOFs as $\{\mathbf{x}_1, \mathbf{x}_2, \ldots, \mathbf{x}_n\}$ for positions and $\{\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_n\}$ for velocities. The linear interpolation between two consecutive DOFs $\mathbf{x}_i$ and $\mathbf{x}_{i+1}$ is given by:
where $s$ is a parameter that varies between 0 and 1.
Similarly, for velocities:
$$ \mathbf{v}(s) = (1 - s) \cdot \mathbf{v}_i + s \cdot \mathbf{v}_{i+1} $$Mapping Operations
The BeamLinearMapping_mt implements several key mapping operations: apply, applyJ, and applyJT. These methods are responsible for applying linear interpolation tasks in a multithreaded manner.
-
apply: This method maps the positions of points attached to the beam. Given input positions $\mathbf{X}_i$ at DOFs, it interpolates to compute the position $\mathbf{x}(s)$ at any point along the beam:
$$ \mathbf{x}(s) = (1 - s) \cdot \mathbf{X}_i + s \cdot \mathbf{X}_{i+1} $$ -
applyJ: This method maps velocities, which are derivatives of positions with respect to time. Given input velocities $\mathbf{V}_i$ at DOFs, it interpolates to compute the velocity $\mathbf{v}(s)$ at any point along the beam:
$$ \mathbf{v}(s) = (1 - s) \cdot \mathbf{V}_i + s \cdot \mathbf{V}_{i+1} $$ -
applyJT: This method performs the transpose of the Jacobian matrix, which is useful in various optimization and constraint satisfaction problems. Given input velocities $\mathbf{v}(s)$, it interpolates to compute the contributions back to DOFs:
$$ \mathbf{V}_i = (1 - s) \cdot \mathbf{v}(s), \quad \mathbf{V}_{i+1} = s \cdot \mathbf{v}(s) $$
Parallelization Strategy
The BeamLinearMapping_mt supports multithreaded operations through the use of tasks managed by SOFA's task scheduler. The granularity (mGrainSize) parameter defines the minimum number of beam points required to create separate tasks. This allows efficient distribution of interpolation tasks across multiple threads, thereby enhancing computational performance.
Interaction with Other Components
The BeamLinearMapping_mt interacts with other components in the SOFA framework through its inherited methods and by using the task scheduler for parallel execution. The multithreaded approach ensures that large-scale simulations involving complex beam configurations can be executed more efficiently.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
mGrainSize |
unsigned int | |
minimum number of Beam points for task creation |
Methods
void
apply
(const sofa::core::MechanicalParams * mparams, sofa::Data<typename Out::VecCoord> & out, const sofa::Data<typename In::VecCoord> & in)
virtual
void
applyJ
(const sofa::core::MechanicalParams * mparams, sofa::Data<typename Out::VecDeriv> & out, const sofa::Data<typename In::VecDeriv> & in)
virtual
void
applyJT
(const sofa::core::MechanicalParams * mparams, sofa::Data<typename In::VecDeriv> & out, const sofa::Data<typename Out::VecDeriv> & in)
virtual
void
init
()
virtual
void
bwdInit
()
virtual
{
"name": "BeamLinearMapping_mt",
"namespace": "multithreading::component::mapping::linear",
"module": "MultiThreading",
"include": "MultiThreading/component/mapping/linear/BeamLinearMapping_mt.h",
"doc": "Set the positions and velocities of points attached to a beam using linear interpolation between DOFs.",
"inherits": [
"BeamLinearMapping"
],
"templates": [
"sofa::defaulttype::Rigid3Types, sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "mGrainSize",
"type": "unsigned int",
"xmlname": "granularity",
"help": "minimum number of Beam points for task creation"
}
],
"links": [],
"methods": [
{
"name": "apply",
"return_type": "void",
"params": [
{
"name": "mparams",
"type": "const sofa::core::MechanicalParams *"
},
{
"name": "out",
"type": "sofa::Data<typename Out::VecCoord> &"
},
{
"name": "in",
"type": "const sofa::Data<typename In::VecCoord> &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "applyJ",
"return_type": "void",
"params": [
{
"name": "mparams",
"type": "const sofa::core::MechanicalParams *"
},
{
"name": "out",
"type": "sofa::Data<typename Out::VecDeriv> &"
},
{
"name": "in",
"type": "const sofa::Data<typename In::VecDeriv> &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "applyJT",
"return_type": "void",
"params": [
{
"name": "mparams",
"type": "const sofa::core::MechanicalParams *"
},
{
"name": "out",
"type": "sofa::Data<typename In::VecDeriv> &"
},
{
"name": "in",
"type": "const sofa::Data<typename Out::VecDeriv> &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "bwdInit",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `BeamLinearMapping_mt` is part of the MultiThreading module in SOFA and extends the functionality of the base `BeamLinearMapping` to support multithreaded operations. Its primary role is to set the positions and velocities of points attached to a beam using linear interpolation between degrees-of-freedom (DOFs). This component specifically targets scenarios where parallel processing can be leveraged for improved performance.\n\nThe `apply`, `applyJ`, and `applyJT` methods are key virtual functions inherited from the base class, each responsible for different aspects of mapping operations. These methods take mechanical parameters and input/output data as arguments, applying linear interpolation tasks in a multithreaded manner. The granularity (`mGrainSize`) can be configured to define the minimum number of beam points required for creating separate tasks.\n\nThis component interacts with other SOFA components through its inherited methods, which are typical mapping functions in the framework. Tasks are managed using the SOFA task scheduler, enabling efficient parallel execution. Practical usage involves setting up the desired granularity and ensuring that the beam data is appropriately configured for multithreaded processing.",
"maths": "# Mathematical and Physical Description of BeamLinearMapping_mt Component\n\n### Overview\nThe `BeamLinearMapping_mt` is an extension of the base `BeamLinearMapping` class in the SOFA framework, designed to support multithreaded operations. This component facilitates setting positions and velocities for points attached to a beam using linear interpolation between degrees-of-freedom (DOFs). The primary objective is to leverage parallel processing for enhanced computational efficiency.\n\n### Mathematical Foundation\n#### Linear Interpolation\nThe core functionality of the `BeamLinearMapping_mt` involves performing linear interpolation. Consider a set of DOFs along a beam, where each DOF has associated position and velocity data. Let's denote these DOFs as $\\{\\mathbf{x}_1, \\mathbf{x}_2, \\ldots, \\mathbf{x}_n\\}$ for positions and $\\{\\mathbf{v}_1, \\mathbf{v}_2, \\ldots, \\mathbf{v}_n\\}$ for velocities. The linear interpolation between two consecutive DOFs $\\mathbf{x}_i$ and $\\mathbf{x}_{i+1}$ is given by:\n\n$$\n\\mathbf{x}(s) = (1 - s) \\cdot \\mathbf{x}_i + s \\cdot \\mathbf{x}_{i+1}\n$$\n\nwhere $s$ is a parameter that varies between 0 and 1.\n\nSimilarly, for velocities:\n\n$$\n\\mathbf{v}(s) = (1 - s) \\cdot \\mathbf{v}_i + s \\cdot \\mathbf{v}_{i+1}\n$$\n\n#### Mapping Operations\nThe `BeamLinearMapping_mt` implements several key mapping operations: `apply`, `applyJ`, and `applyJT`. These methods are responsible for applying linear interpolation tasks in a multithreaded manner.\n\n- **`apply`**: This method maps the positions of points attached to the beam. Given input positions $\\mathbf{X}_i$ at DOFs, it interpolates to compute the position $\\mathbf{x}(s)$ at any point along the beam:\n $$\n \\mathbf{x}(s) = (1 - s) \\cdot \\mathbf{X}_i + s \\cdot \\mathbf{X}_{i+1}\n $$\n\n- **`applyJ`**: This method maps velocities, which are derivatives of positions with respect to time. Given input velocities $\\mathbf{V}_i$ at DOFs, it interpolates to compute the velocity $\\mathbf{v}(s)$ at any point along the beam:\n $$\n \\mathbf{v}(s) = (1 - s) \\cdot \\mathbf{V}_i + s \\cdot \\mathbf{V}_{i+1}\n $$\n\n- **`applyJT`**: This method performs the transpose of the Jacobian matrix, which is useful in various optimization and constraint satisfaction problems. Given input velocities $\\mathbf{v}(s)$, it interpolates to compute the contributions back to DOFs:\n $$\n \\mathbf{V}_i = (1 - s) \\cdot \\mathbf{v}(s), \\quad \\mathbf{V}_{i+1} = s \\cdot \\mathbf{v}(s)\n $$\n\n### Parallelization Strategy\nThe `BeamLinearMapping_mt` supports multithreaded operations through the use of tasks managed by SOFA's task scheduler. The granularity (`mGrainSize`) parameter defines the minimum number of beam points required to create separate tasks. This allows efficient distribution of interpolation tasks across multiple threads, thereby enhancing computational performance.\n\n### Interaction with Other Components\nThe `BeamLinearMapping_mt` interacts with other components in the SOFA framework through its inherited methods and by using the task scheduler for parallel execution. The multithreaded approach ensures that large-scale simulations involving complex beam configurations can be executed more efficiently.",
"abstract": "The `BeamLinearMapping_mt` sets positions and velocities of points attached to a beam using linear interpolation between degrees-of-freedom (DOFs) with multithreaded support.",
"sheet": "# BeamLinearMapping_mt\n\n## Overview\nThe `BeamLinearMapping_mt` is an extension of the base `BeamLinearMapping` class in SOFA, designed for multithreaded operations. It sets positions and velocities of points attached to a beam using linear interpolation between degrees-of-freedom (DOFs). This component leverages parallel processing for enhanced computational efficiency.\n\n## Mathematical Model\nThe core functionality involves performing linear interpolation between DOFs. Let $\\{\\mathbf{x}_1, \\mathbf{x}_2, \\ldots, \\mathbf{x}_n\\}$ be the positions and $\\{\\mathbf{v}_1, \\mathbf{v}_2, \\ldots, \\mathbf{v}_n\\}$ be the velocities at DOFs. The linear interpolation between two consecutive DOFs $\\mathbf{x}_i$ and $\\mathbf{x}_{i+1}$ is given by:\n\n$$\n\\mathbf{x}(s) = (1 - s) \\cdot \\mathbf{x}_i + s \\cdot \\mathbf{x}_{i+1}\n$$\nwhere $s$ varies between 0 and 1.\n\nSimilarly, for velocities:\n\n$$\n\\mathbf{v}(s) = (1 - s) \\cdot \\mathbf{v}_i + s \\cdot \\mathbf{v}_{i+1}\n$$\n\nThe `apply`, `applyJ`, and `applyJT` methods are responsible for applying these interpolations in a multithreaded manner.\n\n- **`apply`**: Maps positions:\n $$\n \\mathbf{x}(s) = (1 - s) \\cdot \\mathbf{X}_i + s \\cdot \\mathbf{X}_{i+1}\n $$\n\n- **`applyJ`**: Maps velocities:\n $$\n \\mathbf{v}(s) = (1 - s) \\cdot \\mathbf{V}_i + s \\cdot \\mathbf{V}_{i+1}\n $$\n\n- **`applyJT`**: Transposes the Jacobian matrix for optimization and constraint satisfaction:\n $$\n \\mathbf{V}_i = (1 - s) \\cdot \\mathbf{v}(s), \\quad \\mathbf{V}_{i+1} = s \\cdot \\mathbf{v}(s)\n $$\n\n## Parameters and Data\n- **`mGrainSize`**: Minimum number of beam points for task creation. Type: `unsigned int`. Default value not specified.\n\n## Dependencies and Connections\nThe component interacts with other SOFA components through inherited methods and the task scheduler, enabling efficient parallel execution."
}