Parallel Region model element

PJRegion defines a piece of code that can be run in parallel to the EJS model

Usage

To add a set of parallel code to your model, drag the icon element to the list of your model elements and enter the code for each of the parts of your parallel code.

The editor provides a page for each of the following parts:

The code in the Parallel editor can make use of the following predefined constants and methods:

The element implements the following basic methods:

Example of use

pjRegion.startAndWait(4); // runs the parallel code using four threads
pjRegion.startAndReturn(0); // runs the parallel code in a separate thread using as any processors as available
_println ("The parallel code executed last time using "+pjRegion.getThreadCount()+" threads,");
_println ("and took "+pjRegion.getExecutionTime()+" milliseconds.");