IdentityMapping
This component is classified under the category of Mappings.
In this particular mapping, we designate the input as the parent state and the output as the child state. The transformation function employed in this mapping is the identity function. Formally, if \(f\) denotes the mapping function, then for any input \(x\), the output \(f(x)\) is exactly \(x\). In other words, the identity function directly maps each element to itself without any modification.
Mathematically, this can be expressed as:
for all \(x\) in the domain.
The Jacobian matrix of this mapping, which represents the first-order partial derivatives of the output with respect to the input, is the identity matrix. This means that the rate of change of each output variable with respect to the corresponding input variable is 1, while the rate of change with respect to all other variables is 0. The identity matrix \(I\) in this context can be defined as:
where \(J\) is the Jacobian matrix, and \(I\) is the identity matrix.
Furthermore, the transpose of the Jacobian matrix, denoted as \(J^T\), is also the identity matrix.
Given that the Jacobian matrix is constant and does not vary with the input, the second-order partial derivatives of the mapping are zero. Hence, the Hessian matrix, which contains these second-order derivatives, is a null matrix (a matrix where all elements are zero).
Implementation Details
Given the fact that the mapping function is the identity, the apply
method effectively performs a direct copy of the input state into the output state.
Since the Jacobian matrix is the identity matrix, the applyJ
method also operates as a simple copy.
Similarly, for the applyJT
method, which applies the transpose of the Jacobian matrix, the operation remains a straightforward copy.
The Hessian matrix being null means that the second-order derivatives of the mapping function are zero.
Consequently, methods that depend on the Hessian matrix, such as applyDJT
and buildGeometricStiffnessMatrix
, will be effectively empty or trivial.
These methods do not need to perform any computations because there are no second-order effects to account for in the mapping.
Special case of mapping where the child DOFs are the same as the parent ones
Rigid2d,Rigid2d
Templates:
- Rigid2d,Rigid2d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Rigid2d> |
output | Output object to map | State<Rigid2d> |
Rigid2d,Vec2d
Templates:
- Rigid2d,Vec2d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Rigid2d> |
output | Output object to map | State<Vec2d> |
Rigid3d,Rigid3d
Templates:
- Rigid3d,Rigid3d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Rigid3d> |
output | Output object to map | State<Rigid3d> |
Rigid3d,Vec3d
Templates:
- Rigid3d,Vec3d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Rigid3d> |
output | Output object to map | State<Vec3d> |
Vec1d,Vec1d
Templates:
- Vec1d,Vec1d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Vec1d> |
output | Output object to map | State<Vec1d> |
Vec2d,Vec2d
Templates:
- Vec2d,Vec2d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Vec2d> |
output | Output object to map | State<Vec2d> |
Vec3d,Vec3d
Templates:
- Vec3d,Vec3d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Vec3d> |
output | Output object to map | State<Vec3d> |
Vec6d,Vec3d
Templates:
- Vec6d,Vec3d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Vec6d> |
output | Output object to map | State<Vec3d> |
Vec6d,Vec6d
Templates:
- Vec6d,Vec6d
Target: Sofa.Component.Mapping.Linear
namespace: sofa::component::mapping::linear
parents:
- CRTPLinearMapping
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
mapForces | Are forces mapped ? | 1 |
mapConstraints | Are constraints mapped ? | 1 |
mapMasses | Are masses mapped ? | 1 |
mapMatrices | Are matrix explicit mapped? | 0 |
applyRestPosition | set to true to apply this mapping to restPosition at init | 0 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
input | Input object to map | State<Vec6d> |
output | Output object to map | State<Vec6d> |
Examples
IdentityMapping.scn
<!-- Mechanical MassSpring Group Basic Example -->
<Node name="root" dt="0.02">
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangleFEMForceField] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<DefaultAnimationLoop/>
<VisualStyle displayFlags="showBehaviorModels showMappings" />
<CollisionPipeline verbose="0" />
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<CollisionResponse response="PenalityContactForceField" />
<MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
<Node name="tshirt">
<EulerImplicitSolver rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="25" tolerance="1e-5" threshold="1e-5"/>
<MeshGmshLoader name="loader" filename="mesh/tshirt_0.msh" />
<MeshTopology src="@loader" />
<MechanicalObject src="@loader" scale="10" />
<include href="Objects/TriangleSetTopology.xml" src="@loader" />
<UniformMass vertexMass="1" />
<FixedProjectiveConstraint indices="38 39 40 41 42 43 123 124 137" />
<TriangleFEMForceField name="FEM" youngModulus="50000" poissonRatio="0.3" method="large" />
<TriangleCollisionModel />
<Node name="Visu">
<OglModel name="Visual" color="red" />
<IdentityMapping input="@.." output="@Visual" />
</Node>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', dt="0.02")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
root.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
root.addObject('DefaultAnimationLoop', )
root.addObject('VisualStyle', displayFlags="showBehaviorModels showMappings")
root.addObject('CollisionPipeline', verbose="0")
root.addObject('BruteForceBroadPhase', )
root.addObject('BVHNarrowPhase', )
root.addObject('CollisionResponse', response="PenalityContactForceField")
root.addObject('MinProximityIntersection', name="Proximity", alarmDistance="0.8", contactDistance="0.5")
tshirt = root.addChild('tshirt')
tshirt.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1")
tshirt.addObject('CGLinearSolver', iterations="25", tolerance="1e-5", threshold="1e-5")
tshirt.addObject('MeshGmshLoader', name="loader", filename="mesh/tshirt_0.msh")
tshirt.addObject('MeshTopology', src="@loader")
tshirt.addObject('MechanicalObject', src="@loader", scale="10")
tshirt.addObject('include', href="Objects/TriangleSetTopology.xml", src="@loader")
tshirt.addObject('UniformMass', vertexMass="1")
tshirt.addObject('FixedProjectiveConstraint', indices="38 39 40 41 42 43 123 124 137")
tshirt.addObject('TriangleFEMForceField', name="FEM", youngModulus="50000", poissonRatio="0.3", method="large")
tshirt.addObject('TriangleCollisionModel', )
visu = tshirt.addChild('Visu')
visu.addObject('OglModel', name="Visual", color="red")
visu.addObject('IdentityMapping', input="@..", output="@Visual")