Skip to content

Commit

Permalink
Simplify the example and added the complete scene in the demo folder
Browse files Browse the repository at this point in the history
  • Loading branch information
bakpaul committed Nov 14, 2024
1 parent 3dba2b3 commit 7a4e71b
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,52 +33,6 @@

<!-- # Header of the simulation -->
<FreeMotionAnimationLoop name="FreeMotionAnimationLoop" parallelODESolving="true" parallelCollisionDetectionAndFreeMotion="true"/>
<GenericConstraintSolver maxIterations="50" multithreading='true' tolerance="1.0e-3"/>

<!-- # Definition of the collision pipeline -->
<CollisionPipeline name="CollisionPipeline" />
<ParallelBruteForceBroadPhase name="CollisionBroadPhase"/>
<ParallelBVHNarrowPhase name="CollisionNarrowPhase"/>
<CollisionResponse name="CollisionResponse" response="FrictionContactConstraint" responseParams="mu=0.2"/>
<NewProximityIntersection name="Intersection" alarmDistance="10" contactDistance="5" />

<!-- # Object = SOFA Logo -->
<Node name="SOFALogo">
<EulerImplicitSolver name="EulerImplicitScheme" />
<ConstantSparsityPatternSystem template="CompressedRowSparseMatrixd" name="A" printLog="false"/>
<EigenSimplicialLDLT name="LDLTLinearSolver" template="CompressedRowSparseMatrixd" parallelInverseProduct="true" linearSystem="@A"/>

<MeshVTKLoader name="LogoLoader" filename="mesh/SOFA_volume.vtk" translation="-120 20 0" rotation="180 0 90"/>
<TetrahedronSetTopologyContainer name="Container" src="@LogoLoader" />
<TetrahedronSetTopologyModifier name="Modifier"/>
<MechanicalObject name="LogoDOF" template="Vec3d" />
<TetrahedronFEMForceField name="LinearElasticityFEM" youngModulus="5" poissonRatio="0.3" method="large" />
<MeshMatrixMass name="Mass" totalMass="0.1" />

<Node name="Collision">
<MeshOBJLoader name="SurfaceLoader" filename="mesh/SOFA_collision_no_face.obj" translation="-120 20 0" rotation="180 0 90"/>
<MeshTopology name="CollisionTopo" src="@SurfaceLoader"/>
<MechanicalObject name="CollisionDOF" src="@CollisionTopo" />
<LineCollisionModel selfCollision="1" topology="@CollisionTopo" group="2 3 5"/>
<BarycentricMapping name="MappingCollision" input="@../LogoDOF" output="@CollisionDOF"/>
</Node>

<Node name="BorderCollision">
<MeshOBJLoader name="SurfaceLoader" filename="mesh/SOFA_collision_center.obj" translation="-120 20 0" rotation="180 0 90"/>
<MeshTopology name="CollisionTopo" src="@SurfaceLoader"/>
<MechanicalObject name="CollisionDOF" src="@CollisionTopo"/>
<LineCollisionModel selfCollision="1" topology="@CollisionTopo" group="3 4"/>
<BarycentricMapping name="MappingCollision" input="@../LogoDOF" output="@CollisionDOF"/>
</Node>

<Node name="Visu">
<MeshOBJLoader name="SurfaceLoader" filename="mesh/SOFA_surface.obj" translation="-120 20 0" rotation="180 0 90"/>
<OglModel name="VisualModel" color="0.7 .35 0 1" position="@SurfaceLoader.position" triangles="@SurfaceLoader.triangles" />
<BarycentricMapping name="MappingVisu" isMechanical="false" input="@../LogoDOF" output="@VisualModel" />
</Node>
<LinearSolverConstraintCorrection name="ConstraintCorrection" linearSolver="@LDLTLinearSolver"/>

</Node>

