Skip to content

Hexa2PrismTopologicalMapping

Topological mapping where HexahedronSetTopology is converted to PrismSetTopology

Target: Sofa.Component.Topology.Mapping

namespace: sofa::component::topology::mapping

parents:

  • TopologicalMapping

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
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
input Input topology to map BaseMeshTopology
output Output topology to map BaseMeshTopology

Examples

Hexa2PrismTopologicalMapping.scn

<?xml version="1.0"?>
<Node name="root" dt="0.01" gravity="0 -9 0">
    <Node name="plugins">
        <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
        <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
        <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
        <RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2PrismTopologicalMapping] -->
        <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualMesh] -->
    </Node>

    <DefaultAnimationLoop/>

    <Node name="grid">
        <RegularGridTopology name="grid" min="-5 -5 0" max="5 5 40" n="5 5 20"/>
        <MechanicalObject template="Vec3" name="state" position="@grid.position"/>

        <Node name="prisms">
            <MeshTopology name="prism_topology"/>
            <Hexa2PrismTopologicalMapping input="@grid" output="@prism_topology" />
            <VisualMesh position="@../state.position" topology="@prism_topology" enable="true"/>
        </Node>

    </Node>
</Node>
def createScene(root_node):

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

   plugins = root.addChild('plugins')

   plugins.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Visual")

   root.addObject('DefaultAnimationLoop', )

   grid = root.addChild('grid')

   grid.addObject('RegularGridTopology', name="grid", min="-5 -5 0", max="5 5 40", n="5 5 20")
   grid.addObject('MechanicalObject', template="Vec3", name="state", position="@grid.position")

   prisms = grid.addChild('prisms')

   prisms.addObject('MeshTopology', name="prism_topology")
   prisms.addObject('Hexa2PrismTopologicalMapping', input="@grid", output="@prism_topology")
   prisms.addObject('VisualMesh', position="@../state.position", topology="@prism_topology", enable="true")