Skip to content

AdaptiveBeamMapping

Set the positions and velocities of points attached to a beam using linear interpolation between DOFs.

Rigid3d,Rigid3d

Templates:

  • Rigid3d,Rigid3d

Target: BeamAdapter

namespace: beamadapter

parents:

  • Mapping

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
useCurvAbs true if the curvilinear abscissa of the points remains the same during the simulation if not the curvilinear abscissa moves with adaptivity and the num of segment per beam is always the same 1
points defines the mapped points along the beam axis (in beam frame local coordinates)
proximity if positive, the mapping is modified for the constraints to take into account the lever created by the proximity 0
contactDuplicate if true, this mapping is a copy of an input mapping and is used to gather contact points (ContinuousFrictionContact Response) 0
nameOfInputMap if contactDuplicate==true, it provides the name of the input mapping
nbPointsPerBeam if non zero, we will adapt the points depending on the discretization, with this num of points per beam (compatible with useCurvAbs) 0
segmentsCurvAbs the abscissa of each point on the collision model
parallelMapping flag to enable parallel internal computation 0
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>
interpolation Path to the Interpolation component on scene BaseBeamInterpolation<Rigid3d>

Rigid3d,Vec3d

Templates:

  • Rigid3d,Vec3d

Target: BeamAdapter

namespace: beamadapter

parents:

  • Mapping

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
useCurvAbs true if the curvilinear abscissa of the points remains the same during the simulation if not the curvilinear abscissa moves with adaptivity and the num of segment per beam is always the same 1
points defines the mapped points along the beam axis (in beam frame local coordinates)
proximity if positive, the mapping is modified for the constraints to take into account the lever created by the proximity 0
contactDuplicate if true, this mapping is a copy of an input mapping and is used to gather contact points (ContinuousFrictionContact Response) 0
nameOfInputMap if contactDuplicate==true, it provides the name of the input mapping
nbPointsPerBeam if non zero, we will adapt the points depending on the discretization, with this num of points per beam (compatible with useCurvAbs) 0
segmentsCurvAbs the abscissa of each point on the collision model
parallelMapping flag to enable parallel internal computation 0
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>
interpolation Path to the Interpolation component on scene BaseBeamInterpolation<Rigid3d>

Examples

AdaptiveBeamMapping.scn

<?xml version="1.0"?>
<Node name="root" gravity="0 -9.81 0" dt="0.01" >
    <RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [BTDLinearSolver] -->
    <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 [CubeTopology MeshTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <VisualStyle displayFlags="showBehaviorModels showCollisionModels hideBoundingCollisionModels showForceFields" />

    <DefaultAnimationLoop />
    <DefaultVisualManagerLoop />

    <Node name="AdaptiveBeam2">
        <EulerImplicitSolver rayleighStiffness="0" rayleighMass="0" printLog="false" />
        <BTDLinearSolver verbose="0"/>
        <MechanicalObject template="Rigid3d" name="DOFs" position="0 0 2 0 0 0 1  1 0 2 0 0 0 1  2 0 2 0 0 0 1  3 0 2 0 0 0 1"/> 
        <MeshTopology name="lines" lines="0 1 1 2 2 3" /> 
        <FixedProjectiveConstraint name="FixedConstraint" indices="0" />
        <BeamInterpolation name="BeamInterpolation" radius="0.1" /> 
        <AdaptiveBeamForceFieldAndMass name="BeamForceField"  computeMass="1" massDensity="10"/>
        <Node name="Collision">
            <CubeTopology nx="20" ny="2" nz="2" min="0 -0.1 -0.1" max="3 0.1 0.1" />
            <MechanicalObject template="Vec3d" name="collision"/>
            <TriangleCollisionModel color="0.5 1 0.5 1" />
            <AdaptiveBeamMapping isMechanical="true" input="@../DOFs"  output="@collision" mapForces="0" mapMasses="0"/>        
        </Node>
    </Node>  

</Node>
def createScene(root_node):

   root = root_node.addChild('root', gravity="0 -9.81 0", dt="0.01")

   root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
   root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Direct")
   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 hideBoundingCollisionModels showForceFields")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('DefaultVisualManagerLoop', )

   adaptive_beam2 = root.addChild('AdaptiveBeam2')

   adaptive_beam2.addObject('EulerImplicitSolver', rayleighStiffness="0", rayleighMass="0", printLog="false")
   adaptive_beam2.addObject('BTDLinearSolver', verbose="0")
   adaptive_beam2.addObject('MechanicalObject', template="Rigid3d", name="DOFs", position="0 0 2 0 0 0 1  1 0 2 0 0 0 1  2 0 2 0 0 0 1  3 0 2 0 0 0 1")
   adaptive_beam2.addObject('MeshTopology', name="lines", lines="0 1 1 2 2 3")
   adaptive_beam2.addObject('FixedProjectiveConstraint', name="FixedConstraint", indices="0")
   adaptive_beam2.addObject('BeamInterpolation', name="BeamInterpolation", radius="0.1")
   adaptive_beam2.addObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass="1", massDensity="10")

   collision = AdaptiveBeam2.addChild('Collision')

   collision.addObject('CubeTopology', nx="20", ny="2", nz="2", min="0 -0.1 -0.1", max="3 0.1 0.1")
   collision.addObject('MechanicalObject', template="Vec3d", name="collision")
   collision.addObject('TriangleCollisionModel', color="0.5 1 0.5 1")
   collision.addObject('AdaptiveBeamMapping', isMechanical="true", input="@../DOFs", output="@collision", mapForces="0", mapMasses="0")