thinkingParticles 7.3

Generator Input Functions

The "Generator" input of the ExpressionME-L Node enables multi-threaded creation of particles or particle clouds. Generator inputs are used to directly connect a Born Operator Node, Position Born or a TrailBorn Node. The connected node will initialize the particle group and the lifetime of the particles. If the Generator is the first input of the ExpressionME-L Node, the created particles will be processed in parallel. You can also use the create() function to create particles at any point in the expression.
Note that if you call create() multiple times, the particles will not be processed in parallel.

Global Variable:

generator_in_id returns the index of the input you created (starting with 0 excluding Time and On). 

 

generator_in_create

Used to gather/create the amount of particles created by the Born Operator Node.

Calls:

generator_in_create()

generator_in_create(in_pos[3]) //For PositionBorn sets the position 

generator_in_create(in_pos[3], in_dir[3]); //For PositionBorn, sets the position and direction

Parameters:

Name Description
in_pos[3] Sets the postion for the PositionBorn node
in_dir[3] used in PositionBorn to define the direction

Output:

Return Description
scalar number of particles generated; use generator_in_id2pid to get the real particle IDs

 

generator_in_pcreate

To create particles based on a source particle, you can use the generator_in_pcreate function in the ExpressionME-L node. This function allows you to use the position of a source particle and create automatically in-between particles.

Note, currently the only thinkingParticles Nodes supported with this function are TrailBorn and PositionBorn.

Calls:

generator_in_pcreate(in_pid)

generator_in_pcreate(in_pid,in_dir[3])

Parameters:

Name Description
in_pid Source particle ID
in_dir used in PositionBorn to define the direction

Output:

Return Description
scalar 0: no particles created, >=0: number of particles created

 

generator_in_id2pid

Used to get the real thinkingParticles particle ID from the born particles' index. Any connected generator input may create particles at any time, hence generators only "say" they created 10, 100, or 5000 particles. However, those newly created particles are just local indexes, valid only to each generator input. So, each particle generator can generate a particle with an index of 20, but in thinkingParticles' pool of particles in the simulation, the real particle ID has to be retrieved by this function.

Calls:

generator_in_id2pid(in_born_id)

Parameters:

Name Description
in_born_id The born index. This should be a value between 0 and the number of particles created (exclusive).

Output:

Return Description
scalar -1: fail, or the particle id


Example:
    
            Create a set of particle and get there particle id's

Calls:

var num = generator_in_create();
        for(var i = 0; i < num; i += 1)
        {
            var pid = generator_in_id2pid(i);
            ...do any thing with the pid
        }

 

 

©2023, cebas Visual Technology Inc.