<?xml version="1.0" ?>
<!-- See https://wiki.sofa-framework.org/wiki/TutorialTopologyVolumeMesh -->
<Node name="root" gravity="0 -9.86 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.Geometry"/> <!-- Needed to use components [TetrahedronCollisionModel] -->
    <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 [TetrahedronFEMForceField] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
    <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 [TetrahedronSetGeometryAlgorithms TetrahedronSetTopologyContainer TetrahedronSetTopologyModifier] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [CylinderGridTopology] -->
    <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 showVisual showWireframe" />
    <CollisionPipeline name="DefaultCollisionPipeline" verbose="0" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
    <CollisionResponse name="Response" />
    <DefaultAnimationLoop/>
    
    <Node name="Cylinder Static Mesh">
        <MeshGmshLoader name="loader" filename="mesh/cylinder.msh" />
        <MechanicalObject src="@loader" name="DOFs" template="Vec3" translation="0 0 0" rotation="0 90 0" scale="10" />
        <FixedProjectiveConstraint name="FixedProjectiveConstraint" template="Vec3" indices="0" />
        <UniformMass name="Mass" template="Vec3" totalMass="50" />
        <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" />
        <MeshGmshLoader name="meshLoader0" filename="mesh/cylinder.msh" />
        <MeshTopology name="Static Mesh" src="@meshLoader0" />
        <MeshSpringForceField name="FEM-Bend" template="Vec3" stiffness="100" damping="1" />
        <TetrahedronFEMForceField name="FEM" template="Vec3" method="polar" poissonRatio="0.3" youngModulus="1116" assembling="0" />
        <TetrahedronCollisionModel name="Models" />
        <Node >
          <OglModel name="Visual" color="red" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
    <Node name="Cylinder Regular Mesh">
        <MechanicalObject name="DOFs" template="Vec3" translation="0 0 -10" rotation="0 0 -90" />
        <FixedProjectiveConstraint name="FixedProjectiveConstraint" template="Vec3" indices="54 44 45 55" drawSize="0" />
        <UniformMass name="Mass" template="Vec3" totalMass="500" />
        <EulerImplicitSolver name="cg_odesolver" printLog="0" />
        <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" />
        <CylinderGridTopology name="Regular Mesh" n="10 10 10" axis="0 1 0" radius="2" length="10" />
        <MeshSpringForceField name="FEM-Bend" template="Vec3" stiffness="100" damping="1" />
        <TetrahedronFEMForceField name="FEM" template="Vec3" method="polar" poissonRatio="0.3" youngModulus="1116" assembling="0" />
        <Node >
          <OglModel name="Visual" color="blue" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
    <Node name="Cylinder Dynamic Mesh">
        <MeshGmshLoader name="loader" filename="mesh/cylinder.msh" />
        <MechanicalObject src="@loader" name="DOFs" template="Vec3" translation="0 0 10" rotation="0 90 0" scale="10" />
        <FixedProjectiveConstraint name="FixedProjectiveConstraint" template="Vec3" indices="0" />
        <UniformMass name="Mass" template="Vec3" totalMass="50" />
        <EulerImplicitSolver name="cg_odesolver" printLog="0" />
        <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" />
        <MeshGmshLoader name="meshLoader1" filename="mesh/cylinder.msh" />
        <TetrahedronSetTopologyContainer name="Topology Container" src="@meshLoader1" />
        <TetrahedronSetTopologyModifier name="Topology Modifier" />
        <TetrahedronSetGeometryAlgorithms name="Geometry Algorithms" template="Vec3" />
        <MeshSpringForceField name="FEM-Bend" template="Vec3" stiffness="100" damping="1" />
        <TetrahedronFEMForceField name="FEM" template="Vec3" method="polar" poissonRatio="0.3" youngModulus="1116" assembling="0" />
        <TetrahedronCollisionModel name="Models" />
        <Node >
          <OglModel name="Visual" color="green" />
          <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
</Node>
