TriangularBendingSprings
Springs added to a triangular mesh to prevent bending
Vec3d
Templates:
- Vec3d
Target: Sofa.Component.SolidMechanics.Spring
namespace: sofa::component::solidmechanics::spring
parents:
- ForceField
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 | 100000 |
damping | uniform damping for the all springs | 1 |
edgeInfo | Internal edge data | |
Visualization | ||
showSprings | option to draw springs | 1 |
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 |
mechanicalStates | List of mechanical states to which this component is associated | BaseMechanicalState |
mstate | MechanicalState used by this component | MechanicalState<Vec3d> |
topology | link to the topology container | BaseMeshTopology |
Examples
TriangularBendingSprings.scn
<!-- Mechanical MassSpring Group Basic Example -->
<Node name="root" dt="0.005" showBoundingTree="0" gravity="0 -90 10">
<Node name="plugins">
<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.Direct"/> <!-- Needed to use components [AsyncSparseLDLSolver] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [ShewchukPCGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangularFEMForceField] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [TriangularBendingSprings] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
</Node>
<VisualStyle displayFlags="showBehaviorModels" />
<DefaultAnimationLoop/>
<Node name="SquareGravity">
<EulerImplicitSolver name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" />
<ShewchukPCGLinearSolver preconditioner="@preconditioner"/>
<AsyncSparseLDLSolver name="preconditioner" template="CompressedRowSparseMatrixMat3x3"/>
<MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true"/>
<MechanicalObject src="@loader" scale="10" />
<TriangleSetTopologyContainer name="Container" triangles="@loader.triangles"/>
<DiagonalMass massDensity="0.015" />
<FixedProjectiveConstraint indices="0 1" />
<TriangularFEMForceField name="FEM" youngModulus="60" poissonRatio="0.3" method="large" />
<TriangularBendingSprings name="BS" stiffness="300" damping="1.0" />
<Node >
<OglModel name="Visual" color="yellow" />
<IdentityMapping input="@.." output="@Visual" />
</Node>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', dt="0.005", showBoundingTree="0", gravity="0 -90 10")
plugins = root.addChild('plugins')
plugins.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
plugins.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
plugins.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Direct")
plugins.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
plugins.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
plugins.addObject('RequiredPlugin', name="Sofa.Component.Mass")
plugins.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
plugins.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
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.Visual")
plugins.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
root.addObject('VisualStyle', displayFlags="showBehaviorModels")
root.addObject('DefaultAnimationLoop', )
square_gravity = root.addChild('SquareGravity')
square_gravity.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
square_gravity.addObject('ShewchukPCGLinearSolver', preconditioner="@preconditioner")
square_gravity.addObject('AsyncSparseLDLSolver', name="preconditioner", template="CompressedRowSparseMatrixMat3x3")
square_gravity.addObject('MeshGmshLoader', name="loader", filename="mesh/square3.msh", createSubelements="true")
square_gravity.addObject('MechanicalObject', src="@loader", scale="10")
square_gravity.addObject('TriangleSetTopologyContainer', name="Container", triangles="@loader.triangles")
square_gravity.addObject('DiagonalMass', massDensity="0.015")
square_gravity.addObject('FixedProjectiveConstraint', indices="0 1")
square_gravity.addObject('TriangularFEMForceField', name="FEM", youngModulus="60", poissonRatio="0.3", method="large")
square_gravity.addObject('TriangularBendingSprings', name="BS", stiffness="300", damping="1.0")
node = SquareGravity.addChild('node')
node.addObject('OglModel', name="Visual", color="yellow")
node.addObject('IdentityMapping', input="@..", output="@Visual")
TriangularBendingSprings_RemovingMeshTest.scn
<?xml version="1.0" ?>
<!-- Automatic Triangle removal on a simple Triangle topology with FEM: Element removed are define in: ./RemovingTrianglesProcess.txt -->
<Node name="root" gravity="0 -9 0" dt="0.01" bbox="-1 -1 -1 1 1 1">
<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.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<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.Mass"/> <!-- Needed to use components [DiagonalMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [TriangularBendingSprings] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Topology.Utility"/> <!-- Needed to use components [TopologicalChangeProcessor] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<VisualStyle displayFlags="showVisual showBehaviorModels showForceFields" />
<DefaultAnimationLoop/>
<CollisionPipeline verbose="0" />
<BruteForceBroadPhase name="N2" />
<BVHNarrowPhase />
<CollisionResponse response="PenalityContactForceField" />
<MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
<Node name="SquareGravity">
<EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="25" tolerance="1e-5" threshold="1e-5" name="linear solver"/>
<MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true" />
<MechanicalObject name="dofs" src="@loader" template="Vec3" />
<TriangleSetTopologyContainer name="Triangle_topo" src="@loader"/>
<TriangleSetTopologyModifier name="Modifier" />
<TriangleSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
<DiagonalMass template="Vec3,Vec3" name="mass" massDensity="1.0" />
<TriangularBendingSprings template="Vec3" name="FEM-Bend" stiffness="300" damping="1" />
<TopologicalChangeProcessor listening="1" filename="RemovingTrianglesProcess_constraint.txt" />
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', gravity="0 -9 0", dt="0.01", bbox="-1 -1 -1 1 1 1")
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.Response.Contact")
root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Utility")
root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
root.addObject('VisualStyle', displayFlags="showVisual showBehaviorModels showForceFields")
root.addObject('DefaultAnimationLoop', )
root.addObject('CollisionPipeline', verbose="0")
root.addObject('BruteForceBroadPhase', name="N2")
root.addObject('BVHNarrowPhase', )
root.addObject('CollisionResponse', response="PenalityContactForceField")
root.addObject('MinProximityIntersection', name="Proximity", alarmDistance="0.8", contactDistance="0.5")
square_gravity = root.addChild('SquareGravity')
square_gravity.addObject('EulerImplicitSolver', name="cg_odesolver", rayleighStiffness="0.1", rayleighMass="0.1")
square_gravity.addObject('CGLinearSolver', iterations="25", tolerance="1e-5", threshold="1e-5", name="linear solver")
square_gravity.addObject('MeshGmshLoader', name="loader", filename="mesh/square3.msh", createSubelements="true")
square_gravity.addObject('MechanicalObject', name="dofs", src="@loader", template="Vec3")
square_gravity.addObject('TriangleSetTopologyContainer', name="Triangle_topo", src="@loader")
square_gravity.addObject('TriangleSetTopologyModifier', name="Modifier")
square_gravity.addObject('TriangleSetGeometryAlgorithms', template="Vec3", name="GeomAlgo")
square_gravity.addObject('DiagonalMass', template="Vec3,Vec3", name="mass", massDensity="1.0")
square_gravity.addObject('TriangularBendingSprings', template="Vec3", name="FEM-Bend", stiffness="300", damping="1")
square_gravity.addObject('TopologicalChangeProcessor', listening="1", filename="RemovingTrianglesProcess_constraint.txt")