From 1b485e5afc72722fdb378b196a404fd69fb9c104 Mon Sep 17 00:00:00 2001
From: imcovangent <I.vanGent@tudelft.nl>
Date: Mon, 16 Apr 2018 16:24:52 +0200
Subject: [PATCH] Added and tested interactive VISTOMS in SSBJ example scripts.

Former-commit-id: 38323dba06ada29b51fe0cbe1416298fbffb7fa9
---
 examples/scripts/ssbj_mda.py | 14 ++++++++++++--
 examples/scripts/ssbj_mdo.py |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/examples/scripts/ssbj_mda.py b/examples/scripts/ssbj_mda.py
index f8737ebc8..4fda9c659 100644
--- a/examples/scripts/ssbj_mda.py
+++ b/examples/scripts/ssbj_mda.py
@@ -7,6 +7,8 @@ import numpy as np
 from kadmos.graph import FundamentalProblemGraph, load
 
 # Settings for logging
+from kadmos.graph.mixin_vistoms import vistoms_start
+
 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
 
 # List of MDA definitions that can be wrapped around the problem
@@ -21,10 +23,12 @@ mdao_definitions = ['unconverged-MDA-GS',     # 0
                     'converged-DOE-GS-FF',    # 8
                     'converged-DOE-GS-LH',    # 9
                     'converged-DOE-GS-MC']    # 10
+all_graphs = []
 
 # Settings for scripting
-mdao_definitions_loop_all = True      # Option for looping through all MDAO definitions
-mdao_definition_id = 6                # Option for selecting a MDAO definition (in case mdao_definitions_loop_all=False)
+mdao_definitions_loop_all = True  # Option for looping through all MDAO definitions
+mdao_definition_id = 6            # Option for selecting a MDAO definition (in case mdao_definitions_loop_all=False)
+start_interactive_vistoms = True  # Option to start an interactive VISTOMS at the end
 
 # Settings for loading and saving
 kb_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../knowledgebases')
@@ -92,6 +96,7 @@ function_order = ['Structures', 'Aerodynamics', 'Propulsion', 'Performance',
 # Create a DSM and a VISTOMS visualization of the RCG
 rcg.create_dsm('RCG_extended', include_system_vars=True, destination_folder=pdf_dir, function_order=function_order)
 rcg.vistoms_create(vistoms_dir, function_order=function_order)
+all_graphs.append(rcg)
 
 # On to the wrapping of the MDAO architectures
 # Get iterator (all or single one)
@@ -190,6 +195,7 @@ for mdao_definition in mdao_definitions:
              version='0.1',
              pretty_print=True,
              integrity=True)
+    all_graphs.append(fpg)
 
     # Get Mdao graphs
     mdg, mpg = fpg.impose_mdao_architecture()
@@ -216,5 +222,9 @@ for mdao_definition in mdao_definitions:
              version='0.1',
              pretty_print=True,
              integrity=True)
+    all_graphs.append((mdg, mpg))
 
 logging.info('Done!')
+
+if start_interactive_vistoms:
+    vistoms_start(all_graphs, file_dir='ssbj/VISTOMS_mda_interactive')
diff --git a/examples/scripts/ssbj_mdo.py b/examples/scripts/ssbj_mdo.py
index f8e8cabcc..ffe0196a1 100644
--- a/examples/scripts/ssbj_mdo.py
+++ b/examples/scripts/ssbj_mdo.py
@@ -224,4 +224,4 @@ for mdao_definition in mdao_definitions:
 logging.info('Done!')
 
 if start_interactive_vistoms:
-    vistoms_start(all_graphs, file_dir='ssbj/VISTOMStest')
+    vistoms_start(all_graphs, file_dir='ssbj/VISTOMS_mdo_interactive')
-- 
GitLab