From 001b05dbd54d242d094a80f2e18234a65f51c106 Mon Sep 17 00:00:00 2001 From: baigner <benedikt.aigner@rwth-aachen.de> Date: Wed, 14 Nov 2018 14:42:21 +0100 Subject: [PATCH] VISTOMS update: Impose MDAO architecture including additionals settings works now for all architectures. Former-commit-id: bfaf8e30442d24dacdd34d34d3ca01307dc90be8 --- kadmos/vistoms/templates/VISTOMS.html | 53 ++++++++++++++++++++++++++- kadmos/vistoms/vistoms.py | 9 +++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/kadmos/vistoms/templates/VISTOMS.html b/kadmos/vistoms/templates/VISTOMS.html index db076ab0a..e7b27b10b 100644 --- a/kadmos/vistoms/templates/VISTOMS.html +++ b/kadmos/vistoms/templates/VISTOMS.html @@ -20066,6 +20066,7 @@ 'Uniform design', 'Box-Behnken design'] var DOE_settings = [] + var coupled_functions_groups = []; //################################################################################################// @@ -22991,7 +22992,7 @@ } }) } - if (MDAO_architecture.includes("DOE")) + if (MDAO_architecture.includes("DOE") || MDAO_architecture == "BLISS-2000") { var theOptions = [] for (var i = 0; i<DOE_methods.length; i++){theOptions.push({text:DOE_methods[i], value:DOE_methods[i]})} @@ -23120,6 +23121,55 @@ } }) } + if (MDAO_architecture == "CO" || MDAO_architecture == "BLISS-2000") + { + bootbox.prompt( + { + closeButton: false, + title: "Select number of coupled function groups", + inputType: 'number', + callback: function (result) { + if (result) + { + var number_of_coupled_groups = result; + + var theOptions = []; + for (var j=1; j<currentGraph.xdsm.nodes.length;j++) + { + //aigner: value: j-1 because in KADMOS the coordinator is not in the node list, therefore all other competences' indices are decreased by 1! + theOptions.push({text: currentGraph.xdsm.nodes[j].name, value: currentGraph.xdsm.nodes[j].uID}); + } + + coupled_functions_groups = []; + function select_coupled_functions_group(num, counter) + { + counter ++; + if (num >= counter) + { + bootbox.prompt( + { + closeButton: false, + title: "Select functions for group " +String(counter), + inputType: 'checkbox', + inputOptions: theOptions, + callback: function (result) + { + if (result) + { + coupled_functions_groups.push(result) + select_coupled_functions_group(num, counter); + } + else {bootbox.hideAll()} + } + }) + } + } + select_coupled_functions_group(number_of_coupled_groups, 0) + } + else {bootbox.hideAll()} + } + }) + } }} }) }) @@ -23177,6 +23227,7 @@ 'currentOrder':nodeOrder, 'mdao_architecture':MDAO_architecture, 'doe_settings': JSON.stringify(DOE_settings), + 'coupled_functions_groups': JSON.stringify(coupled_functions_groups), 'coupling_decomposition':coupling_decomposition, 'allow_unconverged_couplings':allow_unconverged_couplings, 'sessionId':sessionId}, diff --git a/kadmos/vistoms/vistoms.py b/kadmos/vistoms/vistoms.py index 14dd325d5..0452be158 100644 --- a/kadmos/vistoms/vistoms.py +++ b/kadmos/vistoms/vistoms.py @@ -2088,6 +2088,7 @@ def interface(debug=True, tempdir=None): mdao_architecture = request.form['mdao_architecture'] doe_settings_py = json.loads(request.form['doe_settings']) coupling_decomposition = request.form['coupling_decomposition'] + coupled_functions_groups = json.loads(request.form['coupled_functions_groups']) allow_unconverged_couplings_str = request.form['allow_unconverged_couplings'] if allow_unconverged_couplings_str == 'True': allow_unconverged_couplings = True @@ -2156,17 +2157,19 @@ def interface(debug=True, tempdir=None): fpg.graph['problem_formulation']['convergence_type'] = coupling_decomposition fpg.graph['problem_formulation']['allow_unconverged_couplings'] = allow_unconverged_couplings - - # TODO Benedikt: Collaborative Optimization and Bliss2000 do not work yet - if mdao_architecture in ['converged-DOE', 'unconverged-DOE']: + if mdao_architecture in ['converged-DOE', 'unconverged-DOE', 'BLISS-2000']: if doe_settings['method'] not in fpg.OPTIONS_DOE_METHODS: return "ERROR: Invalid DOE method selected, please select a DOE method from the dropdown list" fpg.graph['problem_formulation']['doe_settings'] = doe_settings + if len(coupled_functions_groups) > 0: + fpg.graph['problem_formulation']['coupled_functions_groups'] = coupled_functions_groups + fpg.add_function_problem_roles() mdg, mpg = fpg.impose_mdao_architecture() + # Add the graph with the updated function order to VISTOMS newVistomsData = mdg.vistoms_add_json(graph_id=graphID, mpg=mpg) # Save the graph in temp/tmp.kdms -- GitLab