libmuscle.util module

libmuscle.util.extract_log_file_location(filename: str) Path | None[source]

Gets the log file location from the command line.

Extracts the –muscle-log-file=<path> argument to tell the MUSCLE library where to write the local log file. This function will extract this argument from the command line arguments if it is present. If the given path is to a directory, <filename> will be written inside of that directory, if the path is not an existing directory, then it will be used as the name of the log file to write to. If no command line argument is given, this function returns None.

Parameters:

filename – Default file name to use.

Returns:

Path to the log file to write.

libmuscle.util.generate_indices(dims: List[int]) Generator[List[int], None, None][source]

Generates all indices in a block of the given dimensions.

Parameters:

dims – The dimensions of the block.

Yields:

Lists of indices, one for each point in the block.

libmuscle.util.instance_indices(instance: Reference) List[int][source]

Extracts the indices from an instance name.

Parameters:

instance – The name of a kernel instance.

Returns:

The name of its kernel.

libmuscle.util.instance_to_kernel(instance: Reference) Reference[source]

Extracts the name of the kernel from an instance name.

Parameters:

instance – The name of a kernel instance.

Returns:

The name of its kernel.