<?xml version="1.0" ?>
<!-- See https://wiki.sofa-framework.org/wiki/TutorialSurfaceToLinearTopologicalMapping -->
<Node name="root" gravity="0 -9 0" dt="0.05">
    <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.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <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.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.Spring"/> <!-- Needed to use components [MeshSpringForceField TriangularBendingSprings] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [EdgeSetGeometryAlgorithms EdgeSetTopologyContainer EdgeSetTopologyModifier TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
    <RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Triangle2EdgeTopologicalMapping] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <!-- Basic Components to perform the collision detection -->
    <VisualStyle displayFlags="showBehaviorModels" />
    <CollisionPipeline name="DefaultCollisionPipeline" depth="6" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
    <CollisionResponse name="Response" />
    <DefaultAnimationLoop/>
    
    <Node name="Triangles Mesh">
        <CGImplicitSolver name="Solver" iterations="40" tolerance="1e-06" threshold="1e-10" />
        <MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true" />
        <MechanicalObject src="@loader" template="Vec3" name="mechanical" scale="10" restScale="1" />
        <TriangleSetTopologyContainer src="@loader" name="Container" />
        <TriangleSetTopologyModifier name="Modifier" />
        <TriangleSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
        <TriangularBendingSprings name="FEM-Bend" stiffness="300" damping="1.0" />
        <DiagonalMass template="Vec3,Vec3" name="mass" massDensity="0.15" />
        <FixedProjectiveConstraint template="Vec3" name="FixedDofs" indices="0 1" />
        <Node >
          <OglModel name="Visual" color="red" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
        <Node name="Edge Mesh">
            <EdgeSetTopologyContainer name="Container" />
            <EdgeSetTopologyModifier name="Modifier" />
            <EdgeSetGeometryAlgorithms template="Vec3" name="GeomAlgo" drawEdges="1" />
            <Triangle2EdgeTopologicalMapping name="Mapping" input="@../Container" output="@Container" />
            <MeshSpringForceField template="Vec3" stiffness="100" damping="1" />
            <Node name="Visu" />
        </Node>
    </Node>
</Node>
