Skip to content

ParallelMeshSpringForceField

Parallel stiff springs acting along the edges of a mesh

Vec1d

Templates:

  • Vec1d

Target: MultiThreading

namespace: multithreading::component::solidmechanics::spring

parents:

  • MeshSpringForceField
  • ParallelSpringForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
stiffness uniform stiffness for the all springs 100
damping uniform damping for the all springs 5
spring pairs of indices, stiffness, damping, rest length
lengths List of lengths to create the springs. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, 0 will be applied everywhere
elongationOnly ///< List of boolean stating on the fact that the spring should only apply forces on elongations. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, False will be applied everywhere 0
enabled ///< List of boolean stating on the fact that the spring is enabled. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, True will be applied everywhere 1
springsIndices1 List of indices in springs from the first mstate
springsIndices2 List of indices in springs from the second mstate
linesStiffness Stiffness for the Lines 0
linesDamping Damping for the Lines 0
trianglesStiffness Stiffness for the Triangles 0
trianglesDamping Damping for the Triangles 0
quadsStiffness Stiffness for the Quads 0
quadsDamping Damping for the Quads 0
tetrahedraStiffness Stiffness for the Tetrahedra 0
tetrahedraDamping Damping for the Tetrahedra 0
cubesStiffness Stiffness for the Cubes 0
cubesDamping Damping for the Cubes 0
noCompression Only consider elongation 0
localRange optional range of local DOF indices. Any computation involving only indices outside of this range are discarded (useful for parallelization using mesh partitioning) 4294967295 4294967295
nbThreads If not yet initialized, the main task scheduler is initialized with this number of threads. 0 corresponds to the number of available cores on the CPU. -n (minus) corresponds to the number of available cores on the CPU minus the provided number. 0
taskSchedulerType Type of task scheduler to use. _default
Visualization
showArrowSize size of the axis 0.01
drawMode The way springs will be drawn: - 0: Line - 1:Cylinder - 2: Arrow 0
drawMinElongationRange Min range of elongation (red eongation - blue neutral - green compression) 8
drawMaxElongationRange Max range of elongation (red eongation - blue neutral - green compression) 15
drawSpringSize Size of drawed lines 8
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
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
object1 First object associated to this component MechanicalState<Vec1d>
object2 Second object associated to this component MechanicalState<Vec1d>
topology link to the topology container BaseMeshTopology

Vec2d

Templates:

  • Vec2d

Target: MultiThreading

namespace: multithreading::component::solidmechanics::spring

parents:

  • MeshSpringForceField
  • ParallelSpringForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
stiffness uniform stiffness for the all springs 100
damping uniform damping for the all springs 5
spring pairs of indices, stiffness, damping, rest length
lengths List of lengths to create the springs. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, 0 will be applied everywhere
elongationOnly ///< List of boolean stating on the fact that the spring should only apply forces on elongations. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, False will be applied everywhere 0
enabled ///< List of boolean stating on the fact that the spring is enabled. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, True will be applied everywhere 1
springsIndices1 List of indices in springs from the first mstate
springsIndices2 List of indices in springs from the second mstate
linesStiffness Stiffness for the Lines 0
linesDamping Damping for the Lines 0
trianglesStiffness Stiffness for the Triangles 0
trianglesDamping Damping for the Triangles 0
quadsStiffness Stiffness for the Quads 0
quadsDamping Damping for the Quads 0
tetrahedraStiffness Stiffness for the Tetrahedra 0
tetrahedraDamping Damping for the Tetrahedra 0
cubesStiffness Stiffness for the Cubes 0
cubesDamping Damping for the Cubes 0
noCompression Only consider elongation 0
localRange optional range of local DOF indices. Any computation involving only indices outside of this range are discarded (useful for parallelization using mesh partitioning) 4294967295 4294967295
nbThreads If not yet initialized, the main task scheduler is initialized with this number of threads. 0 corresponds to the number of available cores on the CPU. -n (minus) corresponds to the number of available cores on the CPU minus the provided number. 0
taskSchedulerType Type of task scheduler to use. _default
Visualization
showArrowSize size of the axis 0.01
drawMode The way springs will be drawn: - 0: Line - 1:Cylinder - 2: Arrow 0
drawMinElongationRange Min range of elongation (red eongation - blue neutral - green compression) 8
drawMaxElongationRange Max range of elongation (red eongation - blue neutral - green compression) 15
drawSpringSize Size of drawed lines 8
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
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
object1 First object associated to this component MechanicalState<Vec2d>
object2 Second object associated to this component MechanicalState<Vec2d>
topology link to the topology container BaseMeshTopology

Vec3d

Templates:

  • Vec3d

Target: MultiThreading

namespace: multithreading::component::solidmechanics::spring

