Skip to content

CylinderGridTopology

Cylinder grid in 3D.

Target: Sofa.Component.Topology.Container.Grid

namespace: sofa::component::topology::container::grid

parents:

  • GridTopology

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the objet belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
filename Filename of the mesh
position List of point positions
edges List of edge indices
triangles List of triangle indices
quads List of quad indices
tetrahedra List of tetrahedron indices
hexahedra List of hexahedron indices
uv List of uv coordinates
n grid resolution. (default = 2 2 2) 2 2 2
computeHexaList put true if the list of Hexahedra is needed during init (default=true) 1
computeQuadList put true if the list of Quad is needed during init (default=true) 1
computeTriangleList put true if the list of Triangles is needed during init (default=true) 1
computeEdgeList put true if the list of Lines is needed during init (default=true) 1
computePointList put true if the list of Points is needed during init (default=true) 1
createTexCoords If set to true, virtual texture coordinates will be generated using 3D interpolation (default=false). 0
center Center of the cylinder 0 0 0
axis Main direction of the cylinder 0 0 1
radius Radius of the cylinder 1
length Length of the cylinder along its axis 1
Visualization
drawEdges if true, draw the topology Edges 0
drawTriangles if true, draw the topology Triangles 0
drawQuads if true, draw the topology Quads 0
drawTetrahedra if true, draw the topology Tetrahedra 0
drawHexahedra if true, draw the topology hexahedra 0
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseObject
master nullptr for regular objects, or master object for which this object is one sub-objects BaseObject

Examples

CylinderGridTopology.scn

<Node name="root" dt="0.02" gravity="0 0 100">
    <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.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <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 [HexahedronFEMForceField 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.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] -->
    <VisualStyle displayFlags="showBehaviorModels showForceFields showVisual" />
    <DefaultAnimationLoop/>

    <Node name="Reference">
        <MeshOBJLoader name="meshLoader_0" filename="mesh/truthcylinder1-bent.obj" scale="0.95" handleSeams="1" />
        <OglModel src="@meshLoader_0" dx="20" dy="17" dz="0" color="green" />
    </Node>
    <Node name="CylinderFEMTetra">
        <EulerImplicitSolver  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" tolerance="0.000001" threshold="1e-5"/>
        <MechanicalObject dx="-10" />
        <UniformMass totalMass="15" />
        <CylinderGridTopology nx="5" ny="5" nz="20" length="35.56" radius="3.75" axis="0 1 0" />
        <BoxConstraint box="-14 -0.1 -4 -6 0.1 4" fixAll="0" />
        <TetrahedronFEMForceField name="FEM" youngModulus="1116" poissonRatio="0.3" method="polar" />
    </Node>
    <Node name="CylinderFEM">
        <EulerImplicitSolver />
        <CGLinearSolver iterations="25" tolerance="0.000001" threshold="1e-5"/>
        <MechanicalObject />
        <UniformMass totalMass="15" />
        <CylinderGridTopology nx="5" ny="5" nz="20" length="35.56" radius="3.75" axis="0 1 0" />
        <BoxConstraint box="-4 -0.1 -4 4 0.1 4" fixAll="0" />
        <HexahedronFEMForceField name="FEM" youngModulus="1116" poissonRatio="0.3" method="large" />
    </Node>
    <Node name="CylinderSpring">
        <EulerImplicitSolver />
        <CGLinearSolver iterations="25" tolerance="0.000001" threshold="1e-5"/>
        <MechanicalObject dx="10" />
        <UniformMass totalMass="15" />
        <CylinderGridTopology nx="5" ny="5" nz="20" length="35.56" radius="3.75" axis="0 1 0" />
        <BoxConstraint box="6 -0.1 -4 14 0.1 4" fixAll="0" />
        <MeshSpringForceField name="FEM" stiffness="1000" />
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', dt="0.02", gravity="0 0 100")

   root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
   root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
   root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
   root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
   root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
   root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
   root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields showVisual")
   root.addObject('DefaultAnimationLoop', )

   reference = root.addChild('Reference')

   reference.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/truthcylinder1-bent.obj", scale="0.95", handleSeams="1")
   reference.addObject('OglModel', src="@meshLoader_0", dx="20", dy="17", dz="0", color="green")

   cylinder_fem_tetra = root.addChild('CylinderFEMTetra')

   cylinder_fem_tetra.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1")
   cylinder_fem_tetra.addObject('CGLinearSolver', iterations="25", tolerance="0.000001", threshold="1e-5")
   cylinder_fem_tetra.addObject('MechanicalObject', dx="-10")
   cylinder_fem_tetra.addObject('UniformMass', totalMass="15")
   cylinder_fem_tetra.addObject('CylinderGridTopology', nx="5", ny="5", nz="20", length="35.56", radius="3.75", axis="0 1 0")
   cylinder_fem_tetra.addObject('BoxConstraint', box="-14 -0.1 -4 -6 0.1 4", fixAll="0")
   cylinder_fem_tetra.addObject('TetrahedronFEMForceField', name="FEM", youngModulus="1116", poissonRatio="0.3", method="polar")

   cylinder_fem = root.addChild('CylinderFEM')

   cylinder_fem.addObject('EulerImplicitSolver', )
   cylinder_fem.addObject('CGLinearSolver', iterations="25", tolerance="0.000001", threshold="1e-5")
   cylinder_fem.addObject('MechanicalObject', )
   cylinder_fem.addObject('UniformMass', totalMass="15")
   cylinder_fem.addObject('CylinderGridTopology', nx="5", ny="5", nz="20", length="35.56", radius="3.75", axis="0 1 0")
   cylinder_fem.addObject('BoxConstraint', box="-4 -0.1 -4 4 0.1 4", fixAll="0")
   cylinder_fem.addObject('HexahedronFEMForceField', name="FEM", youngModulus="1116", poissonRatio="0.3", method="large")

   cylinder_spring = root.addChild('CylinderSpring')

   cylinder_spring.addObject('EulerImplicitSolver', )
   cylinder_spring.addObject('CGLinearSolver', iterations="25", tolerance="0.000001", threshold="1e-5")
   cylinder_spring.addObject('MechanicalObject', dx="10")
   cylinder_spring.addObject('UniformMass', totalMass="15")
   cylinder_spring.addObject('CylinderGridTopology', nx="5", ny="5", nz="20", length="35.56", radius="3.75", axis="0 1 0")
   cylinder_spring.addObject('BoxConstraint', box="6 -0.1 -4 14 0.1 4", fixAll="0")
   cylinder_spring.addObject('MeshSpringForceField', name="FEM", stiffness="1000")