libmuscle.util module¶
- libmuscle.util.conduit_to_grpc(conduit: Conduit) Conduit [source]¶
Converts a ymmsl.Conduit to the corresponding mmp.Conduit.
- Parameters
conduit – A conduit.
- Returns
The same conduit, but grpc type.
- libmuscle.util.extract_log_file_location(run_dir: Path, filename: str) Path [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, <filename> will be written in the specified directory.
- Parameters
run_dir – Default directory to use.
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.increment_index(index: List[int], dims: List[int]) bool [source]¶
Increments an index.
- Parameters
index – The index to be incremented.
dims – The dimensions of the block this index is in.
- Returns
True iff the index overflowed and is now all zeros again.