Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions examples/xml/testClampedSquare.scn
Original file line number Diff line number Diff line change
@@ -1,33 +1,60 @@
<Node name="root" dt="0.01" showBehaviorModels="1" showCollisionModels="0" showMappings="0" showForceFields="0" showBoundingTree="0" showVisualModels="1" gravity="0 0 0">
<?xml version="1.0"?>
<Node name="root" dt="0.01" gravity="0 0 0">
<Node name="plugins">
<RequiredPlugin name="Shell"/>
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<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.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
<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.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] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="Sofa.GUI.Component"/> <!-- Needed to use components [AttachBodyButtonSetting] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [ConstantForceField] -->
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
</Node>

<VisualStyle displayFlags="showBehaviorModels hideMappings hideForceFields showVisualModels"/>
<DefaultAnimationLoop/>

<Node name="SmallSquare" activated="true">
<!-- <EulerImplicitSolver/>-->
<StaticSolver/>
<EulerImplicitSolver/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the solver here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because when i used StaticSolver, many problems appear. So i decide to use EulerImplicitSolver (It was in comment at the beginning). Would it be better to use StaticSolver ?

<!--<StaticSolver/>-->
<CGLinearSolver iterations="500" tolerance="1e-15" threshold="1e-15"/>
<!-- <SparseLDLSolver name="SparseLDL Solver" printLog="false" />-->
<TriangleSetTopologyContainer name="trianglesTopo" filename="../mesh/square5x5.obj"/>
<MechanicalObject name="tri" template="Rigid"/>
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/square5x5.obj"/>
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
<MechanicalObject name="tri" template="Rigid3" topology="@trianglesTopo" />

<!-- <UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.001" totalmass="0.1" />-->
<!-- <UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.001" totalmass="0.1" />-->

<BoxROI name="Side1" box="-5.1 -5.1 -0.1 -4.9 5.1 0.1" drawSize="0"/>
<FixedConstraint indices="@Side1.indices" drawSize="0"/>
<FixedProjectiveConstraint indices="@Side1.indices" drawSize="0"/>
<BoxROI name="Side2" box="-5.1 5.1 -0.1 5.1 4.9 0.1" drawSize="0"/>
<FixedConstraint indices="@Side2.indices" drawSize="0"/>
<FixedProjectiveConstraint indices="@Side2.indices" drawSize="0"/>
<BoxROI name="Side3" box="5.1 5.1 -0.1 4.9 -5.1 0.1" drawSize="0"/>
<FixedConstraint indices="@Side3.indices" drawSize="0"/>
<FixedProjectiveConstraint indices="@Side3.indices" drawSize="0"/>
<BoxROI name="Side4" box="5.1 -5.1 -0.1 -5.1 -4.9 0.1" drawSize="0"/>
<FixedConstraint indices="@Side4.indices" drawSize="0"/>
<FixedProjectiveConstraint indices="@Side4.indices" drawSize="0"/>

<ConstantForceField points="0-24" forces="0 0 11.1 0 0 0"/>
<ConstantForceField indices="0-24" forces="0 0 11.1 0 0 0"/>
<TriangularBendingFEMForceField name="FEM" bending="true" youngModulus="1.092e6" poissonRatio="0.3" thickness="0.1" />

<Node name="SubTriangles">

<TriangleSetTopologyContainer name="subTrianglesTopo"/>
<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="2"/>
<MechanicalObject name="subPoints" />
<BendingPlateMechanicalMapping />
<Triangle/>
<!-- <TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="2"/>
--> <MechanicalObject name="subPoints" topology="@subTrianglesTopo" />
<BendingPlateMechanicalMapping input="@../tri" output="@subPoints" />
<TriangleCollisionModel/>
</Node>

</Node>
Expand Down
106 changes: 68 additions & 38 deletions examples/xml/testContacts.scn
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
<Node name="root" dt="0.01" gravity="0 -10 0" showBehaviorModels="1" showCollisionModels="1">
<?xml version="1.0"?>
<Node name="root" dt="0.01" gravity="0 -10 0" >

<Node name="plugins">
<RequiredPlugin name="Shell"/>
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<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.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
<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.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] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="Sofa.GUI.Component"/> <!-- Needed to use components [AttachBodyButtonSetting] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [ConstantForceField] -->
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
<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.Engine.Transform"/> <!-- Needed to use components [Vertex2Frame] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [BeamFEMForceField] -->
</Node>

