From 6b290ead24cbe4897213068037162219b10e4e5b Mon Sep 17 00:00:00 2001 From: Pascale Noyret Date: Fri, 3 Dec 2010 16:39:41 +0000 Subject: [PATCH] pour pygmee . ok pour le python direct. a verifier pour YACS --- .../s_polymers_st_1_YACS_nodes.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py b/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py index bf027ca5..1eace526 100644 --- a/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py +++ b/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py @@ -7,9 +7,13 @@ try : except : pass -def component_pygmee_v2(rve_size, phase_number, sieve_curve_in, sieve_curve_out, repulsion_distance, study_name, study_path, file_result_inclusions, file_result_rve): +class component_pygmee_v2: + + def __init__(self,rve_size, phase_number, sieve_curve_in, sieve_curve_out, repulsion_distance, + study_name, study_path, file_result_inclusions, file_result_rve): print "pygmee_v2 for YACS - BEGIN" composant="pygmee_v2" + pygmee_v2_input = study_path+"/pygmee_v2_for_YACS.input" parameter=MAP_parameters() parameter.add_component(composant) parameter.add_parameter(composant, 'rve_size', rve_size) @@ -20,26 +24,25 @@ def component_pygmee_v2(rve_size, phase_number, sieve_curve_in, sieve_curve_out, parameter.add_parameter(composant, 'study_name', study_name) parameter.add_parameter(composant, 'file_result_inclusions', file_result_inclusions) parameter.add_parameter(composant, 'file_result_rve', file_result_rve) + parameter.write_for_shell(pygmee_v2_input) - pygmee_v2_input = study_path+"/pygmee_v2_for_YACS.input" - - commande=parameter.write_for_shell(pygmee_v2_input) - os.system(commande) - - commande= "cd /local/noyret/MAP/components/pygmee_v2/src;" + commponent_dir= os.path.join(os.getenv('MAP_DIRECTORY'),'components/pygmee_v2/src') + commande= "cd "+ commponent_dir +";" commande+= "python pygmee_v2.py -i "+pygmee_v2_input+";\n" os.system(commande) fd = open(file_result_rve, 'r') line=fd.readline() - line=fd.readline() - volume_fraction=float(line) - print "volume_fraction =", volume_fraction + self.volume_fraction=float(line) + print "volume_fraction =",self.volume_fraction fd.close() print "pygmee_v2 for YACS - END" - return volume_fraction + def __call__(self,rve_size, phase_number, sieve_curve_in, sieve_curve_out, repulsion_distance, + study_name, study_path, file_result_inclusions, file_result_rve): + + return self.volume_fraction def component_fdvgrid(lambda_I, lambda_M, rve_size, file_inclusions, finesse): print "fdvgrid for YACS - BEGIN" -- 2.39.2