Skip to content

SubsetMultiMapping

Compute a subset of the input MechanicalObjects according to a dof index list.

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
indexPairs list of couples (parent index + index in the parent)
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(s) State<Rigid3d>
output Output Object(s) 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
indexPairs list of couples (parent index + index in the parent)
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(s) State<Rigid3d>
output Output Object(s) 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
indexPairs list of couples (parent index + index in the parent)
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(s) State<Vec1d>
output Output Object(s) 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
indexPairs list of couples (parent index + index in the parent)
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(s) State<Vec2d>
output Output Object(s) 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
indexPairs list of couples (parent index + index in the parent)
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(s) State<Vec3d>
output Output Object(s) State<Vec3d>

Examples

SubsetMultiMapping.scn

<?xml version="1.0"?>
<Node name="root" dt="0.02" gravity="0 0 0">

    <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 [DiscreteIntersection] -->
    <RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [SphereCollisionModel] -->
    <RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [GridMeshCreator] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [SubsetMultiMapping] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [ConstantForceField] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <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.Visual"/> <!-- Needed to use components [VisualStyle] -->

    <VisualStyle displayFlags="showBehaviorModels showCollisionModels showForceFields" />

    <CollisionPipeline/>
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <CollisionResponse response="PenalityContactForceField" />
    <DiscreteIntersection/>
    <DefaultAnimationLoop/>


    <EulerImplicitSolver  rayleighStiffness="0.1" rayleighMass="0.1" />
    <CGLinearSolver iterations="25" tolerance="1e-5" threshold="1e-5"/>


    <Node name="object1">        
        <GridMeshCreator name="loader" filename="nofile" resolution="2 2" />
        <MeshTopology src="@loader" />
        <MechanicalObject template="Vec3" src="@loader" name="dof1" />

        <Node name="object2">        
            <GridMeshCreator name="loader" filename="nofile" resolution="2 2" translation="2 0 0" />
            <MeshTopology src="@loader" />
            <MechanicalObject template="Vec3" src="@loader"  name="dof2"/>

            <Node name="concatenation">
                <MechanicalObject template="Vec3" name="dofall" showObject="1"/>
                <SubsetMultiMapping template="Vec3,Vec3" input="@../../dof1 @../dof2" output="@./dofall" indexPairs="0 0 0 1 1 0 1 1"/>
                <SphereCollisionModel radius="0.3" selfCollision="1"/>
                <UniformMass vertexMass="1" />
                <ConstantForceField indices="0" forces="1 0 0"/>
            </Node>

        </Node>

    </Node>

    <!--    converting  Rigid -> Vec in SubsetMultiMapping  -->
    <Node name="rigid1" activated="1">
        <GridMeshCreator name="loader" filename="nofile" resolution="2 2"  translation="0 2 0"/>
        <MeshTopology src="@loader" />
        <MechanicalObject template="Rigid3" src="@loader" name="dof1" />

        <Node name="origid2">
            <GridMeshCreator name="loader" filename="nofile" resolution="2 2" translation="2 2 0" />
            <MeshTopology src="@loader" />
            <MechanicalObject template="Rigid3" src="@loader"  name="dof2"/>

            <Node name="concatenation">
                <MechanicalObject template="Vec3" name="dofall" showObject="1"/>
                <SubsetMultiMapping template="Rigid3,Vec3" input="@../../dof1 @../dof2" output="@./dofall" indexPairs="0 0 0 1 1 0 1 1"/>
                <SphereCollisionModel radius="0.3" selfCollision="1"/>
                <UniformMass vertexMass="1" />
                <ConstantForceField indices="0" forces="1 0 0"/>
            </Node>

        </Node>

    </Node>


</Node>
def createScene(root_node):

   root = root_node.addChild('root', dt="0.02", gravity="0 0 0")

   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.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.MechanicalLoad")
   root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
   root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
   root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   root.addObject('VisualStyle', displayFlags="showBehaviorModels showCollisionModels showForceFields")
   root.addObject('CollisionPipeline', )
   root.addObject('BruteForceBroadPhase', )
   root.addObject('BVHNarrowPhase', )
   root.addObject('CollisionResponse', response="PenalityContactForceField")
   root.addObject('DiscreteIntersection', )
   root.addObject('DefaultAnimationLoop', )
   root.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1")
   root.addObject('CGLinearSolver', iterations="25", tolerance="1e-5", threshold="1e-5")

   object1 = root.addChild('object1')

   object1.addObject('GridMeshCreator', name="loader", filename="nofile", resolution="2 2")
   object1.addObject('MeshTopology', src="@loader")
   object1.addObject('MechanicalObject', template="Vec3", src="@loader", name="dof1")

   object2 = object1.addChild('object2')

   object2.addObject('GridMeshCreator', name="loader", filename="nofile", resolution="2 2", translation="2 0 0")
   object2.addObject('MeshTopology', src="@loader")
   object2.addObject('MechanicalObject', template="Vec3", src="@loader", name="dof2")

   concatenation = object2.addChild('concatenation')

   concatenation.addObject('MechanicalObject', template="Vec3", name="dofall", showObject="1")
   concatenation.addObject('SubsetMultiMapping', template="Vec3,Vec3", input="@../../dof1 @../dof2", output="@./dofall", indexPairs="0 0 0 1 1 0 1 1")
   concatenation.addObject('SphereCollisionModel', radius="0.3", selfCollision="1")
   concatenation.addObject('UniformMass', vertexMass="1")
   concatenation.addObject('ConstantForceField', indices="0", forces="1 0 0")

   rigid1 = root.addChild('rigid1', activated="1")

   rigid1.addObject('GridMeshCreator', name="loader", filename="nofile", resolution="2 2", translation="0 2 0")
   rigid1.addObject('MeshTopology', src="@loader")
   rigid1.addObject('MechanicalObject', template="Rigid3", src="@loader", name="dof1")

   origid2 = rigid1.addChild('origid2')

   origid2.addObject('GridMeshCreator', name="loader", filename="nofile", resolution="2 2", translation="2 2 0")
   origid2.addObject('MeshTopology', src="@loader")
   origid2.addObject('MechanicalObject', template="Rigid3", src="@loader", name="dof2")

   concatenation = origid2.addChild('concatenation')

   concatenation.addObject('MechanicalObject', template="Vec3", name="dofall", showObject="1")
   concatenation.addObject('SubsetMultiMapping', template="Rigid3,Vec3", input="@../../dof1 @../dof2", output="@./dofall", indexPairs="0 0 0 1 1 0 1 1")
   concatenation.addObject('SphereCollisionModel', radius="0.3", selfCollision="1")
   concatenation.addObject('UniformMass', vertexMass="1")
   concatenation.addObject('ConstantForceField', indices="0", forces="1 0 0")