thinkingParticles 7.3

Memory Input Functions

The "Memory" input of the ExpressionME-L Node is exclusively used by the Memory Node helper in thinkingParticles. A collection of support functions allows for programmatic access to the node's memory table and variables. These variables can be read and set, enabling you to store and retrieve data within the Memory Node. This can be useful for creating complex behaviors and effective use of arbitrary data across multiple DynamicSets.

Global Variable:

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

 

memory_in_get

Used to get the data from a connected Memory Helper Node

Calls:

memory_in_get(in_pid, in_mem_output, out_scalar)
memory_in_get(in_pid, in_mem_output, out_vector)
memory_in_get(in_pid, in_mem_output, out_scalar, in_depth)
memory_in_get(in_pid, in_mem_output, out_vector, in_depth)

 

Parameters:

Name Description
in_pid Particle id. If pid is greater than or equal to 0, get data per particle id. If less than 0, get the global memory data.
in_mem_output Memory output channel. The outputs of the memory are counted from 0 to xxx.
out_scalar Scalar output.
out_vector Vector output.
in_depth The depth when used. Otherwise, it is 0.

Output:

Return Description
scalar 0: failed, 1: success

 

Example:

Here is a sample of using the memory_in_get function to get data from a connected Memory Helper Node :

Sample Code:

// Declare variables to store the color and scalar output
var color[3];
var scalar;

// Get the color output from memory output channel 0
memory_in_get(pid, 0, color);

// Get the scalar output from memory output channel 1
memory_in_get(pid, 1, scalar);


This sample demonstrates how to retrieve the color and scalar output from a connected Memory Helper Node for a specific particle with the given pid. The memory_in_get function is called twice, with the first call retrieving the color output from Memory Node channel 0, and the second call retrieving the scalar value form Memory Node output channel 1.

 

memory_in_set

This function sets data to specific channels of the connected Memory Helper Node. 

Calls:

memory_in_set(in_pid, in_mem_input, in_scalar)
memory_in_set(in_pid, in_mem_input, in_vector)
memory_in_set(in_pid, in_mem_input, in_scalar, in_depth)
memory_in_set(in_pid, in_mem_input, in_vector, in_depth)

Parameters:

Name Description
in_pid Particle id. If pid is greater than or equal to 0, set data per particle id. If less than 0, set the global memory data.
in_mem_input Memory input channel. The inputs of the Memory Helper Node as counted from 0 to xxx.
in_scalar Scalar to set.
in_vector Vector to set.
in_depth The depth when used. Otherwise, it is 0.

 

Output:

Return Description
scalar 0: failed, 1: success

 

Example:

Here is a sample of using the memory_in_set function to set data to the memory inputs:

Sample Code:

// Declare variables for the color and scalar input
var color[3];
var scalar;


// Set the color input in memory input channel 0
memory_in_set(pid, 0, color);


// Set the scalar input in memory input channel 1
memory_in_set(pid, 1, scalar);

This sample demonstrates how to set the color and scalar input of a connected  Memory Node Helper for a specific particle with the given pid. The memory_in_set function is called twice, with the first call setting the color in the Memory Node input channel 0, and the second call setting the scalar in Memory Node input channel 1.

 

memory_in_info

Used to get information about a connected Memory Helper Node

Calls:

memory_in_info(mem_info, out_scalar)
memory_in_info(mem_info, in_input_id, out_scalar)
memory_in_info(mem_info, in_output_id, out_scalar)

 

Parameters:

Name Description
mem_info The info id to get. See the mem_info table below for possible values.
out_scalar return values are all of type Scalar
in_input_id Memory input id. This parameter is only used when mem_info is mem_ninputs 
in_output_id Memory output id. This parameter is only used when mem_info is mem_noutputs 

mem_info values:

Value Description
mem_info_num_in Number of inputs.
mem_info_num_out Number of outputs.
mem_info_out_type Output type. Possible values: vtype_none, vtype_scalar, vtype_vector.
mem_info_in_type Input type. Possible values: vtype_none, vtype_scalar, vtype_vector.
mem_info_out_depth Output depth.
mem_info_in_depth Input depth.

Output:

Return Description
scalar 0: failed, 1: success

 

 

©2023, cebas Visual Technology Inc.