<VisualStyle displayFlags="showBehaviorModels showCollisionModels"/>
<DefaultAnimationLoop/>
<!-- <MasterContactSolver name="MasterSolver" maxIt="5000" tolerance="0.00000001" displayTime="true" printLog="0" mu="0.1"/>-->
<CollisionPipeline verbose="0" />
<BruteForceDetection name="N2" />
<CollisionResponse />
<BruteForceBroadPhase name="N2"/>
<BVHNarrowPhase/>
<CollisionResponse name="response" response="PenaltyContactForceField" />
<MinProximityIntersection name="Proximity" alarmDistance="0.005" contactDistance="0.001"/>
<CollisionGroup />


<Node name="pointA">
<MechanicalObject template="Rigid" name="fixedPoint" position="-0.03 0 0 0 0 0 1"/>
<MechanicalObject template="Rigid3" name="fixedPoint" position="-0.03 0 0 0 0 0 1"/>
</Node>


Expand All @@ -18,27 +50,24 @@
<MechanicalObject name="ArticulatedObject" template="Vec1d"/>
<Node name="6D_DOFs1">

<MechanicalObject name="6D_Dof" template="Rigid"/>
<UniformMass totalmass="1" showAxisSizeFactor="0.001"/>
<ArticulatedSystemMapping object1="ArticulatedObject" object2="6D_Dof"/>
<MechanicalObject name="6D_Dof" template="Rigid3"/>
<UniformMass totalMass="1" showAxisSizeFactor="0.001"/>
<ArticulatedSystemMapping input1="@../ArticulatedObject" output="@6D_Dof"/>
</Node>
<ArticulatedHierarchyContainer filename="BeamMotionInTube.bvh"/>
<ArticulatedHierarchyBVHController />
</Node>





<Node name="Beam">
<EulerImplicit rayleighStiffness="0" printLog="false" />
<EulerImplicitSolver rayleighStiffness="0" printLog="false" />
<!-- <BTDLinearSolver template="NewMatBand" bandWidth="11" printLog="false" verbose="false" />-->
<SparseLDLSolver name="SparseLDL Solver" printLog="false" />
<MechanicalObject template="Rigid" name="DOFs" position="-0.03 0 0 0 0 0 1 -0.02 0 0 0 0 0 1 -0.01 0 0 0 0 0 1 0 0 0 0 0 0 1 0.01 0 0 0 0 0 1 0.02 0 0 0 0 0 1 0.03 0 0 0 0 0 1 0.04 0 0 0 0 0 1" />
<Mesh name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7" />

<AttachConstraint name="Constraint" object2="DOFs" object1="pointA/fixedPoint" indices1="0" indices2="0" freeRotations="false" />
<UniformMass mass="0.5 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.1 ]" totalMass="0.2" showAxisSizeFactor="0.01" printLog="false" />
<SparseLDLSolver name="SparseLDL Solver" printLog="false" template="CompressedRowSparseMatrixd"/>
<MechanicalObject template="Rigid3" name="DOFs" position="-0.03 0 0 0 0 0 1 -0.02 0 0 0 0 0 1 -0.01 0 0 0 0 0 1 0 0 0 0 0 0 1 0.01 0 0 0 0 0 1 0.02 0 0 0 0 0 1 0.03 0 0 0 0 0 1 0.04 0 0 0 0 0 1" />
<MeshTopology name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7" />
<!--<AttachProjectiveConstraint name="Constraint" object2="@DOFs" object1="@/pointA/fixedPoint" indices1="0" indices2="0" freeRotations="false" />-->
<FixedProjectiveConstraint indices="0"/>
<UniformMass vertexMass="0.5 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.1 ]" showAxisSizeFactor="0.01" printLog="false" />
<BeamFEMForceField name="FEM" radius="0.01" youngModulus="1e6" />

<!-- <RestShapeSpringsForceField points="7" stiffness="1e6" angularStiffness="1e6" external_rest_shape="../Motion/6D_DOFs1/6D_Dof" external_points="1"/>-->
Expand All @@ -47,55 +76,56 @@
<!-- <CubeTopology nx="2" ny="15" nz="2" min="0.001 -0.03 -0.001" max="-0.001 0.04 0.001" />-->
<!-- <MechanicalObject />-->
<!-- <BeamLinearMapping isMechanical="true" localCoord="false"/>-->
<!-- <Triangle />-->
<!-- <TriangleCollisionModel />-->
<!-- </Node>-->
<Node name="Collision">
<CubeTopology nx="15" ny="2" nz="2" min="0 -0.1 -0.1" max="7 0.1 0.1" />
<MechanicalObject />
<BeamLinearMapping isMechanical="true" localCoord="true"/>
<Triangle contactStiffness="1e4" bothSide="1"/>
<Line contactStiffness="1e4" bothSide="1"/>
<Point contactStiffness="1e4" bothSide="1"/>
<TriangleCollisionModel contactStiffness="1e4" bothSide="1"/>
<LineCollisionModel contactStiffness="1e4" bothSide="1"/>
<PointCollisionModel contactStiffness="1e4" bothSide="1"/>
</Node>
</Node>




