TopologyBarycentricMapper
Template class for barycentric mapping topology-specific mappers.
The `TopologyBarycentricMapper` performs barycentric mapping for topological elements such as lines, triangles, quads, tetrahedrons, and cubes in SOFA simulations, ensuring consistency across different resolutions or representations.
- module
- Sofa.Component.Mapping.Linear
- namespace
- sofa::component::mapping::linear::_topologybarycentricmapper_
- include
- sofa/component/mapping/linear/BarycentricMappers/TopologyBarycentricMapper.h
- inherits
-
- BarycentricMapper
- templates
-
- sofa::defaulttype::Vec3Types, sofa::defaulttype::Vec3Types
- description
The TopologyBarycentricMapper in the SOFA framework is designed to manage points within various geometric primitives using barycentric coordinates. This mapper supports operations for lines, triangles, quads, tetrahedrons (tetras), and cubes by manipulating their topological structure and ensuring consistency across different mechanical states or representations. The component facilitates mapping through a variety of methods that handle the addition, setting, and creation of points within these geometric primitives based on barycentric coordinates.
Barycentric Coordinates
Barycentric coordinates are used to represent a point as a weighted average of vertices in a simplex (such as a triangle or tetrahedron). For an $n$-simplex, the barycentric coordinates $eta_i$ satisfy:
egin{align*}
\sum_{i=1}^{n+1} \beta_i = 1
ext{ and }\ orall i,eta_i \geq 0.
ext{ The position of a point }p\text{ in the simplex is given by:}\
p = \sum_{i=1}^{n+1} \beta_i v_i
ext{ where }v_i\text{ are the vertices of the simplex.}
ext{ This mapping is useful for interpolating values (such as displacements, forces) within elements and ensuring compatibility between different resolutions or representations in a simulation framework like SOFA.}
Role in FEM Pipeline
The TopologyBarycentricMapper plays a role in the assembly phase of the FEM pipeline by managing mappings between different levels of detail (multi-resolution coupling). Specifically, it ensures that points are correctly projected from one mesh to another based on their barycentric coordinates within elements. This is particularly useful for handling attachments, embedded meshes, and multi-scale simulations where consistency across resolutions is critical.
Numerical Methods and Discretization Choices
The component encodes the following numerical methods and discretization choices:
- Barycentric Interpolation: Points are interpolated using barycentric coordinates to ensure smooth and consistent mappings between different meshes or topological representations.
- Element-Specific Operations: The mapper supports operations tailored for specific geometric primitives, ensuring that each type of element is handled appropriately during the simulation.
Variational/Lagrangian Mechanics Framework
The TopologyBarycentricMapper fits into the broader variational and Lagrangian mechanics framework by preserving mechanical invariants during mapping operations. By using barycentric coordinates, it ensures that interpolated values (such as displacements or forces) are consistent with the underlying continuum mechanics principles.
Summary
In summary, TopologyBarycentricMapper is a key component for managing mappings and ensuring consistency between different topological representations in SOFA. It leverages barycentric coordinates to perform operations that support multi-resolution coupling, attachments, and embedded meshes, all while maintaining the physical integrity of the simulation.
Methods
int
addPointInLine
(const int lineIndex, const SReal * baryCoords)
int
setPointInLine
(const int pointIndex, const int lineIndex, const SReal * baryCoords)
int
createPointInLine
(const typename Out::Coord & p, int lineIndex, const typename In::VecCoord * points)
int
addPointInTriangle
(const int triangleIndex, const SReal * baryCoords)
int
setPointInTriangle
(const int pointIndex, const int triangleIndex, const SReal * baryCoords)
int
createPointInTriangle
(const typename Out::Coord & p, int triangleIndex, const typename In::VecCoord * points)
int
addPointInQuad
(const int quadIndex, const SReal * baryCoords)
int
setPointInQuad
(const int pointIndex, const int quadIndex, const SReal * baryCoords)
int
createPointInQuad
(const typename Out::Coord & p, int quadIndex, const typename In::VecCoord * points)
int
addPointInTetra
(const int tetraIndex, const SReal * baryCoords)
int
setPointInTetra
(const int pointIndex, const int tetraIndex, const SReal * baryCoords)
int
createPointInTetra
(const typename Out::Coord & p, int tetraIndex, const typename In::VecCoord * points)
int
addPointInCube
(const int cubeIndex, const SReal * baryCoords)
int
setPointInCube
(const int pointIndex, const int cubeIndex, const SReal * baryCoords)
int
createPointInCube
(const typename Out::Coord & p, int cubeIndex, const typename In::VecCoord * points)
void
setToTopology
(core::topology::BaseMeshTopology * toTopology)
virtual
const core::topology::BaseMeshTopology *
getToTopology
()
void
resize
(core::State<Out> * toModel)
virtual
void
processTopologicalChanges
(const typename Out::VecCoord & out, const typename In::VecCoord & in, core::topology::Topology * t)
{
"name": "TopologyBarycentricMapper",
"namespace": "sofa::component::mapping::linear::_topologybarycentricmapper_",
"module": "Sofa.Component.Mapping.Linear",
"include": "sofa/component/mapping/linear/BarycentricMappers/TopologyBarycentricMapper.h",
"doc": "Template class for barycentric mapping topology-specific mappers.",
"inherits": [
"BarycentricMapper"
],
"templates": [
"sofa::defaulttype::Vec3Types, sofa::defaulttype::Vec3Types"
],
"data_fields": [],
"links": [],
"methods": [
{
"name": "addPointInLine",
"return_type": "int",
"params": [
{
"name": "lineIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPointInLine",
"return_type": "int",
"params": [
{
"name": "pointIndex",
"type": "const int"
},
{
"name": "lineIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createPointInLine",
"return_type": "int",
"params": [
{
"name": "p",
"type": "const typename Out::Coord &"
},
{
"name": "lineIndex",
"type": "int"
},
{
"name": "points",
"type": "const typename In::VecCoord *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addPointInTriangle",
"return_type": "int",
"params": [
{
"name": "triangleIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPointInTriangle",
"return_type": "int",
"params": [
{
"name": "pointIndex",
"type": "const int"
},
{
"name": "triangleIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createPointInTriangle",
"return_type": "int",
"params": [
{
"name": "p",
"type": "const typename Out::Coord &"
},
{
"name": "triangleIndex",
"type": "int"
},
{
"name": "points",
"type": "const typename In::VecCoord *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addPointInQuad",
"return_type": "int",
"params": [
{
"name": "quadIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPointInQuad",
"return_type": "int",
"params": [
{
"name": "pointIndex",
"type": "const int"
},
{
"name": "quadIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createPointInQuad",
"return_type": "int",
"params": [
{
"name": "p",
"type": "const typename Out::Coord &"
},
{
"name": "quadIndex",
"type": "int"
},
{
"name": "points",
"type": "const typename In::VecCoord *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addPointInTetra",
"return_type": "int",
"params": [
{
"name": "tetraIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPointInTetra",
"return_type": "int",
"params": [
{
"name": "pointIndex",
"type": "const int"
},
{
"name": "tetraIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createPointInTetra",
"return_type": "int",
"params": [
{
"name": "p",
"type": "const typename Out::Coord &"
},
{
"name": "tetraIndex",
"type": "int"
},
{
"name": "points",
"type": "const typename In::VecCoord *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addPointInCube",
"return_type": "int",
"params": [
{
"name": "cubeIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPointInCube",
"return_type": "int",
"params": [
{
"name": "pointIndex",
"type": "const int"
},
{
"name": "cubeIndex",
"type": "const int"
},
{
"name": "baryCoords",
"type": "const SReal *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "createPointInCube",
"return_type": "int",
"params": [
{
"name": "p",
"type": "const typename Out::Coord &"
},
{
"name": "cubeIndex",
"type": "int"
},
{
"name": "points",
"type": "const typename In::VecCoord *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setToTopology",
"return_type": "void",
"params": [
{
"name": "toTopology",
"type": "core::topology::BaseMeshTopology *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getToTopology",
"return_type": "const core::topology::BaseMeshTopology *",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "resize",
"return_type": "void",
"params": [
{
"name": "toModel",
"type": "core::State<Out> *"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "processTopologicalChanges",
"return_type": "void",
"params": [
{
"name": "out",
"type": "const typename Out::VecCoord &"
},
{
"name": "in",
"type": "const typename In::VecCoord &"
},
{
"name": "t",
"type": "core::topology::Topology *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `TopologyBarycentricMapper` is a template class within the SOFA framework designed to perform barycentric mapping for topological elements such as lines, triangles, quads, tetrahedrons (tetras), and cubes. This mapper inherits from the `BarycentricMapper` class and is responsible for managing points in various geometric primitives by their barycentric coordinates. It supports operations like adding, setting, and creating points within these topological elements. The component interacts with other SOFA components through its methods that handle topology-specific mappings. These methods allow for the manipulation of mechanical states between different models or representations, facilitating multi-resolution or reduced model coexistence with collision or visualization meshes. This mapper plays a crucial role in ensuring consistency across various simulation aspects by leveraging barycentric coordinates to manage points within defined geometric primitives.",
"maths": "The `TopologyBarycentricMapper` in the SOFA framework is designed to manage points within various geometric primitives using barycentric coordinates. This mapper supports operations for lines, triangles, quads, tetrahedrons (tetras), and cubes by manipulating their topological structure and ensuring consistency across different mechanical states or representations. The component facilitates mapping through a variety of methods that handle the addition, setting, and creation of points within these geometric primitives based on barycentric coordinates.\n\n### Barycentric Coordinates\nBarycentric coordinates are used to represent a point as a weighted average of vertices in a simplex (such as a triangle or tetrahedron). For an $n$-simplex, the barycentric coordinates $\beta_i$ satisfy:\n\begin{align*}\n \\sum_{i=1}^{n+1} \\beta_i = 1\n\text{ and }\\ \forall i,\beta_i \\\\geq 0.\n\text{ The position of a point }p\\text{ in the simplex is given by:}\\\\\np = \\sum_{i=1}^{n+1} \\beta_i v_i\n\text{ where }v_i\\text{ are the vertices of the simplex.}\n\text{ This mapping is useful for interpolating values (such as displacements, forces) within elements and ensuring compatibility between different resolutions or representations in a simulation framework like SOFA.}\n\n### Role in FEM Pipeline\nThe `TopologyBarycentricMapper` plays a role in the assembly phase of the FEM pipeline by managing mappings between different levels of detail (multi-resolution coupling). Specifically, it ensures that points are correctly projected from one mesh to another based on their barycentric coordinates within elements. This is particularly useful for handling attachments, embedded meshes, and multi-scale simulations where consistency across resolutions is critical.\n\n### Numerical Methods and Discretization Choices\nThe component encodes the following numerical methods and discretization choices:\n- **Barycentric Interpolation**: Points are interpolated using barycentric coordinates to ensure smooth and consistent mappings between different meshes or topological representations.\n- **Element-Specific Operations**: The mapper supports operations tailored for specific geometric primitives, ensuring that each type of element is handled appropriately during the simulation.\n\n### Variational/Lagrangian Mechanics Framework\nThe `TopologyBarycentricMapper` fits into the broader variational and Lagrangian mechanics framework by preserving mechanical invariants during mapping operations. By using barycentric coordinates, it ensures that interpolated values (such as displacements or forces) are consistent with the underlying continuum mechanics principles.\n\n### Summary\nIn summary, `TopologyBarycentricMapper` is a key component for managing mappings and ensuring consistency between different topological representations in SOFA. It leverages barycentric coordinates to perform operations that support multi-resolution coupling, attachments, and embedded meshes, all while maintaining the physical integrity of the simulation.",
"abstract": "The `TopologyBarycentricMapper` performs barycentric mapping for topological elements such as lines, triangles, quads, tetrahedrons, and cubes in SOFA simulations, ensuring consistency across different resolutions or representations.",
"sheet": "# TopologyBarycentricMapper\n\n## Overview\nThe `TopologyBarycentricMapper` is a template class within the SOFA framework designed to perform barycentric mapping for topological elements such as lines, triangles, quads, tetrahedrons (tetras), and cubes. This mapper inherits from the `BarycentricMapper` class and manages points in these geometric primitives using their barycentric coordinates. It supports operations like adding, setting, and creating points within these topological elements.\n\n## Parameters and Data\nThe `TopologyBarycentricMapper` does not expose any significant data fields or parameters directly. Its functionality is primarily driven by its methods for handling topology-specific mappings."
}