reference_guide:math_expression_language:functions_variables:output_functions:output_basic_mel

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_idreturns 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_evaltypedefines 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_evaltypedefines 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_averageAll 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

 

 

 

©2024, cebas Visual Technology Inc.

reference_guide/math_expression_language/functions_variables/output_functions/output_basic_mel.txt · Last modified: 2024/01/24 18:34 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki