new hydroCompute(…args)
Main class for the compute modules. It creates instances of the different engines available to run concurrent or parallel runs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
string |
<repeatable> |
Optional argument to set the initial engine. |
- Source:
Example
const compute = new hydroCompute() // empty constructor - javascript engine
const compute = new hydroCompute('wasm') // arguments - engine in arguments set.
Methods
availableEngines() → {Array}
Retrieves the available engines.
- Source:
Returns:
- An array containing the names of the available engines.
- Type
- Array
availableResults() → {Array.<string>}
Retrieves the available results stored in the engineResults
object.
- Source:
Returns:
- An array containing the names of the available results.
- Type
- Array.<string>
availableSplits() → {Object}
Searches the function splits available for data manipulation
- Source:
Returns:
map containing the available split functions in the engines
- Type
- Object
currentEngine() → {string}
Returns the name of the current engine.
- Source:
Returns:
The name of the current engine.
- Type
- string
(async) data(args)
Saves the provided data into the available data storage.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | string | The data to be saved. It can be passed as an object or a string. Properties
|
- Source:
(async) engineScripts() → {Promise.<Map>}
Retrieves the available engine scripts.
- Source:
Returns:
- A Promise that resolves to a Map object containing the available engine scripts.
- Type
- Promise.<Map>
getResTimes(res) → {Array.<number>}
Retrieves the total function time and total script time for a specific result.
Parameters:
Name | Type | Description |
---|---|---|
res |
string | The name of the result. |
- Source:
Returns:
- An array containing the total function time and total script time.
- Type
- Array.<number>
getTotalTime() → {Array.<number>}
Calculates the total function time and total script time for all available results.
- Source:
Returns:
- An array containing the total function time and total script time.
- Type
- Array.<number>
makeId(length) → {string}
Generates a random ID string.
Parameters:
Name | Type | Description |
---|---|---|
length |
number | The length of the ID string. |
- Source:
Returns:
- The generated ID string.
- Type
- string
results(name) → {Array}
Retrieves the results for a specific simulation by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the simulation. |
- Source:
Returns:
- An array of objects containing the results and associated functions.
- Type
- Array
(async) run(args) → {Promise.<void>}
Runs the specified functions with the given arguments using the current engine. The engine must be set previous to the run function to be called.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
Object | string | The configuration object or the relative path of the script to run. Properties
|
- Source:
Returns:
- A Promise that resolves once the functions are executed.
- Type
- Promise.<void>
Example
//Case 1: Running a script in home folder with 'main' function steering the script and a single data instance saved on 'availableData'
await compute.run('scriptName');
//Case 2: Running a function from the ones available on each engine using a multiple data ids
await compute.run({functions: ['f1', 'f2', 'f3'], dataIds: ['id1', 'id2', 'id3']})
//Case 3: Linking steps and linking functions within steps
await compute.run({functions: [['f1', 'f2'], ['f3']],, dependencies:[[[], [0]], []] dataIds: ['id1', 'id2', 'id3']})
(async) setEngine(kernel) → {Promise.<void>}
Sets the current engine based on the specified kernel.
Parameters:
Name | Type | Description |
---|---|---|
kernel |
string | The name of the kernel. |
- Source:
Returns:
- A Promise that resolves once the engine is set.
- Type
- Promise.<void>
setResults(names) → {void}
Sets the results of the current engine and stores them in the engineResults
object.
Parameters:
Name | Type | Description |
---|---|---|
names |
Array | An array of names corresponding to the data IDs. |
- Source:
Returns:
- Type
- void
setTotalTime() → {void}
Calculates and sets the total function time and total script time for each result in the engineResults
object.
- Source:
Returns:
- Type
- void