<Node name="Box">
<EulerImplicitSolver name="EulerImplicitScheme" />
Expand Down
115 changes: 115 additions & 0 deletions examples/Demos/SofaWasher.scn
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0"?>
<Node name="root" gravity="0 -100 0" dt="0.01" >
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [AffineMovementProjectiveConstraint] -->
<RequiredPlugin name="MultiThreading"/> <!-- Needed to use components [ParallelBVHNarrowPhase,ParallelBruteForceBroadPhase] -->
<RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [CollisionPipeline] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [NewProximityIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel,TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [GenericConstraintSolver] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader,MeshVTKLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [EigenSimplicialLDLT,EigenSparseLU] -->
<RequiredPlugin name="Sofa.Component.LinearSystem"/> <!-- Needed to use components [ConstantSparsityPatternSystem] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
<RequiredPlugin name="Sofa.Component.Mapping.NonLinear"/> <!-- Needed to use components [RigidMapping] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [MeshMatrixMass,UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
<RequiredPlugin name="Sofa.Component.Setting"/> <!-- Needed to use components [BackgroundSetting] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
<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.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetTopologyContainer,TetrahedronSetTopologyModifier,TriangleSetTopologyContainer] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->


<!-- # Rendering settings -->
<VisualStyle name="RenderingOptions" displayFlags="showVisualModels" />
<BackgroundSetting color="0.8 0.8 0.8 1" />


<!-- # Header of the simulation -->
<FreeMotionAnimationLoop name="FreeMotionAnimationLoop" parallelODESolving="true" parallelCollisionDetectionAndFreeMotion="true"/>
<GenericConstraintSolver maxIterations="50" multithreading='true' tolerance="1.0e-3"/>

<!-- # Definition of the collision pipeline -->
<CollisionPipeline name="CollisionPipeline" />
<ParallelBruteForceBroadPhase name="CollisionBroadPhase"/>
<ParallelBVHNarrowPhase name="CollisionNarrowPhase"/>
<CollisionResponse name="CollisionResponse" response="FrictionContactConstraint" responseParams="mu=0.2"/>
<NewProximityIntersection name="Intersection" alarmDistance="10" contactDistance="5" />

<!-- # Object = SOFA Logo -->
<Node name="SOFALogo">
<EulerImplicitSolver name="EulerImplicitScheme" />
<ConstantSparsityPatternSystem template="CompressedRowSparseMatrixd" name="A" printLog="false"/>
<EigenSimplicialLDLT name="LDLTLinearSolver" template="CompressedRowSparseMatrixd" parallelInverseProduct="true" linearSystem="@A"/>

<MeshVTKLoader name="LogoLoader" filename="mesh/SOFA_volume.vtk" translation="-120 20 0" rotation="180 0 90"/>
<TetrahedronSetTopologyContainer name="Container" src="@LogoLoader" />
<TetrahedronSetTopologyModifier name="Modifier"/>
<MechanicalObject name="LogoDOF" template="Vec3d" />
<TetrahedronFEMForceField name="LinearElasticityFEM" youngModulus="5" poissonRatio="0.3" method="large" />
<MeshMatrixMass name="Mass" totalMass="0.1" />

<Node name="Collision">
<MeshOBJLoader name="SurfaceLoader" filename="mesh/SOFA_collision_no_face.obj" translation="-120 20 0" rotation="180 0 90"/>
<MeshTopology name="CollisionTopo" src="@SurfaceLoader"/>
<MechanicalObject name="CollisionDOF" src="@CollisionTopo" />
<LineCollisionModel selfCollision="1" topology="@CollisionTopo" group="2 3 5"/>
<BarycentricMapping name="MappingCollision" input="@../LogoDOF" output="@CollisionDOF"/>
</Node>

<Node name="BorderCollision">
<MeshOBJLoader name="SurfaceLoader" filename="mesh/SOFA_collision_center.obj" translation="-120 20 0" rotation="180 0 90"/>
<MeshTopology name="CollisionTopo" src="@SurfaceLoader"/>
<MechanicalObject name="CollisionDOF" src="@CollisionTopo"/>
<LineCollisionModel selfCollision="1" topology="@CollisionTopo" group="3 4"/>
<BarycentricMapping name="MappingCollision" input="@../LogoDOF" output="@CollisionDOF"/>
</Node>

<Node name="Visu">
<MeshOBJLoader name="SurfaceLoader" filename="mesh/SOFA_surface.obj" translation="-120 20 0" rotation="180 0 90"/>
<OglModel name="VisualModel" color="0.7 .35 0 1" position="@SurfaceLoader.position" triangles="@SurfaceLoader.triangles" />
<BarycentricMapping name="MappingVisu" isMechanical="false" input="@../LogoDOF" output="@VisualModel" />
</Node>
<LinearSolverConstraintCorrection name="ConstraintCorrection" linearSolver="@LDLTLinearSolver"/>

</Node>

<Node name="Box">
<EulerImplicitSolver name="EulerImplicitScheme" />
<EigenSparseLU name="LUSolver" template="CompressedRowSparseMatrixd" />
<MechanicalObject name="mstate" template="Rigid3" position="0 0 0 0 0 0 1" />
<LinearVelocityProjectiveConstraint indices="0" keyTimes="0 2" velocities="0 0 0 0 0 0 0 0 0 0 0 0.3 " continueAfterEnd="true" />
<UniformMass name="Mass" totalMass="0.1" />

<Node name="Collision">
<TriangleSetTopologyContainer name="FloorTopology" position="-200 -200 15 200 -200 15 200 200 15 -200 200 15 -200 -200 -15 200 -200 -15 200 200 -15 -200 200 -15" triangles="0 2 1 0 3 2 4 6 5 4 7 6 0 1 4 5 4 1 3 6 2 3 7 6 1 2 6 1 6 5 0 4 3 3 4 7"/>
<MechanicalObject name="CollisionDOF" template="Vec3"/>
<TriangleCollisionModel selfCollision="0" topology="@FloorTopology" simulated="0" group="1 2" proximity="3" />
<RigidMapping name="MappingCollision" input="@../mstate" output="@CollisionDOF" globalToLocalCoords="true"/>

</Node>

<Node name="Visu">
<OglModel name="VisualModel" color="0.5 0.5 0.5 0.2" src="@../Collision/FloorTopology" />
<RigidMapping name="MappingCollision" input="@../mstate" output="@VisualModel" globalToLocalCoords="true"/>
</Node>
</Node>






</Node>






0 comments on commit 7a4e71b

Please sign in to comment.