<Node name="Rest_colon">
<MeshLoader name="rest_shape" filename="applications/plugins/shells/mesh/fake_colon.obj"/>
<Mesh/>
<Vertex2Frame name="RestVertex2Frame" template="Rigid" invertNormals="false" vertices="@rest_shape.vertices" normals="@rest_shape.normals" />
<MeshOBJLoader name="rest_shape" filename="../../../Shell/mesh/fake_colon.obj"/>
<MeshTopology/>
<Vertex2Frame name="RestVertex2Frame" template="Rigid3" invertNormals="false" position="@rest_shape.position" normals="@rest_shape.normals" />
</Node>


<Node name="Fake_colon" activated="true">
<EulerImplicitSolver/>
<CGLinearSolver iterations="100" tolerance="1e-15" threshold="1e-15"/>
<TriangleSetTopologyContainer name="trianglesTopo" filename="applications/plugins/shells/mesh/fake_colon.obj"/>
<MechanicalObject name="colon" template="Rigid" debugViewIndices="false" debugViewIndicesScale="0.0003" position="@../Rest_colon/RestVertex2Frame.frames" />
<MeshOBJLoader name="loader" filename="../../../Shell/mesh/fake_colon.obj" />
<TriangleSetTopologyContainer name="trianglesTopo" src="@loader"/>
<MechanicalObject name="colon" template="Rigid3" showIndices="false" showIndicesScale="0.0003" position="@../Rest_colon/RestVertex2Frame.frames" topology="@trianglesTopo"/>

<UniformMass mass="0.1 0.1 [ 0.1 0 0 , 0 0.1 0 , 0 0 0.05 ]" showAxisSizeFactor="0.003" totalmass="3" />
<UniformMass showAxisSizeFactor="0.003" totalMass="3" />

<BoxROI name="box1" box="-0.065 -0.03 -0.03 -0.06 0.03 0.03" drawSize="0"/>
<FixedConstraint indices="@box1.indices" drawSize="0"/>
<FixedProjectiveConstraint indices="@box1.indices" drawSize="0"/>
<BoxROI name="box2" box="0.06 -0.03 -0.03 0.065 0.03 0.03" drawSize="0"/>
<FixedConstraint indices="@box2.indices" drawSize="0"/>
<FixedProjectiveConstraint indices="@box2.indices" drawSize="0"/>

<FixedRotationConstraint FixedZRotation="true"/>
<FixedRotationProjectiveConstraint FixedZRotation="true"/>
<TriangularBendingFEMForceField name="FEM" bending="true" youngModulus="1e5" poissonRatio="0.42" thickness="0.001" />

<Node name="SubTriangles">
<TriangleSetTopologyContainer name="subTrianglesTopo"/>
<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="1"/>
<MechanicalObject name="subPoints" />
<BendingPlateMechanicalMapping />
<Triangle contactStiffness="1e4" bothSide="1"/>
<Line contactStiffness="1e4" bothSide="1"/>
<Point contactStiffness="1e4" bothSide="1"/>
<!--<TriangleSubdivisionTopologicalMapping object1="trianglesTopo" object2="subTrianglesTopo" subdivisions="1"/>-->
<MechanicalObject name="subPoints" topology="@subTrianglesTopo"/>
<BendingPlateMechanicalMapping input="@../colon" output="@subPoints"/>
<TriangleCollisionModel contactStiffness="1e4" bothSide="1"/>
<LineCollisionModel contactStiffness="1e4" bothSide="1"/>
<PointCollisionModel contactStiffness="1e4" bothSide="1"/>
<Node name="visual">
<OglModel name="Visual" color="red"/>
<IdentityMapping object1="subPoints" object2="Visual"/>
<IdentityMapping input="@../subPoints" output="@Visual"/>
</Node>
</Node>

Expand Down
Loading
Loading