Skip to content

SphereGridTopology

Sphere 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 object 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
edges List of edge
triangles List of triangle
quads List of quad
tetrahedra List of tetrahedron
hexahedra List of hexahedron
prisms List of prism
pyramids List of pyramid
quadratic_edges List of quadratic edge
quadratic_triangles List of quadratic triangle
quadratic_quads List of quadratic quad
quadratic_tetrahedra List of quadratic tetrahedron
quadratic_hexahedra List of quadratic hexahedron
quadratic_prisms List of quadratic prism
quadratic_pyramids List of quadratic pyramid
position List of point positions
uv List of uv coordinates
computeAllBuffers Option to compute all crossed topology buffers at init. False by default 0
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
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 BaseComponent
master nullptr for regular objects, or master object for which this object is one sub-objects BaseComponent

Examples

SphereGridTopology.scn

<!-- SphereGrid examples -->
<Node name="root" dt="0.02" gravity="0 -10 0">
    <RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin pluginName="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin pluginName="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
    <RequiredPlugin pluginName="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin pluginName="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin pluginName="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [HexahedronFEMForceField TetrahedronFEMForceField] -->
    <RequiredPlugin pluginName="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
    <RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [SphereGridTopology] -->
    <RequiredPlugin pluginName="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <VisualStyle displayFlags="showBehaviorModels showForceFields showVisual" />
    <DefaultAnimationLoop/>
    <Node name="SphereFEMTetra">
        <EulerImplicitSolver  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" tolerance="0.000001" threshold="1e-5"/>
        <MechanicalObject dx="-10" />
        <UniformMass totalMass="100" />
        <SphereGridTopology nx="10" ny="10" nz="10" radius="4.0" axis="0 1 0" />
        <BoxConstraint box="-14 0.5 2.5 -8 4 4" fixAll="0"/>
        <TetrahedronFEMForceField name="FEM" youngModulus="1116" poissonRatio="0.3" method="polar" />
    <Node name="Visu">
            <OglModel name="Visual" color="red" translation="-5 0 0" />
            <IdentityMapping input="@.." output="@Visual" />
        </Node>
    </Node>
    <Node name="SphereFEM">
        <EulerImplicitSolver />
        <CGLinearSolver iterations="25" tolerance="0.000001" threshold="1e-5"/>
        <MechanicalObject />
        <UniformMass totalMass="100" />
        <SphereGridTopology nx="10" ny="10" nz="10" radius="4.0" axis="0 1 0" />
        <BoxConstraint box="-4 0.5 2.5 4 4 4" fixAll="0"/>
        <HexahedronFEMForceField name="FEM" youngModulus="1116" poissonRatio="0.3" method="large" />
    </Node>
    <Node name="SphereSpring">
        <EulerImplicitSolver />
        <CGLinearSolver iterations="25" tolerance="0.000001" threshold="1e-5"/>
        <MechanicalObject dx="10" />
        <UniformMass totalMass="100" />
        <SphereGridTopology nx="10" ny="10" nz="10" radius="4.0" axis="0 1 0" />
        <BoxConstraint box="8 0.5 2.5 14 4 4" fixAll="0"/>
        <MeshSpringForceField name="FEM" stiffness="1000" />
    </Node>

</Node>
def createScene(root_node):

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

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

   sphere_fem_tetra = root.addChild('SphereFEMTetra')

   sphere_fem_tetra.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1")
   sphere_fem_tetra.addObject('CGLinearSolver', iterations="25", tolerance="0.000001", threshold="1e-5")
   sphere_fem_tetra.addObject('MechanicalObject', dx="-10")
   sphere_fem_tetra.addObject('UniformMass', totalMass="100")
   sphere_fem_tetra.addObject('SphereGridTopology', nx="10", ny="10", nz="10", radius="4.0", axis="0 1 0")
   sphere_fem_tetra.addObject('BoxConstraint', box="-14 0.5 2.5 -8 4 4", fixAll="0")
   sphere_fem_tetra.addObject('TetrahedronFEMForceField', name="FEM", youngModulus="1116", poissonRatio="0.3", method="polar")

   visu = SphereFEMTetra.addChild('Visu')

   visu.addObject('OglModel', name="Visual", color="red", translation="-5 0 0")
   visu.addObject('IdentityMapping', input="@..", output="@Visual")

   sphere_fem = root.addChild('SphereFEM')

   sphere_fem.addObject('EulerImplicitSolver', )
   sphere_fem.addObject('CGLinearSolver', iterations="25", tolerance="0.000001", threshold="1e-5")
   sphere_fem.addObject('MechanicalObject', )
   sphere_fem.addObject('UniformMass', totalMass="100")
   sphere_fem.addObject('SphereGridTopology', nx="10", ny="10", nz="10", radius="4.0", axis="0 1 0")
   sphere_fem.addObject('BoxConstraint', box="-4 0.5 2.5 4 4 4", fixAll="0")
   sphere_fem.addObject('HexahedronFEMForceField', name="FEM", youngModulus="1116", poissonRatio="0.3", method="large")

   sphere_spring = root.addChild('SphereSpring')

   sphere_spring.addObject('EulerImplicitSolver', )
   sphere_spring.addObject('CGLinearSolver', iterations="25", tolerance="0.000001", threshold="1e-5")
   sphere_spring.addObject('MechanicalObject', dx="10")
   sphere_spring.addObject('UniformMass', totalMass="100")
   sphere_spring.addObject('SphereGridTopology', nx="10", ny="10", nz="10", radius="4.0", axis="0 1 0")
   sphere_spring.addObject('BoxConstraint', box="8 0.5 2.5 14 4 4", fixAll="0")
   sphere_spring.addObject('MeshSpringForceField', name="FEM", stiffness="1000")