Skip to content

GenerateCylinder

Generate a Cylindrical Tetrahedral Mesh

Templates:

  • Vec3d

Target: Sofa.Component.Engine.Generate

namespace: sofa::component::engine::generate

parents:

  • DataEngine

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
BezierTriangleDegree order of Bezier triangles
BezierTetrahedronDegree order of Bezier tetrahedra
openSurface if the cylinder is open at its 2 ends 1
Inputs
radius input cylinder radius 0.2
height input cylinder height 1
origin cylinder origin point 0 0 0
resCircumferential Resolution in the circumferential direction 6
resRadial Resolution in the radial direction 3
resHeight Resolution in the height direction 5
Outputs
output_TetrahedraPosition output array of 3d points of tetrahedra mesh
output_TrianglesPosition output array of 3d points of triangle mesh
tetrahedra output mesh tetrahedra
triangles output triangular mesh
BezierTriangleWeights weights of rational Bezier triangles
isBezierTriangleRational booleans indicating if each Bezier triangle is rational or integral
BezierTetrahedronWeights weights of rational Bezier tetrahedra
isBezierTetrahedronRational booleans indicating if each Bezier tetrahedron is rational or integral

Links:

Name Description
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used)
slaves Sub-objects used internally by this object
master nullptr for regular objects, or master object for which this object is one sub-objects

Examples

Component/Engine/Generate/GenerateCylinder.scn

<?xml version="1.0" ?>
<Node name="root" dt="1" showBoundingTree="0" gravity="0 0 0">
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedPlaneProjectiveConstraint FixedProjectiveConstraint LineProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.Engine.Generate"/> <!-- Needed to use components [GenerateCylinder] -->
    <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [MeshMatrixMass] -->
    <RequiredPlugin name="Sofa.Component.MechanicalLoad"/> <!-- Needed to use components [TrianglePressureForceField] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [FastTetrahedralCorotationalForceField] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms TetrahedronSetTopologyContainer] -->

    <DefaultAnimationLoop/>
    <GenerateCylinder template="Vec3" name="Cylinder" radius="0.2" height="1" resHeight="7" resCircumferential="7" resRadial="3" />
    <Node name="Tetra" >
        <CGLinearSolver iterations="3000" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> 
        <EulerImplicitSolver name="default12" rayleighStiffness="0.01"  rayleighMass="0.1" />
        <TetrahedronSetTopologyContainer name="Container" tetrahedra="@../Cylinder.tetrahedra" position="@../Cylinder.output_position" createTriangleArray="1" />
        <TetrahedronSetGeometryAlgorithms  drawEdges="1"/>
        <MechanicalObject name="dofs" showObject="1"/>
        <MeshMatrixMass name="mass" lumping="1" printMass="0" massDensity="1" />
        <BoxROI box="-0.01 -0.01 -0.01 0.01 0.01 0.01" drawBoxes="1" name="fixedPoint"  />
        <FixedProjectiveConstraint indices="@fixedPoint.indices" />
        <FixedPlaneProjectiveConstraint direction="0 0 1" dmin="-0.01" dmax="0.01"  />
        <BoxROI box="-0.2 -0.2 0.99 0.2 0.2 1.01" drawBoxes="1" name="pressurePlane"  />
        <LineProjectiveConstraint direction="1 0 0" origin="0 0 0" indices="15"  />
        <TrianglePressureForceField  showForces="1"  triangleList="@pressurePlane.triangleIndices" pressure="0.01 0 -0.04" />
        <FastTetrahedralCorotationalForceField poissonRatio="0.45" youngModulus="1" method="polar" /> 
    </Node>
</Node>
def createScene(rootNode):

    root = rootNode.addChild('root', dt="1", showBoundingTree="0", gravity="0 0 0")
    root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
    root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Generate")
    root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
    root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
    root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
    root.addObject('RequiredPlugin', name="Sofa.Component.MechanicalLoad")
    root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
    root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
    root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
    root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
    root.addObject('DefaultAnimationLoop')
    root.addObject('GenerateCylinder', template="Vec3", name="Cylinder", radius="0.2", height="1", resHeight="7", resCircumferential="7", resRadial="3")

    Tetra = root.addChild('Tetra')
    Tetra.addObject('CGLinearSolver', iterations="3000", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
    Tetra.addObject('EulerImplicitSolver', name="default12", rayleighStiffness="0.01", rayleighMass="0.1")
    Tetra.addObject('TetrahedronSetTopologyContainer', name="Container", tetrahedra="@../Cylinder.tetrahedra", position="@../Cylinder.output_position", createTriangleArray="1")
    Tetra.addObject('TetrahedronSetGeometryAlgorithms', drawEdges="1")
    Tetra.addObject('MechanicalObject', name="dofs", showObject="1")
    Tetra.addObject('MeshMatrixMass', name="mass", lumping="1", printMass="0", massDensity="1")
    Tetra.addObject('BoxROI', box="-0.01 -0.01 -0.01 0.01 0.01 0.01", drawBoxes="1", name="fixedPoint")
    Tetra.addObject('FixedProjectiveConstraint', indices="@fixedPoint.indices")
    Tetra.addObject('FixedPlaneProjectiveConstraint', direction="0 0 1", dmin="-0.01", dmax="0.01")
    Tetra.addObject('BoxROI', box="-0.2 -0.2 0.99 0.2 0.2 1.01", drawBoxes="1", name="pressurePlane")
    Tetra.addObject('LineProjectiveConstraint', direction="1 0 0", origin="0 0 0", indices="15")
    Tetra.addObject('TrianglePressureForceField', showForces="1", triangleList="@pressurePlane.triangleIndices", pressure="0.01 0 -0.04")
    Tetra.addObject('FastTetrahedralCorotationalForceField', poissonRatio="0.45", youngModulus="1", method="polar")