**Dict**
This indicates a variable that has to be filled by a dictionary, usually
- given as a script.
+ given either as a string or as a script.
**Function**
This indicates a variable that has to be filled by a function, usually given
<outport name="result" type="SALOME_TYPES/ParametricOutput"/>
</inline>
+ <inline name="CreateDictFromString">
+ <script><code><![CDATA[
+import logging, sys, os
+logging.debug("CREATE Entering in CreateDictFromString")
+dico = eval(dict_in_string)
+]]></code></script>
+ <inport name="dict_in_string" type="string"/>
+ </inline>
+
<inline name="CreateDictFromScript">
<script><code><![CDATA[
import logging, sys, os
data_name = "AlgorithmParameters"
data_type = "Dict"
- from_type = "Script"
- data = self.dictMCVal["__"+self.type_of_study+"__AlgorithmParameters__Dict__data__SCRIPT_DATA__SCRIPT_FILE"]
-
- self.text_da += data_name + "_config = {} \n"
- self.text_da += data_name + "_config['Type'] = '" + data_type + "'\n"
- self.text_da += data_name + "_config['From'] = '" + from_type + "'\n"
- self.text_da += data_name + "_config['Data'] = '" + data + "'\n"
- self.text_da += "study_config['" + data_name + "'] = " + data_name + "_config\n"
+ from_type = self.dictMCVal["__"+self.type_of_study+"__AlgorithmParameters__Dict__data__FROM"]
+
+ if from_type == "Script":
+ data = self.dictMCVal["__"+self.type_of_study+"__AlgorithmParameters__Dict__data__SCRIPT_DATA__SCRIPT_FILE"]
+ self.text_da += data_name + "_config = {} \n"
+ self.text_da += data_name + "_config['Type'] = '" + data_type + "'\n"
+ self.text_da += data_name + "_config['From'] = '" + from_type + "'\n"
+ self.text_da += data_name + "_config['Data'] = '" + data + "'\n"
+ self.text_da += "study_config['" + data_name + "'] = " + data_name + "_config\n"
+
+ if from_type == "String":
+ data = self.dictMCVal["__"+self.type_of_study+"__AlgorithmParameters__Dict__data__STRING_DATA__STRING"]
+ self.text_da += data_name + "_config = {} \n"
+ self.text_da += data_name + "_config['Type'] = '" + data_type + "'\n"
+ self.text_da += data_name + "_config['From'] = '" + from_type + "'\n"
+ self.text_da += data_name + "_config['Data'] = '" + data + "'\n"
+ self.text_da += "study_config['" + data_name + "'] = " + data_name + "_config\n"
def add_init(self):
FromNumpyList["ScalarSparseMatrix"] = ["String", "Script"]
FromNumpyList["DiagonalSparseMatrix"] = ["String", "Script"]
FromNumpyList["Function"] = ["ScriptWithOneFunction", "ScriptWithFunctions", "ScriptWithSwitch", "FunctionDict"]
-FromNumpyList["Dict"] = ["Script"]
+FromNumpyList["Dict"] = ["String", "Script"]
# -- Infos from daAlgorithms --
AssimAlgos = [
DataTypeDict["ScalarSparseMatrix"] = ["String", "Script"]
DataTypeDict["DiagonalSparseMatrix"] = ["String", "Script"]
DataTypeDict["Function"] = ["ScriptWithOneFunction", "ScriptWithFunctions", "ScriptWithSwitch", "FunctionDict"]
-DataTypeDict["Dict"] = ["Script"]
+DataTypeDict["Dict"] = ["String", "Script"]
DataTypeDefaultDict = {}
DataTypeDefaultDict["Vector"] = "Script"
back_node.edAddInputPort("init_data", t_pyobj)
ADAO_Case.edAddDFLink(init_node.getOutputPort("init_data"), back_node.getInputPort("init_data"))
+ if data_config["Type"] == "Dict" and data_config["From"] == "String":
+ # Create node
+ factory_back_node = catalogAd.getNodeFromNodeMap("CreateDictFromString")
+ back_node = factory_back_node.cloneNode("Get" + key)
+ back_node.getInputPort("dict_in_string").edInitPy(data_config["Data"])
+ back_node.edAddOutputPort(key, t_pyobj)
+ back_node_script = back_node.getScript()
+ back_node_script += key + " = dict(dico)\n"
+ back_node_script += "logging.debug(\"Dict is %ss\"%s%s)"%("%","%",key)
+ back_node.setScript(back_node_script)
+ ADAO_Case.edAddChild(back_node)
+ # Connect node with CreateAssimilationStudy
+ CAS_node.edAddInputPort(key, t_pyobj)
+ ADAO_Case.edAddDFLink(back_node.getOutputPort(key), CAS_node.getInputPort(key))
+ # Connect node with InitUserData
+ if key in init_config["Target"]:
+ back_node_script = back_node.getScript()
+ back_node_script = "__builtins__[\"init_data\"] = init_data\n" + back_node_script
+ back_node.setScript(back_node_script)
+ back_node.edAddInputPort("init_data", t_pyobj)
+ ADAO_Case.edAddDFLink(init_node.getOutputPort("init_data"), back_node.getInputPort("init_data"))
+
if data_config["Type"] == "Vector" and data_config["From"] == "String":
# Create node
factory_back_node = catalogAd.getNodeFromNodeMap("CreateNumpyVectorFromString")