globalUtils

globalUtils

Methods

(static) arrayChanger()

switches the rows/columns of an array

Source:

(static) concatArrays(arrays) → {Array}

Helper function for concatenating arrays.

Parameters:
Name Type Description
arrays Array

collection of arrays to concatenate

Source:
Returns:

array - concatenated array

Type
Array

(static) DAG(functions, dag, args, type) → {Promise}

Directed Acyclic Graph implementation for solving promised-based functions adopted from https://github.com/daanmichiels/promiseDAG

Parameters:
Name Type Description
functions Array

functions required to run during a simulation as promised using the order [func1, func2...]

dag Array

dependency array listing the sequential executions for each funciton as [[0], [1], [0,1]...]

args Object

argument list used to run a specific function. This will change already on the engine

type String

running either a function DAG or a step DAG

Source:
Returns:

fulfills the resolution for the DAG or returns error with the execution context.

Type
Promise

(static) dataCloner(data) → {Object}

Deep clones either objects or arrays

Parameters:
Name Type Description
data Object

array or object

Source:
Returns:

deep cloned object or array to be used

Type
Object
Example
const arr = [1, 2, 3, [4, 5]];
const clonedArr = dataCloner(arr);

(static) flattenFloat32Array(arr) → {Array}

Helper function for flatennizing a 2D array

Parameters:
Name Type Description
arr Array

N-D array to be flattened

Source:
Returns:

flattenized ND array

Type
Array

(static) getPerformanceMeasures() → {object|Object}

Retrieves the performance measures for function execution and worker execution.

Properties:
Name Type Description
funcExec number

The duration of function execution.

workerExec number

The duration of worker execution.

Source:
Returns:
    • The performance measures.
    Type
    object
  • object containing execution times for both script and function exeuctions.

    Type
    Object

(static) importJSONdata(jsonFile, dataFieldNameopt) → {Promise.<*>}

Imports JSON data from a file.

Parameters:
Name Type Attributes Default Description
jsonFile string

The path or URL to the JSON file.

dataFieldName string <optional>
"data"

The name of the field containing the data in the JSON file.

Source:
Returns:
  • A promise that resolves to the imported data.
Type
Promise.<*>

(static) IndexedDAG(options) → {Object}

Directed Acyclic Graph implementation that utilizes IndexedDB for persistent data dependent executions. Handles extensive dependencies, partitioned files, and reference items.

Parameters:
Name Type Description
options Object

Configuration object

Properties
Name Type Description
functions Array

List of functions to execute

dependencies Array

Dependency graph

args Array

Arguments for each function

dataIds Array

Unique IDs for data items

dbConfig Object

Database configuration

type String

Execution type

Source:
Returns:

Executor controller with canExecute and getExecutionContext methods

Type
Object