Skip to content

MeshTopology

Generic constant topology loaded from a mesh file.

Target: Sofa.Component.Topology.Container.Constant

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

parents:

  • MeshTopologyContainer

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
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

MeshTopology.scn

<Node name="root" dt="0.02">
    <RequiredPlugin pluginName="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
    <RequiredPlugin pluginName="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [DiscreteIntersection] -->
    <RequiredPlugin pluginName="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
    <RequiredPlugin pluginName="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader MeshOBJLoader] -->
    <RequiredPlugin pluginName="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin pluginName="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
    <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 [TetrahedronFEMForceField] -->
    <RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
    <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/>
    <CollisionPipeline verbose="0" name="CollisionPipeline" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <CollisionResponse response="PenalityContactForceField" name="collision response" />
    <DiscreteIntersection/>
    <Node name="TorusFEM">
        <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" />
        <MeshGmshLoader name="loader" filename="mesh/torus2_low_res.msh" />
        <MeshTopology src="@loader" />
        <!-- or MeshTopology -->
        <MechanicalObject src="@loader" />
        <FixedProjectiveConstraint name="FixedProjectiveConstraint" indices="0" />
        <UniformMass totalMass="5" />
        <TetrahedronFEMForceField name="FEM" youngModulus="1000" poissonRatio="0.4" computeGlobalMatrix="false" method="large" />
        <Node name="Visu">
            <MeshOBJLoader name="meshLoader_0" filename="mesh/torus2.obj" handleSeams="1" />
            <OglModel name="Visual" src="@meshLoader_0" color="red" />
            <BarycentricMapping input="@.." output="@Visual" />
        </Node>
        <Node name="Surf2">
            <MeshOBJLoader name="loader" filename="mesh/torus2_for_collision.obj" />
            <MeshTopology src="@loader" />
            <!-- or MeshTopology -->
            <MechanicalObject src="@loader" />
            <TriangleCollisionModel />
            <BarycentricMapping />
        </Node>
    </Node>
</Node>
def createScene(root_node):

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

   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Detection.Algorithm")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Detection.Intersection")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Geometry")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Response.Contact")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.IO.Mesh")
   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.StateContainer")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Constant")
   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', )
   root.addObject('CollisionPipeline', verbose="0", name="CollisionPipeline")
   root.addObject('BruteForceBroadPhase', )
   root.addObject('BVHNarrowPhase', )
   root.addObject('CollisionResponse', response="PenalityContactForceField", name="collision response")
   root.addObject('DiscreteIntersection', )

   torus_fem = root.addChild('TorusFEM')

   torus_fem.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   torus_fem.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   torus_fem.addObject('MeshGmshLoader', name="loader", filename="mesh/torus2_low_res.msh")
   torus_fem.addObject('MeshTopology', src="@loader")
   torus_fem.addObject('MechanicalObject', src="@loader")
   torus_fem.addObject('FixedProjectiveConstraint', name="FixedProjectiveConstraint", indices="0")
   torus_fem.addObject('UniformMass', totalMass="5")
   torus_fem.addObject('TetrahedronFEMForceField', name="FEM", youngModulus="1000", poissonRatio="0.4", computeGlobalMatrix="false", method="large")

   visu = TorusFEM.addChild('Visu')

   visu.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/torus2.obj", handleSeams="1")
   visu.addObject('OglModel', name="Visual", src="@meshLoader_0", color="red")
   visu.addObject('BarycentricMapping', input="@..", output="@Visual")

   surf2 = TorusFEM.addChild('Surf2')

   surf2.addObject('MeshOBJLoader', name="loader", filename="mesh/torus2_for_collision.obj")
   surf2.addObject('MeshTopology', src="@loader")
   surf2.addObject('MechanicalObject', src="@loader")
   surf2.addObject('TriangleCollisionModel', )
   surf2.addObject('BarycentricMapping', )