Skip to content

CubeTopology

Surface topology of a cube in 3D (points, edges and quads).

Target: Sofa.Component.Topology.Container.Constant

namespace: sofa::component::topology::container::constant

parents:

  • MeshTopology

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
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
nx x grid resolution 0
ny y grid resolution 0
nz z grid resolution 0
internalPoints include internal points (allow a one-to-one mapping between points from RegularGridTopology and CubeTopology) 0
splitNormals split corner points to have planar normals 0
min Min 0 0 0
max Max 1 1 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

CubeTopology.scn

<Node name="root" dt="0.02">
    <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 [DiscreteIntersection] -->
    <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.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 [TriangleFEMForceField] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [TriangularBendingSprings] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [CubeTopology] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [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] -->
    <CollisionPipeline verbose="0" name="CollisionPipeline" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <CollisionResponse response="PenalityContactForceField" name="collision response" />
    <DiscreteIntersection/>
    <DefaultAnimationLoop/>

    <Node name="Cubes" >
    <VisualStyle displayFlags="showForceFields" />
        <EulerImplicitSolver name="cg_odesolver" printLog="false"  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
        <CubeTopology internalPoints="0" splitNormals="1" name="cubeTopo" nx="3" ny="3" nz="5" min="-0.015 -0.015 -0.075" max="0.015 0.015 0.075" />
        <Node name="topoTriangle" >
            <include href="Objects/TriangleSetTopology.xml" src="@../cubeTopo"/>
            <Quad2TriangleTopologicalMapping input="@../cubeTopo" output="@Container"/>
            <MechanicalObject name="dofs" printLog="1" position="@../cubeTopo.position"/>
            <FixedProjectiveConstraint name="FixedProjectiveConstraint" indices="3 39 64" />
            <TriangleFEMForceField name="FEM1" youngModulus="500" poissonRatio="0.3" method="large" />
            <TriangularBendingSprings name="FEM-Bend" stiffness="3000" damping="1.0"/>
            <UniformMass vertexMass="0.1" />

            <Node name="Visu">
                <OglModel name="Visual" color="red" />
                <IdentityMapping input="@../dofs" output="@Visual" />
            </Node>
        </Node>
    </Node>
</Node>
def createScene(root_node):

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

   root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
   root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
   root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
   root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   root.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
   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.Constant")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
   root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('CollisionPipeline', verbose="0", name="CollisionPipeline")
   root.addObject('BruteForceBroadPhase', )
   root.addObject('BVHNarrowPhase', )
   root.addObject('CollisionResponse', response="PenalityContactForceField", name="collision response")
   root.addObject('DiscreteIntersection', )
   root.addObject('DefaultAnimationLoop', )

   cubes = root.addChild('Cubes')

   cubes.addObject('VisualStyle', displayFlags="showForceFields")
   cubes.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   cubes.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   cubes.addObject('CubeTopology', internalPoints="0", splitNormals="1", name="cubeTopo", nx="3", ny="3", nz="5", min="-0.015 -0.015 -0.075", max="0.015 0.015 0.075")

   topo_triangle = Cubes.addChild('topoTriangle')

   topo_triangle.addObject('include', href="Objects/TriangleSetTopology.xml", src="@../cubeTopo")
   topo_triangle.addObject('Quad2TriangleTopologicalMapping', input="@../cubeTopo", output="@Container")
   topo_triangle.addObject('MechanicalObject', name="dofs", printLog="1", position="@../cubeTopo.position")
   topo_triangle.addObject('FixedProjectiveConstraint', name="FixedProjectiveConstraint", indices="3 39 64")
   topo_triangle.addObject('TriangleFEMForceField', name="FEM1", youngModulus="500", poissonRatio="0.3", method="large")
   topo_triangle.addObject('TriangularBendingSprings', name="FEM-Bend", stiffness="3000", damping="1.0")
   topo_triangle.addObject('UniformMass', vertexMass="0.1")

   visu = topoTriangle.addChild('Visu')

   visu.addObject('OglModel', name="Visual", color="red")
   visu.addObject('IdentityMapping', input="@../dofs", output="@Visual")