parents:

  • MeshSpringForceField
  • ParallelSpringForceField

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
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
stiffness uniform stiffness for the all springs 100
damping uniform damping for the all springs 5
spring pairs of indices, stiffness, damping, rest length
lengths List of lengths to create the springs. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, 0 will be applied everywhere
elongationOnly ///< List of boolean stating on the fact that the spring should only apply forces on elongations. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, False will be applied everywhere 0
enabled ///< List of boolean stating on the fact that the spring is enabled. Must have the same than indices1 & indices2, or if only one element, it will be applied to all springs. If empty, True will be applied everywhere 1
springsIndices1 List of indices in springs from the first mstate
springsIndices2 List of indices in springs from the second mstate
linesStiffness Stiffness for the Lines 0
linesDamping Damping for the Lines 0
trianglesStiffness Stiffness for the Triangles 0
trianglesDamping Damping for the Triangles 0
quadsStiffness Stiffness for the Quads 0
quadsDamping Damping for the Quads 0
tetrahedraStiffness Stiffness for the Tetrahedra 0
tetrahedraDamping Damping for the Tetrahedra 0
cubesStiffness Stiffness for the Cubes 0
cubesDamping Damping for the Cubes 0
noCompression Only consider elongation 0
localRange optional range of local DOF indices. Any computation involving only indices outside of this range are discarded (useful for parallelization using mesh partitioning) 4294967295 4294967295
nbThreads If not yet initialized, the main task scheduler is initialized with this number of threads. 0 corresponds to the number of available cores on the CPU. -n (minus) corresponds to the number of available cores on the CPU minus the provided number. 0
taskSchedulerType Type of task scheduler to use. _default
Visualization
showArrowSize size of the axis 0.01
drawMode The way springs will be drawn: - 0: Line - 1:Cylinder - 2: Arrow 0
drawMinElongationRange Min range of elongation (red eongation - blue neutral - green compression) 8
drawMaxElongationRange Max range of elongation (red eongation - blue neutral - green compression) 15
drawSpringSize Size of drawed lines 8
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
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
object1 First object associated to this component MechanicalState<Vec3d>
object2 Second object associated to this component MechanicalState<Vec3d>
topology link to the topology container BaseMeshTopology

Examples

ParallelMeshSpringForceField.scn

<Node name="root" gravity="0 -9.81 0" dt="0.04">

    <Node name="plugins">
        <RequiredPlugin name="MultiThreading"/> <!-- Needed to use components [ParallelMeshSpringForceField] -->
        <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
        <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
        <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
        <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
        <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
        <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
        <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [HexahedronSetGeometryAlgorithms, QuadSetTopologyContainer, QuadSetTopologyModifier] -->
        <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
        <RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2QuadTopologicalMapping] -->
        <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
        <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
        <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
        <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
        <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    </Node>


    <VisualStyle displayFlags="showBehaviorModels hideForceFields" />
    <DefaultAnimationLoop computeBoundingBox="false"/>

    <Node name="DeformableObject">

        <EulerImplicitSolver name="odeSolver"/>
        <CGLinearSolver iterations="25" name="linearSolver" tolerance="1.0e-9" threshold="1.0e-9" />

        <MechanicalObject name="dofs"/>

        <RegularGridTopology name="topology" nx="16" ny="16" nz="44" xmin="-1.5" xmax="1.5" ymin="-1.5" ymax="1.5" zmin="0" zmax="10" />
        <HexahedronSetGeometryAlgorithms/>
        <UniformMass totalMass="150"/>

        <BoxROI box="-1.5 -1.5 0 1.5 1.5 0.0001" name="box"/>
        <FixedProjectiveConstraint indices="@box.indices" />
        <ParallelMeshSpringForceField stiffness="3E2" drawSpringSize="1"/>

        <Node name="visual">
            <QuadSetTopologyContainer  name="Container" />
            <QuadSetTopologyModifier/>
            <Hexa2QuadTopologicalMapping input="@../topology" output="@Container" />
            <OglModel name="Visual" color="yellow" quads="@Container.quads" />
            <IdentityMapping input="@../dofs" output="@Visual" />
        </Node>

    </Node>

    <Node name="floor-visual">
        <MeshOBJLoader name="meshLoader" filename="mesh/floorFlat.obj" scale3d="0.5 0.5 0.5"/>
        <OglModel src="@meshLoader" dy="-8" dz="10"/>
        <OglModel src="@meshLoader" rx="90" dy="2"/>
    </Node>
</Node>
def createScene(root_node):

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

   plugins = root.addChild('plugins')

   plugins.addObject('RequiredPlugin', name="MultiThreading")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   plugins.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")

   root.addObject('VisualStyle', displayFlags="showBehaviorModels hideForceFields")
   root.addObject('DefaultAnimationLoop', computeBoundingBox="false")

   deformable_object = root.addChild('DeformableObject')

   deformable_object.addObject('EulerImplicitSolver', name="odeSolver")
   deformable_object.addObject('CGLinearSolver', iterations="25", name="linearSolver", tolerance="1.0e-9", threshold="1.0e-9")
   deformable_object.addObject('MechanicalObject', name="dofs")
   deformable_object.addObject('RegularGridTopology', name="topology", nx="16", ny="16", nz="44", xmin="-1.5", xmax="1.5", ymin="-1.5", ymax="1.5", zmin="0", zmax="10")
   deformable_object.addObject('HexahedronSetGeometryAlgorithms', )
   deformable_object.addObject('UniformMass', totalMass="150")
   deformable_object.addObject('BoxROI', box="-1.5 -1.5 0 1.5 1.5 0.0001", name="box")
   deformable_object.addObject('FixedProjectiveConstraint', indices="@box.indices")
   deformable_object.addObject('ParallelMeshSpringForceField', stiffness="3E2", drawSpringSize="1")

   visual = DeformableObject.addChild('visual')

   visual.addObject('QuadSetTopologyContainer', name="Container")
   visual.addObject('QuadSetTopologyModifier', )
   visual.addObject('Hexa2QuadTopologicalMapping', input="@../topology", output="@Container")
   visual.addObject('OglModel', name="Visual", color="yellow", quads="@Container.quads")
   visual.addObject('IdentityMapping', input="@../dofs", output="@Visual")

   floor_visual = root.addChild('floor-visual')

   floor_visual.addObject('MeshOBJLoader', name="meshLoader", filename="mesh/floorFlat.obj", scale3d="0.5 0.5 0.5")
   floor_visual.addObject('OglModel', src="@meshLoader", dy="-8", dz="10")
   floor_visual.addObject('OglModel', src="@meshLoader", rx="90", dy="2")