"constitutive_law_parameters",
"user_defined_mfront_file_directory",
"exp_filename_list",
- "mtest_options",
- "interface"]
+ "mtest_options", "interface"]
def comm2MAPinput(input_filename):
# Saving my input file by converting comm file into ini
+ print("on rentre dans comm2MAPinput pour " + input_filename)
+
with open(input_filename) as input_file:
- lines = input_file.readlines()
+ data = input_file.read()
+
+ data = data.replace("=\n", "=").replace("=\t", "=")
+ data = re.sub(' +', ' ',data).split("\n")
- string = "[c_solver_constitutive_law0d]\n"
- for line in lines:
+ string = "[c_solver_constitutive_law_0d]\n"
+ for line in data:
for key in MAP_KEYS:
if key + "=" in line:
string += key + "=" + line.split("'")[1] + "\n"
"""
print("je rentre dans writeMAPinput")
config = RawConfigParser()
- config.add_section("c_solver_constitutive_law0d")
+ config.add_section("c_solver_constitutive_law_0d")
for key, value in dictValeur.iteritems():
if key in MAP_KEYS:
- config.set("c_solver_constitutive_law0d", key, value)
+ config.set("c_solver_constitutive_law_0d", key, value)
filename = os.path.abspath(os.path.splitext(filename)[0] + ".input")
with open(filename,'w') as f_out :
config.write(f_out)
iel += 1
writeXML(root, filename)
+
def writeXML(xml_structure, filename):
# Make the output easier to follow for human readers
print("je rentre dans writeXML")
filename = os.path.splitext(filename)[0] + ".xml"
xmlstr = minidom.parseString(ET.tostring(xml_structure)).toprettyxml(indent=" ")
- print xmlstr
+ #print xmlstr
with open(filename,'w') as f_out :
f_out.write(xmlstr)
print("je sauvegarde les info dans " + filename)
+
def add_param(param_xml, root, ind=""):
param = ET.SubElement(root, "Parameter")
param.set("name", param_xml["Name" + ind])
value.set("sup", str(param_xml["Upper_bound" + ind]))
return param_xml
+
def add_exp(exp_xml, root, ind=""):
exp = ET.SubElement(root, "Experience")
exp.set("name", exp_xml["ExperienceName" + ind])
#elem.set("name", _name)
def run(listeParam):
+ print "on rentre dans run"
command_file=listeParam[0].fichier
command_file = comm2MAPinput(command_file)
- command = "map -r sappli run -n C_solver_constitutive_law0d -i " + command_file
+ command = "map -r sappli run -n c_solver_constitutive_law_0d -i " + command_file
+ print(command)
os.system(command)
print "calcul fini, youpi !"