Skip to content
Snippets Groups Projects
Commit 85332db0 authored by Jammer, Tim's avatar Jammer, Tim
Browse files

added insert Operation for Instruction Block

parent af3543b4
No related branches found
No related tags found
1 merge request!6More Work on infrastructure IV
...@@ -127,6 +127,18 @@ class InstructionBlock: ...@@ -127,6 +127,18 @@ class InstructionBlock:
raise IndexError("Operation Not Found") raise IndexError("Operation Not Found")
self.operations[kind][index] = op self.operations[kind][index] = op
def insert_operation(self, op, kind='all', before_index=0):
"""
Inserts an operation before the specified one. will Raise IndexError if not present
Parameters:
- op (str or MPICall) the new operation
- kind ('all','not0' or integer): which ranks should execute the operation
- index (int): the index of the operation within the given kind
"""
if len(self.operations[kind]) < before_index:
raise IndexError("Operation Not Found")
self.operations[kind].insert(before_index,op)
def remove_operation(self, kind='all', index=0): def remove_operation(self, kind='all', index=0):
""" """
Removes the operation registered. will Raise IndexError if not present Removes the operation registered. will Raise IndexError if not present
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment