Skip to content
Snippets Groups Projects
Commit fa5ddddd authored by Andreas Makus's avatar Andreas Makus
Browse files

started on the graphing function

parent 0cadeb18
No related branches found
No related tags found
No related merge requests found
......@@ -47,13 +47,14 @@ class MDOproblem:
# Get input and output files, save in instance
self._get_In_Out_Files(KB_files)
# Get Read-Write File, save in instance
self._get_base_file(KB_files)
if self.knowledge_base == "KB_CPACS":
# Get Read-Write File, save in instance
self._get_base_file(KB_files)
ignoreNodes = ['toolspecific']
self._check_base_against_schema(ignoreNodes)
ignoreNodes = ['toolspecific']
self._check_base_against_schema(ignoreNodes)
self._validate_InOutXmls()
self._validate_InOutXmls()
self._get_function_data()
......@@ -537,6 +538,28 @@ class MDOproblem:
idx += 1
return common_nodes
def _get_function_graph(self, functionName):
"""
This function builds a graph for the indicated function.
:param: functionName
:return: functionGraph
"""
assert isinstance(functionName, basestring), 'Provided function name must be a string!'
# TODO: ensure that function name exists in KB
DG = nx.DiGraph()
for i in len(self.functionData):
# get function name
# loop through input child nodes
# build tuple of tool and child node, add attributes
# repreat for output
pass
return
def get_function_graph(self, function_name):
"""
Function to automatically create the digraph of the function element.
......@@ -551,9 +574,7 @@ class MDOproblem:
function_input_analysis = self.analyze_function_xml(xml_file_input)
function_output_analysis = self.analyze_function_xml(xml_file_output)
input_edges = [(function_input_analysis['valued_nodes'][i]['xpath'],
function_input_analysis['properties'][0]['attributes']['tool_name'])
for i in range(len(function_input_analysis['valued_nodes']))]
input_edges = [(function_input_analysis['valued_nodes'][i]['xpath'], function_input_analysis['properties'][0]['attributes']['tool_name']) for i in range(len(function_input_analysis['valued_nodes']))]
output_edges = [(function_output_analysis['properties'][0]['attributes']['tool_name'],
function_output_analysis['valued_nodes'][i]['xpath'])
for i in range(len(function_output_analysis['valued_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