thinkingParticles 7.3

 

Basic Output Types

Most of the extended functions apply to the ExpressionVDB node, however parts of the language syntax do also apply to the VDB Initiator which is part of  the overall ME-L expression language.

Global Variable:

basic_out_id returns the index of the output you created (starting with 0)

 

Find below a list of Basic Output Types and Functions.

Variables Description
scalar_out the scalar output. This is the output You created in the ExpressionME-L Node.
scalar_out_evaltype defines the method or type of handling a value when it is set to a scalar output
scalar_out_weight  optional parameter, only used when creating an average value to allow different weights,
the default is 1.0
vector_out the vector output. This is the output You created in the ExpressionME-L Node.
vector_out_evaltype defines the method or type of handling a value when it is set to a  vector output
vector_out_weight optional parameter, only used when creating an average value to allow different weights,the default is 1.0


Available evaluation types are:

Evaluation Type Description
evaltype_average All values are combined to create an average
evaltype_min Outputs the minimum value, or if the output is a vector, outputs the vector with the shortest length
evaltype_max Outputs the maximum value, or if the output is a vector, outputs the vector with the longest length
evaltype_cmin For scalars, it behaves the same as evaltype_min. For vectors, it outputs the minimum value for each component (x, y, z) separately
evaltype_cmax For scalars, it behaves the same as evaltype_max. For vectors, it outputs the maximum value for each component (x, y, z) separately


Here are some examples of how to use these parameters:
 


The above screenshot shows our Inputs and Outputs created for the below smaple. Particle is a Group input and speedaverage is our Scalar output which can be set with the [name]_out directive. To get the center of mass as in the last exmaple we woudl need to create a Vector output called centerofmass.

To calculate the average speed of all local particles (assuming the first input is a group and the expression iterates over all particles in the group in parallel):

var speed;

get_pdata(pid, data_vel, speed);
speedaverage_out = speed;

speedaverage_out_evaltype = evaltype_average; // the position in the code is not important, it's only used to tell TP how to handle the value for the output

    

To evaluate the minimum speed of all local particles:

var speed;

get_pdata(pid, data_vel, speed);

speedaverage_out = speed;

speedaverage_out_evaltype = evaltype_min;

To evaluate the center of mass for all local particles:

var pos[3];

var mass;         

get_pdata(pid, data_pos, pos);

get_pdata(pid, data_mass, mass);         

centerofmass_out _evaltype = evaltype_average; //set the output handling

centerofmass_out = pos * mass; //here we weight the position with the mass
centerofmass_out _weight = mass; //tell the output that the value is weighted with the mass
 

 

 

©2023, cebas Visual Technology Inc.