From 5d97f4c7b497fda5a3ba4bb14c9f48dc3b4006cf Mon Sep 17 00:00:00 2001 From: LUCIE BERTHON Date: Fri, 7 Sep 2018 11:21:23 +0200 Subject: [PATCH] mise en place de la fonction run avec le nom du fichier comm --- .../mesScripts_MAPIDENTIFICATION.py | 18 +++++------------- generator/generator_MapIdentification.py | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/MapIdentification/mesScripts_MAPIDENTIFICATION.py b/MapIdentification/mesScripts_MAPIDENTIFICATION.py index 50e490d9..104d50e4 100644 --- a/MapIdentification/mesScripts_MAPIDENTIFICATION.py +++ b/MapIdentification/mesScripts_MAPIDENTIFICATION.py @@ -18,14 +18,13 @@ def comm2MAPinput(input_filename): string = "[c_solver_constitutive_law0d]\n" for line in lines: - for key in KEYS: + for key in MAP_KEYS: if key + "=" in line: string += key + "=" + line.split("'")[1] + "\n" output_filename = os.path.splitext(input_filename)[0] + ".input" with open(output_filename, "w") as new_file: new_file.write(string) - print ('je convertis le fichier comm en input de MAP') return output_filename @@ -42,19 +41,12 @@ def writeMAPinput(dictValeur): with open("toto.input",'w') as f_out : config.write(f_out) -def run(editor): - print ('je rentre dans run') - print editor.fichier - command_file = "/home/C41270/MAPinput_test.comm" # TODO: nom en dur - +def run(listeParam): + command_file=listeParam[0].fichier command_file = comm2MAPinput(command_file) - os.system("map -r sappli run -n C_solver_constitutive_law0d -i " + command_file) + command = "map -r sappli run -n C_solver_constitutive_law0d -i " + command_file + os.system(command) print "calcul fini, youpi !" - #+def run(listeParam): - #+ print ('je rentre dans run') - #+ editor=listeParam[0] - #+ print (editor) - #+ print (dir(editor)) # le dictionnaire des commandes a la structure suivante : diff --git a/generator/generator_MapIdentification.py b/generator/generator_MapIdentification.py index 7df77279..4baaf1ba 100644 --- a/generator/generator_MapIdentification.py +++ b/generator/generator_MapIdentification.py @@ -74,7 +74,7 @@ class MapIdentificationGenerator(PythonGenerator): config.add_section("c_solver_constitutive_law0d") for key, value in self.dictValeur.iteritems(): - if key in KEYS: + if key in MAP_KEYS: config.set("c_solver_constitutive_law0d", key, value) input_filname = os.path.splitext(fn)[0] + ".input" -- 2.39.2