Skip to content

TopologicalChangeProcessor

Read topological changes and process them.

Target: Sofa.Component.Topology.Utility

namespace: sofa::component::topology::utility

parents:

  • BaseObject

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 input file name for topological changes.
listChanges 0 for adding, 1 for removing, 2 for cutting and associated indices.
interval time duration between 2 actions 0
shift shift between times in the file and times when they will be read 0
loop set to 'true' to re-read the file when reaching the end 0
useDataInputs If true, will perform operation using Data input lists rather than text file. 0
timeToRemove If using option useDataInputs, time at which will be done the operations. Possibility to use the interval Data also. 0
pointsToRemove List of point IDs to be removed.
edgesToRemove List of edge IDs to be removed.
trianglesToRemove List of triangle IDs to be removed.
quadsToRemove List of quad IDs to be removed.
tetrahedraToRemove List of tetrahedron IDs to be removed.
hexahedraToRemove List of hexahedron IDs to be removed.
saveIndicesAtInit set to 'true' to save the incision to do in the init to incise even after a movement 0
epsilonSnapPath epsilon snap path 0.1
epsilonSnapBorder epsilon snap path 0.25
Visualization
draw draw information 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
topology link to the topology container BaseMeshTopology

Examples

TopologicalChangeProcessor_useDataInputs_option.scn

<Node name="root" gravity="0 -9 0" dt="0.01">
    <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 [TriangleCollisionModel] -->
    <RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <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 [DiagonalMass] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangularFEMForceField] -->
    <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.Dynamic"/> <!-- Needed to use components [TriangleSetGeometryAlgorithms TriangleSetTopologyContainer TriangleSetTopologyModifier] -->
    <RequiredPlugin name="Sofa.Component.Topology.Utility"/> <!-- Needed to use components [TopologicalChangeProcessor] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <DefaultAnimationLoop/>

    <VisualStyle displayFlags="showBehaviorModels showVisual" />
    <CollisionPipeline name="default0" verbose="0" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <CollisionResponse name="default1" response="PenalityContactForceField" />
    <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" />
    <Node name="SquareGravity" gravity="0 -9.81 0">
        <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/square3.msh" createSubelements="true"/>
        <MechanicalObject name="mecaObj" src="@loader" template="Vec3" scale3d="10 10 10" restScale="1" />
        <TriangleSetTopologyContainer src="@loader" name="Container" />
        <TriangleSetTopologyModifier name="Modifier" />
        <TriangleSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
        <DiagonalMass name="default5" massDensity="0.15" />
        <TriangularFEMForceField template="Vec3" name="FEM" method="large" poissonRatio="0.3" youngModulus="60" />
        <TriangularBendingSprings template="Vec3" name="FEM-Bend" stiffness="300" damping="1" />
        <TriangleCollisionModel name="default7" />

        <Node >
            <OglModel name="Visual" material="Default Diffuse 1 0 0 1 0.6 Ambient 1 0.2 0 0 1 Specular 0 1 0 0 1 Emissive 0 1 0 0 1 Shininess 0 45" />
            <IdentityMapping name="default8" input="@.." output="@Visual" />
        </Node>

        <BoxROI template="Vec3" box="2 0 -1 8 -3 1" drawBoxes="1" position="@mecaObj.position" drawTriangles="1" triangles="@Container.triangles" name="trash" />
        <TopologicalChangeProcessor listening="1" useDataInputs="1" trianglesToRemove="@trash.triangleIndices" timeToRemove="0.1" interval="0.05" />
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', gravity="0 -9 0", dt="0.01")

   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.Geometry")
   root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
   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.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.Dynamic")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Utility")
   root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('VisualStyle', displayFlags="showBehaviorModels showVisual")
   root.addObject('CollisionPipeline', name="default0", verbose="0")
   root.addObject('BruteForceBroadPhase', )
   root.addObject('BVHNarrowPhase', )
   root.addObject('CollisionResponse', name="default1", response="PenalityContactForceField")
   root.addObject('MinProximityIntersection', name="Proximity", alarmDistance="0.8", contactDistance="0.5")

   square_gravity = root.addChild('SquareGravity', gravity="0 -9.81 0")

   square_gravity.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
   square_gravity.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
   square_gravity.addObject('MeshGmshLoader', name="loader", filename="mesh/square3.msh", createSubelements="true")
   square_gravity.addObject('MechanicalObject', name="mecaObj", src="@loader", template="Vec3", scale3d="10 10 10", restScale="1")
   square_gravity.addObject('TriangleSetTopologyContainer', src="@loader", name="Container")
   square_gravity.addObject('TriangleSetTopologyModifier', name="Modifier")
   square_gravity.addObject('TriangleSetGeometryAlgorithms', template="Vec3", name="GeomAlgo")
   square_gravity.addObject('DiagonalMass', name="default5", massDensity="0.15")
   square_gravity.addObject('TriangularFEMForceField', template="Vec3", name="FEM", method="large", poissonRatio="0.3", youngModulus="60")
   square_gravity.addObject('TriangularBendingSprings', template="Vec3", name="FEM-Bend", stiffness="300", damping="1")
   square_gravity.addObject('TriangleCollisionModel', name="default7")

   node = SquareGravity.addChild('node')

   node.addObject('OglModel', name="Visual", material="Default Diffuse 1 0 0 1 0.6 Ambient 1 0.2 0 0 1 Specular 0 1 0 0 1 Emissive 0 1 0 0 1 Shininess 0 45")
   node.addObject('IdentityMapping', name="default8", input="@..", output="@Visual")

   square_gravity.addObject('BoxROI', template="Vec3", box="2 0 -1 8 -3 1", drawBoxes="1", position="@mecaObj.position", drawTriangles="1", triangles="@Container.triangles", name="trash")
   square_gravity.addObject('TopologicalChangeProcessor', listening="1", useDataInputs="1", trianglesToRemove="@trash.triangleIndices", timeToRemove="0.1", interval="0.05")