<?xml version="1.0" ?>
<!-- See https://wiki.sofa-framework.org/wiki/TutorialTopologySurfaceMesh -->
<Node name="root" gravity="0 -9.81 1" 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.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
    <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 [UniformMass] -->
    <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 [QuadularBendingSprings TriangularBendingSprings] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [QuadSetGeometryAlgorithms QuadSetTopologyContainer QuadSetTopologyModifier TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
    <RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Quad2TriangleTopologicalMapping] -->
    <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="showBehavior showWireframe" />
    <CollisionPipeline name="DefaultCollisionPipeline" depth="6" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
    <CollisionResponse name="Response" />
    <DefaultAnimationLoop/>

    <Node name="Triangles Mesh">
        <MeshGmshLoader filename="mesh/square3.msh" name="tloader" createSubelements="true" />
        <MechanicalObject name="DOFs" template="Vec3" translation="0 10 10" rotation="0 -90 180" scale="10" src="@tloader" />
        <FixedProjectiveConstraint name="Fixed dof" template="Vec3" indices="0 1" />
        <UniformMass name="Mass" template="Vec3" totalMass="1" />
        <EulerImplicitSolver name="cg_odesolver" printLog="0"  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" />
        <TriangleSetTopologyContainer name="Topology Container" src="@tloader" />
        <TriangleSetTopologyModifier name="Topology Modifier" />
        <TriangleSetGeometryAlgorithms template="Vec3" name="Geometry Algorithms" />
        <TriangularBendingSprings name="FEM-Bend" template="Vec3" stiffness="300" damping="1" />
        <TriangularFEMForceField name="FEM" template="Vec3" method="large" poissonRatio="0.3" youngModulus="600" />
        <TriangleCollisionModel name="models" />
        <Node>
            <OglModel name="Visual" color="green" src="@../tloader" />
            <IdentityMapping name="Mapping" input="@.." output="@Visual" />
        </Node>
    </Node>
    <Node name="Quads Mesh">
        <MeshGmshLoader filename="mesh/nine_quads.msh" name="qloader" createSubelements="true"/>
        <MechanicalObject name="DOFs" template="Vec3" rotation="0 90 0" scale="4" src="@qloader" />
        <FixedProjectiveConstraint name="Fixed dof" template="Vec3" indices="12 15" />
        <UniformMass name="Mass" template="Vec3" totalMass="1" />
        <EulerImplicitSolver name="cg_odesolver" printLog="0" />
        <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" />
        <QuadSetTopologyContainer name="Container" src="@qloader" />
        <QuadSetTopologyModifier name="Modifier" />
        <QuadSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
        <QuadularBendingSprings template="Vec3" name="FEM-Bend" stiffness="3000" damping="1" />
        <Node name="Visu">
            <OglModel name="Visual" src="@../qloader" />
            <IdentityMapping template="Vec3,Vec3" name="default5" input="@../DOFs" output="@Visual" />
        </Node>
        <Node name="Triangles">
            <TriangleSetTopologyContainer name="Container" />
            <TriangleSetTopologyModifier name="Modifier" />
            <TriangleSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
            <Quad2TriangleTopologicalMapping name="default6" input="@../Container" output="@Container" />
            <TriangularFEMForceField template="Vec3" name="FEM" method="large" poissonRatio="0.3" youngModulus="1000" />
            <TriangularBendingSprings template="Vec3" name="FEM-Bend" stiffness="3000" damping="1" />
            <TriangleCollisionModel name="default7" />
        </Node>
    </Node>
</Node>
