Each AssemblyObject stores a receiverValue (a double), which is computed:

. in the Assemblage constructor (setting up the assemblage) . at reset settings . when adding a valid object (single value for the new object)

This makes computing the next receiver and new candidates faster, as opposed to recompute all receivers at each iteration.

You can write customized method for:

<aside> 💡 one could write a method to update receiver values at each iteration to implement time-based value changes such as diffusion, evaporation, etc.

</aside>

AssemblerLib uses delegates to give users the flexibility to write their own criteria for the computation and selection of sender and receiver. You don’t need to be familiar with delegates to write your own methods in Assembler (the examples show a simple and an advanced way to do that), but if you want to know more check the following sub-page:

delegates

All you have to do is write your custom methods and assign the method to the appropriate delegate variable. Assembler will take care of calling the methods and do the bookkeeping.

AssemblerLib delegates have generic types: for advanced scripting, you can define a class that extends AssemblyObject and defines the receiverValue as a custom type. In this case, also Assemblage needs to be extended, and the corresponding delegate variables declared inside that class (see advanced scripting example).

Select Receiver

computing values

Computation for receiver value is made using the following delegate type in the Assemblage class:

// delegate type
public delegate T ComputeReceiverMethod<T>(AssemblyObject receiver);
// delegate type variable (Assemblage class field)
public ComputeReceiverMethod<double> computeReceiverValue;

for example, this is a valid method that computes the difference between the closest scalar field and the scalar threshold: