Skip to content

ParticleSource

Parametrable particle generator

Vec2d

Templates:

  • Vec2d

Target: SofaSphFluid

namespace: sofa::component::misc

parents:

  • ProjectiveConstraintSet

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
group ID of the group containing this constraint. This ID is used to specify which constraints are solved by which solver, by specifying in each solver which groups of constraints it should handle. 0
endTime The constraint stops acting after the given value. Use a negative value for infinite constraints -1
translation translation applied to center(s) 0 0
scale scale applied to center(s) 1
center Source center(s)
radius Source radius 0 0
velocity Particle initial velocity 0 0
delay Delay between particles creation 0.01
start Source starting time 0
stop Source stopping time 1e+10
addNoise Will add random value to the radius of new created particles 1
lastparticles lastparticles indices
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
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
mstate MechanicalState used by this component MechanicalState<Vec2d>

Vec3d

Templates:

  • Vec3d

Target: SofaSphFluid

namespace: sofa::component::misc

parents:

  • ProjectiveConstraintSet

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
group ID of the group containing this constraint. This ID is used to specify which constraints are solved by which solver, by specifying in each solver which groups of constraints it should handle. 0
endTime The constraint stops acting after the given value. Use a negative value for infinite constraints -1
translation translation applied to center(s) 0 0 0
scale scale applied to center(s) 1
center Source center(s)
radius Source radius 0 0 0
velocity Particle initial velocity 0 0 0
delay Delay between particles creation 0.01
start Source starting time 0
stop Source stopping time 1e+10
addNoise Will add random value to the radius of new created particles 1
lastparticles lastparticles indices
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
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
mstate MechanicalState used by this component MechanicalState<Vec3d>

Examples

ParticleSource.scn

<?xml version="1.0" ?>
<Node dt="0.005" gravity="0 -10 0" bbox="-4 -4 -4 4 4 4">
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Forward"/> <!-- Needed to use components [EulerExplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="SofaSphFluid"/> <!-- Needed to use components [ParticleSource] -->
    <VisualStyle displayFlags="showBehaviorModels showForceFields showWireframe" />

    <DefaultAnimationLoop/>
    <Node name="Particles">
        <EulerExplicitSolver symplectic="1" />
        <MechanicalObject name="MModel" showObject="1"/>        
        <ParticleSource name="Source" translation="0 4 0" radius="0.01 0.1 0.01" velocity="0 -1 0" delay="0.1" start="-0.1" stop="10" printLog="0"
        center="-0.375 0 -0.75 
            0.0 0.0 -0.75 
            0.375 0.0 -0.75 
            -0.75  0.0 -0.375 
            -0.375 0.0 -0.375 
            0.0 0.0 -0.375 
            0.375 0.0 -0.375 
            0.75 0.0 -0.375 
            -0.75 0.0 0.0 
            -0.375 0.0 0.0 
            0.0 0.0 0.0 
            0.375 0.0 0.0 
            0.75 0.0 0.0 
            -0.75 0.0 0.375 
            -0.375 0.0 0.375 
            0.0 0.0 0.375 
            0.375 0.0 0.375 
            0.75 0.0 0.375 
            -0.375 0.0 0.75 
            0.0 0.0 0.75 
            0.375 0.0 0.75"  />
        <UniformMass name="M1" vertexMass="1.0" />
    </Node>
</Node>
def createScene(root_node):

   node = root_node.addChild('node', dt="0.005", gravity="0 -10 0", bbox="-4 -4 -4 4 4 4")

   node.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   node.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Forward")
   node.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   node.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   node.addObject('RequiredPlugin', name="SofaSphFluid")
   node.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields showWireframe")
   node.addObject('DefaultAnimationLoop', )

   particles = node.addChild('Particles')

   particles.addObject('EulerExplicitSolver', symplectic="1")
   particles.addObject('MechanicalObject', name="MModel", showObject="1")
   particles.addObject('ParticleSource', name="Source", translation="0 4 0", radius="0.01 0.1 0.01", velocity="0 -1 0", delay="0.1", start="-0.1", stop="10", printLog="0", center="-0.375 0 -0.75              0.0 0.0 -0.75              0.375 0.0 -0.75              -0.75  0.0 -0.375              -0.375 0.0 -0.375              0.0 0.0 -0.375              0.375 0.0 -0.375              0.75 0.0 -0.375              -0.75 0.0 0.0              -0.375 0.0 0.0              0.0 0.0 0.0              0.375 0.0 0.0              0.75 0.0 0.0              -0.75 0.0 0.375              -0.375 0.0 0.375              0.0 0.0 0.375              0.375 0.0 0.375              0.75 0.0 0.375              -0.375 0.0 0.75              0.0 0.0 0.75              0.375 0.0 0.75")
   particles.addObject('UniformMass', name="M1", vertexMass="1.0")