Mesh2PointTopologicalMapping
This class maps any mesh primitive (point, edge, triangle...) into a point using a relative position from the primitive. This class, called Mesh2PointTopologicalMapping, is a specific implementation of the interface TopologicalMapping where : INPUT TOPOLOGY = any MeshTopology OUTPUT TOPOLOGY = A PointSetTopologie, as the boundary of the INPUT TOPOLOGY Each primitive in the input Topology will be mapped to a point in the output topology computed from a parameter vector (pointBaryCoords, edgeBaryCoords, triangleBaryCoords, quadBaryCoords, tetraBaryCoords, hexaBaryCoords) Mesh2PointTopologicalMapping class is templated by the pair (INPUT TOPOLOGY, OUTPUT TOPOLOGY)
The `Mesh2PointTopologicalMapping` component maps any mesh primitive (points, edges, triangles, etc.) into points using relative positions defined by barycentric coordinates. It supports controlling which primitives are mapped through parameters such as `copyEdges`, `copyTriangles`, and `copyTetrahedra`.
- module
- Sofa.Component.Mapping.Linear
- namespace
- sofa::component::mapping::linear
- include
- sofa/component/mapping/linear/Mesh2PointTopologicalMapping.h
- inherits
-
- TopologicalMapping
- description
Mathematical and Physical Description of Mesh2PointTopologicalMapping
Governing Equations / Operators
The
Mesh2PointTopologicalMapping class in the SOFA framework is designed to map any primitive from an input MeshTopology (points, edges, triangles, quads, tetrahedra, hexahedra) into points in an output PointSetTopology. The mapping is performed using relative positions defined by barycentric coordinates.The mappings are described mathematically as follows:
- Point Mapping:
$e$
- Edge Mapping (for edge $e$ with vertices $(p_0, p_1)$):
$(p_0, p_1)$
where klzzwxh:0007.klzzwxh:0025- klzzwxh:0020 (for triangle klzzwxh:0008 with vertices klzzwxh:0009):klzzwxh:0026 wzxhzdk:2klzzwxh:0027 where klzzwxh:0010.klzzwxh:0028- klzzwxh:0021 (for quad klzzwxh:0011 with vertices klzzwxh:0012):klzzwxh:0029 wzxhzdk:3klzzwxh:0030 where klzzwxh:0013.klzzwxh:0031- klzzwxh:0022 (for tetrahedron klzzwxh:0014 with vertices klzzwxh:0015):klzzwxh:0032 wzxhzdk:4klzzwxh:0033 where klzzwxh:0016.klzzwxh:0034- klzzwxh:0023 (for hexahedron klzzwxh:0017 with vertices klzzwxh:0018):klzzwxh:0035 wzxhzdk:5klzzwxh:0036 where klzzwxh:0019.
Constitutive or Kinematic Laws Involved
The mapping component primarily involves barycentric interpolation and does not directly involve constitutive laws (such as stress-strain relations). Instead, it transforms the topology of an input mesh into a set of points based on specified barycentric coordinates. This is essentially a kinematic operation that preserves the geometry but changes the representation.
Role in the Global FEM Pipeline
The , ensuring that changes in the input mesh are correctly reflected in the point set output topology.Time Integration fits into the broader simulation pipeline as follows:: It does not directly contribute to time integration but maintains topological consistency throughout simulation steps via
- Assembly Phase: During initialization (Nonlinear Solve / Linear Solve), it maps primitives from the input topology to points in the output topology using barycentric coordinates. This mapping is stored and used for consistency checks.: Since it is a topological mapping, its role is primarily in maintaining the correct connectivity and structure of the points. It does not directly influence nonlinear or linear solvers but ensures that the system remains consistent for such operations.
- Time Integration fits into the broader simulation pipeline as follows:: It does not directly contribute to time integration but maintains topological consistency throughout simulation steps via
The , ensuring that changes in the input mesh are correctly reflected in the point set output topology.
- Nonlinear Solve / Linear Solve), it maps primitives from the input topology to points in the output topology using barycentric coordinates. This mapping is stored and used for consistency checks.: Since it is a topological mapping, its role is primarily in maintaining the correct connectivity and structure of the points. It does not directly influence nonlinear or linear solvers but ensures that the system remains consistent for such operations.
Numerical Methods or Discretization Choices
The component uses barycentric interpolation to compute new positions of mapped points based on specified barycentric coordinates. This approach is a form of affine transformation and does not involve any finite element discretization directly but serves as a preparatory step for more complex simulations where such mappings are required.
Integration into Variational / Lagrangian Mechanics Framework
Although
Mesh2PointTopologicalMapping itself does not implement variational or Lagrangian mechanics principles directly, it is part of the broader framework that supports these principles. By maintaining consistent and correct topologies, it ensures that subsequent components (like force fields and constraints) operate on valid and well-defined structures. This mapping can be critical for ensuring that deformation gradients and other continuum mechanics quantities are accurately computed in simulations involving complex geometries.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
copyEdges |
bool | |
Activate mapping of input edges into the output topology (requires at least one item in pointBaryCoords) |
copyTriangles |
bool | |
Activate mapping of input triangles into the output topology (requires at least one item in pointBaryCoords) |
copyTetrahedra |
bool | |
Activate mapping of input tetrahedra into the output topology (requires at least one item in pointBaryCoords) |
Methods
void
init
()
virtual
void
updateTopologicalMappingTopDown
()
virtual
int
getGlobIndex
(int ind)
int
getFromIndex
(int ind)
const int &
getPointsMappedFromPoint
()
const int &
getPointsMappedFromEdge
()
const int &
getPointsMappedFromTriangle
()
const int &
getPointsMappedFromQuad
()
const int &
getPointsMappedFromTetra
()
const int &
getPointsMappedFromHexa
()
const int &
getPointBaryCoords
()
const int &
getEdgeBaryCoords
()
const int &
getTriangleBaryCoords
()
const int &
getQuadBaryCoords
()
const int &
getTetraBaryCoords
()
const int &
getHexaBaryCoords
()
const int &
getPointSource
()
int
addInputPoint
(int i, topology::container::dynamic::PointSetTopologyModifier * toPointMod)
void
addInputEdge
(int i, topology::container::dynamic::PointSetTopologyModifier * toPointMod)
void
addInputTriangle
(int i, topology::container::dynamic::PointSetTopologyModifier * toPointMod)
void
addInputTetrahedron
(int i, topology::container::dynamic::PointSetTopologyModifier * toPointMod)
void
swapInput
(Element elem, int i1, int i2)
void
removeInput
(Element elem, const int & tab)
void
renumberInput
(Element elem, const int & index)
void
swapOutputPoints
(int i1, int i2, bool removeLast)
void
removeOutputPoints
(const int & tab)
bool
internalCheck
(const char * step, const int & nbInputRemoved)
bool
internalCheck
(const char * step)
{
"name": "Mesh2PointTopologicalMapping",
"namespace": "sofa::component::mapping::linear",
"module": "Sofa.Component.Mapping.Linear",
"include": "sofa/component/mapping/linear/Mesh2PointTopologicalMapping.h",
"doc": "This class maps any mesh primitive (point, edge, triangle...) into a point using a relative position from the primitive.\n\nThis class, called Mesh2PointTopologicalMapping, is a specific implementation of the interface TopologicalMapping where :\nINPUT TOPOLOGY = any MeshTopology\nOUTPUT TOPOLOGY = A PointSetTopologie, as the boundary of the INPUT TOPOLOGY\nEach primitive in the input Topology will be mapped to a point in the output topology computed from a parameter vector (pointBaryCoords, edgeBaryCoords, triangleBaryCoords, quadBaryCoords, tetraBaryCoords, hexaBaryCoords)\nMesh2PointTopologicalMapping class is templated by the pair (INPUT TOPOLOGY, OUTPUT TOPOLOGY)",
"inherits": [
"TopologicalMapping"
],
"templates": [],
"data_fields": [
{
"name": "copyEdges",
"type": "bool",
"xmlname": "copyEdges",
"help": "Activate mapping of input edges into the output topology (requires at least one item in pointBaryCoords)"
},
{
"name": "copyTriangles",
"type": "bool",
"xmlname": "copyTriangles",
"help": "Activate mapping of input triangles into the output topology (requires at least one item in pointBaryCoords)"
},
{
"name": "copyTetrahedra",
"type": "bool",
"xmlname": "copyTetrahedra",
"help": "Activate mapping of input tetrahedra into the output topology (requires at least one item in pointBaryCoords)"
}
],
"links": [],
"methods": [
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateTopologicalMappingTopDown",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getGlobIndex",
"return_type": "int",
"params": [
{
"name": "ind",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getFromIndex",
"return_type": "int",
"params": [
{
"name": "ind",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointsMappedFromPoint",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointsMappedFromEdge",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointsMappedFromTriangle",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointsMappedFromQuad",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointsMappedFromTetra",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointsMappedFromHexa",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointBaryCoords",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getEdgeBaryCoords",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getTriangleBaryCoords",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getQuadBaryCoords",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getTetraBaryCoords",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getHexaBaryCoords",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointSource",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "addInputPoint",
"return_type": "int",
"params": [
{
"name": "i",
"type": "int"
},
{
"name": "toPointMod",
"type": "topology::container::dynamic::PointSetTopologyModifier *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "addInputEdge",
"return_type": "void",
"params": [
{
"name": "i",
"type": "int"
},
{
"name": "toPointMod",
"type": "topology::container::dynamic::PointSetTopologyModifier *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "addInputTriangle",
"return_type": "void",
"params": [
{
"name": "i",
"type": "int"
},
{
"name": "toPointMod",
"type": "topology::container::dynamic::PointSetTopologyModifier *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "addInputTetrahedron",
"return_type": "void",
"params": [
{
"name": "i",
"type": "int"
},
{
"name": "toPointMod",
"type": "topology::container::dynamic::PointSetTopologyModifier *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "swapInput",
"return_type": "void",
"params": [
{
"name": "elem",
"type": "Element"
},
{
"name": "i1",
"type": "int"
},
{
"name": "i2",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "removeInput",
"return_type": "void",
"params": [
{
"name": "elem",
"type": "Element"
},
{
"name": "tab",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "renumberInput",
"return_type": "void",
"params": [
{
"name": "elem",
"type": "Element"
},
{
"name": "index",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "swapOutputPoints",
"return_type": "void",
"params": [
{
"name": "i1",
"type": "int"
},
{
"name": "i2",
"type": "int"
},
{
"name": "removeLast",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "removeOutputPoints",
"return_type": "void",
"params": [
{
"name": "tab",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "internalCheck",
"return_type": "bool",
"params": [
{
"name": "step",
"type": "const char *"
},
{
"name": "nbInputRemoved",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "internalCheck",
"return_type": "bool",
"params": [
{
"name": "step",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
],
"description": "The `Mesh2PointTopologicalMapping` class in the SOFA framework maps any primitive (points, edges, triangles, etc.) from an input MeshTopology to points in an output PointSetTopology using relative positions defined by barycentric coordinates. It inherits from the `TopologicalMapping` interface and is part of the `Sofa.Component.Mapping.Linear` module.\n\nThe mapping supports various topology types, including point sets, edges, triangles, quads, tetrahedra, and hexahedra. The component provides several data fields for controlling which primitives are mapped (e.g., `copyEdges`, `copyTriangles`, and `copyTetrahedra`), as well as methods to handle topological changes (`updateTopologicalMappingTopDown`) and internal consistency checks (`internalCheck`).\n\nIt implements key virtual functions like `init()` for initializing the output topology from the source topology and manages mappings using barycentric coordinates stored in different fields (e.g., `pointBaryCoords`, `edgeBaryCoords`, etc.). This class is useful for creating mappings between detailed mesh structures and simpler point-based representations, which can be crucial for reducing complexity or focusing on specific aspects of a simulation.",
"maths": "### Mathematical and Physical Description of `Mesh2PointTopologicalMapping`\n\n#### Governing Equations / Operators\n\nThe `Mesh2PointTopologicalMapping` class in the SOFA framework is designed to map any primitive from an input MeshTopology (points, edges, triangles, quads, tetrahedra, hexahedra) into points in an output PointSetTopology. The mapping is performed using relative positions defined by barycentric coordinates.\n\nThe mappings are described mathematically as follows:\n- **Point Mapping**: \n \\[ p_i = p_{input}(i) + \text{pointBaryCoords}[j] \\]\n- **Edge Mapping** (for edge \\(e\\) with vertices \\((p_0, p_1)\\)):\n \\[ p_e = p_0 * (1 - fx) + p_1 * fx \\]\n where \\(\text{edgeBaryCoords}[j] = [fx]\\).\n- **Triangle Mapping** (for triangle \\(t\\) with vertices \\((p_0, p_1, p_2)\\)):\n \\[ p_t = p_0 * (1 - fx - fy) + p_1 * fx + p_2 * fy \\]\n where \\(\text{triangleBaryCoords}[j] = [fx, fy]\\).\n- **Quad Mapping** (for quad \\(q\\) with vertices \\((p_0, p_1, p_2, p_3)\\)):\n \\[ p_q = p_0 * ((1-fx) * (1-fy)) + p_1 * ((fx) * (1-fy)) + p_2 * ((1-fx) * (fy)) + p_3 * ((fx) * (fy)) \\]\n where \\(\text{quadBaryCoords}[j] = [fx, fy]\\).\n- **Tetrahedron Mapping** (for tetrahedron \\(t\\) with vertices \\((p_0, p_1, p_2, p_3)\\)):\n \\[ p_t = p_0 * ((1-fx-fy-fz)) + p_1 * fx + p_2 * fy + p_3 * fz \\]\n where \\(\text{tetraBaryCoords}[j] = [fx, fy, fz]\\).\n- **Hexahedron Mapping** (for hexahedron \\(h\\) with vertices \\((p_0, p_1, \\\\dots, p_7)\\)):\n \\[ p_h = p_0 * ((1-fx)(1-fy)(1-fz)) + p_1 * ((fx)(1-fy)(1-fz)) + p_2 * ((1-fx)(fy)(1-fz)) + p_3 * ((fx)(fy)(1-fz)) \n + p_4 * ((1-fx)(1-fy)(fz)) + p_5 * ((fx)(1-fy)(fz)) + p_6 * ((1-fx)(fy)(fz)) + p_7 * ((fx)(fy)(fz)) \\]\n where \\(\text{hexaBaryCoords}[j] = [fx, fy, fz]\\).\n\n#### Constitutive or Kinematic Laws Involved\nThe mapping component primarily involves barycentric interpolation and does not directly involve constitutive laws (such as stress-strain relations). Instead, it transforms the topology of an input mesh into a set of points based on specified barycentric coordinates. This is essentially a kinematic operation that preserves the geometry but changes the representation.\n\n#### Role in the Global FEM Pipeline\nThe `Mesh2PointTopologicalMapping` fits into the broader simulation pipeline as follows:\n- **Assembly Phase**: During initialization (`init()`), it maps primitives from the input topology to points in the output topology using barycentric coordinates. This mapping is stored and used for consistency checks.\n- **Time Integration**: It does not directly contribute to time integration but maintains topological consistency throughout simulation steps via `updateTopologicalMappingTopDown()`, ensuring that changes in the input mesh are correctly reflected in the point set output topology.\n- **Nonlinear Solve / Linear Solve**: Since it is a topological mapping, its role is primarily in maintaining the correct connectivity and structure of the points. It does not directly influence nonlinear or linear solvers but ensures that the system remains consistent for such operations.\n\n#### Numerical Methods or Discretization Choices\nThe component uses barycentric interpolation to compute new positions of mapped points based on specified barycentric coordinates. This approach is a form of affine transformation and does not involve any finite element discretization directly but serves as a preparatory step for more complex simulations where such mappings are required.\n\n#### Integration into Variational / Lagrangian Mechanics Framework\nAlthough `Mesh2PointTopologicalMapping` itself does not implement variational or Lagrangian mechanics principles directly, it is part of the broader framework that supports these principles. By maintaining consistent and correct topologies, it ensures that subsequent components (like force fields and constraints) operate on valid and well-defined structures. This mapping can be critical for ensuring that deformation gradients and other continuum mechanics quantities are accurately computed in simulations involving complex geometries.",
"abstract": "The `Mesh2PointTopologicalMapping` component maps any mesh primitive (points, edges, triangles, etc.) into points using relative positions defined by barycentric coordinates. It supports controlling which primitives are mapped through parameters such as `copyEdges`, `copyTriangles`, and `copyTetrahedra`.",
"sheet": "# Mesh2PointTopologicalMapping\n\n## Overview\nThe `Mesh2PointTopologicalMapping` class in the SOFA framework maps any primitive (points, edges, triangles, quads, tetrahedra, hexahedra) from an input MeshTopology to points in an output PointSetTopology using relative positions defined by barycentric coordinates. It inherits from the `TopologicalMapping` interface and is part of the `Sofa.Component.Mapping.Linear` module.\n\n## Mathematical Model\nThe mappings are described mathematically as follows:\n- **Point Mapping**:\n \\[ p_i = p_{input}(i) + \\text{pointBaryCoords}[j] \\]\n- **Edge Mapping** (for edge $e$ with vertices $(p_0, p_1)$):\n \\[ p_e = p_0 * (1 - fx) + p_1 * fx \\]\n where $\\text{edgeBaryCoords}[j] = [fx]$.\n- **Triangle Mapping** (for triangle $t$ with vertices $(p_0, p_1, p_2)$):\n \\[ p_t = p_0 * (1 - fx - fy) + p_1 * fx + p_2 * fy \\]\n where $\\text{triangleBaryCoords}[j] = [fx, fy]$.\n- **Quad Mapping** (for quad $q$ with vertices $(p_0, p_1, p_2, p_3)$):\n \\[ p_q = p_0 * ((1-fx) * (1-fy)) + p_1 * ((fx) * (1-fy)) + p_2 * ((1-fx) * (fy)) + p_3 * ((fx) * (fy)) \\]\n where $\\text{quadBaryCoords}[j] = [fx, fy]$.\n- **Tetrahedron Mapping** (for tetrahedron $t$ with vertices $(p_0, p_1, p_2, p_3)$):\n \\[ p_t = p_0 * ((1-fx-fy-fz)) + p_1 * fx + p_2 * fy + p_3 * fz \\]\n where $\\text{tetraBaryCoords}[j] = [fx, fy, fz]$.\n- **Hexahedron Mapping** (for hexahedron $h$ with vertices $(p_0, p_1, \\dots, p_7)$):\n \\[ p_h = p_0 * ((1-fx)(1-fy)(1-fz)) + p_1 * ((fx)(1-fy)(1-fz)) + p_2 * ((1-fx)(fy)(1-fz)) + p_3 * ((fx)(fy)(1-fz)) \n + p_4 * ((1-fx)(1-fy)(fz)) + p_5 * ((fx)(1-fy)(fz)) + p_6 * ((1-fx)(fy)(fz)) + p_7 * ((fx)(fy)(fz)) \\]\n where $\\text{hexaBaryCoords}[j] = [fx, fy, fz]$.\n\n## Parameters and Data\nThe significant data fields exposed by the component are:\n- **copyEdges**: Activate mapping of input edges into the output topology (requires at least one item in `pointBaryCoords`).\n- **copyTriangles**: Activate mapping of input triangles into the output topology (requires at least one item in `pointBaryCoords`).\n- **copyTetrahedra**: Activate mapping of input tetrahedra into the output topology (requires at least one item in `pointBaryCoords`).\n\n## Dependencies and Connections\nThis component typically requires a MeshTopology as its input and outputs a PointSetTopology. It fits into the scene graph by connecting to components that generate or modify mesh topologies, such as force fields or deformation models."
}