Skip to content
Snippets Groups Projects
Commit 09fd6fef authored by Erik von Reis's avatar Erik von Reis
Browse files

RCG: fixed a typo. fixed CMake error. removed unused tree-traversal from sequence checks.

parent de6d197f
No related branches found
No related tags found
1 merge request!276RCG: fix out of order calculations, add order check
......@@ -88,5 +88,4 @@ CHECK_FUNCTION_EXISTS(fchdir HAVE_FCHDIR)
add_compile_options(-g3)
add_subdirectory(src)
add_subdirectory(test)
\ No newline at end of file
add_subdirectory(src)
\ No newline at end of file
add_test (NAME test-sequence-check
COMMAND "python3 -m pytest"
COMMAND ${Python3_EXECUTABLE} -B -m pytest
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
......@@ -32,7 +32,7 @@ class Part(object):
def add_link_to(self, to_node):
"""
Link two Part nodes, so that 'self' is the from node
:param to_node: A Part that si the "to node" of the new link
:param to_node: A Part that is the "to node" of the new link
:return: None
"""
if to_node not in self.to_nodes:
......@@ -40,16 +40,6 @@ class Part(object):
if self not in to_node.from_nodes:
to_node.from_nodes.append(self)
def traverse_tree(self, f):
"""
Recursively apply f to the node and all children
:param f: A function that modifies a Part
:return: None
"""
f(self)
for child in self.to_nodes:
child.traverse_tree(f)
def clear_visit(self):
self.visited = False
......@@ -121,10 +111,6 @@ class CalcGraph(object):
else:
return self.add(part_id)
def traverse_graph(self, f):
for root in self.root_nodes:
root.traverse_tree(f)
def check_sequence(self, sequence):
"""
Compare a sequence to the graph to see if it's a valid calculation sequence.
......@@ -136,7 +122,6 @@ class CalcGraph(object):
:return: True, [] if sequence is good. otherwise False, [(Part1, Part2) ...].
For each tuple returned on failure, Part1 should have been calculated after Part2, but was not.
"""
# self.traverse_graph(lambda node: node.clear_visit())
wrong_order = []
for part_id in sequence:
if part_id not in self.nodes:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment