From eaf6f961c4df5f133886e5aa6100c799f84eeaef Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Wed, 12 Dec 2018 12:18:19 +0100 Subject: [PATCH] la lecture du .comm remplit les objets pyxb --- Efi2Xsd/MCAccasXsd.py | 23 +++++++++++++++-------- Ihm/I_JDC.py | 2 +- Noyau/N_FACT.py | 18 +++++++++++++----- silvia/cata_DPD.py | 19 +++++++++---------- silvia/qtEficasDPD.py | 2 -- 5 files changed, 38 insertions(+), 26 deletions(-) diff --git a/Efi2Xsd/MCAccasXsd.py b/Efi2Xsd/MCAccasXsd.py index 69396bc9..d5b6c645 100755 --- a/Efi2Xsd/MCAccasXsd.py +++ b/Efi2Xsd/MCAccasXsd.py @@ -2,6 +2,8 @@ # -*- coding: utf-8 -*- import sys,os import traceback +def trace(): + traceback.print_stack() #import raw.efficas as efficas import types @@ -23,27 +25,33 @@ class X_OBJECT: print ('----------- delObjPyxb', self.nom) trouve = False listeArg=[] + print self.perePyxb.nom + print self.perePyxb.objPyxb.orderedContent() + + print (dir(self.perePyxb.objPyxb)) for i in self.perePyxb.objPyxb.orderedContent(): if id(self.objPyxb) == id(i._Content__value) : trouve = True ;continue + print ('j ajoute', i._Content__value) listeArg.append(i._Content__value) if not trouve : print ('objet pas trouve') grandPere=self.perePyxb.perePyxb ancienObjPerePyxb=self.perePyxb.objPyxb - #print (listeArg) + print (listeArg) nvlObjPerePyxb=self.perePyxb.maClasseModeleMetier(*listeArg) - #print (nvlObjPerePyxb) + print (nvlObjPerePyxb) + print (nvlObjPerePyxb.orderedContent()) self.perePyxb.objPyxb=nvlObjPerePyxb self.perePyxb.objPyxb.objAccas=ancienObjPerePyxb.objAccas - #print (self.nom, ' a pour gp ', grandPere) + print (self.nom, ' a pour gp ', grandPere) if grandPere : grandPere.reconstruitAvecNvlObj(ancienObjPerePyxb,nvlObjPerePyxb) - #print ('----------- fin delObjPyxb', self.nom) + print ('----------- fin delObjPyxb', self.nom) def addObjPyxb(self,indiceDansLeContenu): if not self.cata.modeleMetier : return - print ('**********************************************') - print ('_____________ addObjPyxb ds X_OBJECT', self.nom, indiceDansLeContenu) + #print ('**********************************************') + #print ('_____________ addObjPyxb ds X_OBJECT', self.nom, indiceDansLeContenu) # adherence Accas sur le parent parent=self.parent while (parent.isBLOC()): parent=parent.parent @@ -78,7 +86,7 @@ class X_OBJECT: def reconstruitAvecNvlObj(self, ancienObj,nvlObj): if not self.cata.modeleMetier : return - #print ('reconstruitAvecNvlObj pour', self, self.nom, ancienObj,nvlObj) + print ('reconstruitAvecNvlObj pour', self, self.nom, ancienObj,nvlObj) listeArg=[] for i in self.objPyxb.orderedContent(): if id(ancienObj) == id(i._Content__value) : listeArg.append(nvlObj) @@ -338,7 +346,6 @@ class X_JDC (X_MCCOMPO): # print(e.details()) def toXml(self): - print ('***************',self.objPyxb,'***************',) if not self.cata.modeleMetier : return print ('***************',self.objPyxb,'***************',) print ('***************',self,'***************',) diff --git a/Ihm/I_JDC.py b/Ihm/I_JDC.py index 47fa2a7e..d86c4b7c 100644 --- a/Ihm/I_JDC.py +++ b/Ihm/I_JDC.py @@ -441,7 +441,7 @@ class JDC(I_OBJECT.OBJECT): #if actif == 0 and etape.nom in ['DEBUT','POURSUITE']:actif=1 #if actif == 1: etape.active() - #self.enregistreEtapePyxb(etape) + self.enregistreEtapePyxb(etape) #else: # etape.inactive() #if etape.nom == 'FIN':actif=-1 diff --git a/Noyau/N_FACT.py b/Noyau/N_FACT.py index 6de7e404..7c086a5a 100644 --- a/Noyau/N_FACT.py +++ b/Noyau/N_FACT.py @@ -133,8 +133,12 @@ class FACT(N_ENTITE.ENTITE): indice=0 for v in val: if type(v) == dict or isinstance(v, _F): - objet = self.class_instance( - nom=nom, definition=self, val=v, parent=parent,dicoPyxbDeConstruction=dicoPyxbDeConstruction[indice]) + if dicoPyxbDeConstruction : + objet = self.class_instance( + nom=nom, definition=self, val=v, parent=parent,dicoPyxbDeConstruction=dicoPyxbDeConstruction[indice]) + else : + objet = self.class_instance( + nom=nom, definition=self, val=v, parent=parent,dicoPyxbDeConstruction=None) indice=indice+1 l.append(objet) elif isinstance(v, self.class_instance): @@ -144,9 +148,13 @@ class FACT(N_ENTITE.ENTITE): else: l.append(N_OBJECT.ErrorObj(self, v, parent, nom)) elif type(val) == dict or isinstance(val, _F): - objet = self.class_instance( - nom=nom, definition=self, val=val, parent=parent,dicoPyxbDeConstruction=dicoPyxbDeConstruction) - l.append(objet) + if dicoPyxbDeConstruction : + objet = self.class_instance( + nom=nom, definition=self, val=val, parent=parent,dicoPyxbDeConstruction=dicoPyxbDeConstruction) + else : + objet = self.class_instance( + nom=nom, definition=self, val=val, parent=parent,dicoPyxbDeConstruction=None) + l.append(objet) elif isinstance(val, self.class_instance): # idem --> quand passe t on la l.append(val) diff --git a/silvia/cata_DPD.py b/silvia/cata_DPD.py index f7e1d9c3..ac78c07a 100644 --- a/silvia/cata_DPD.py +++ b/silvia/cata_DPD.py @@ -59,7 +59,6 @@ DPD_Input = PROC(nom = 'DPD_Input', ensemble = SIMP(statut='o', typ='TXM', defaut='nvt', into=['nvt','nve']), integrator_type = SIMP(statut='o', typ='TXM', defaut='mdvv', into=['mdvv','others to be define']), - electrostatics_is_on = SIMP(statut='o', typ=bool, defaut=False), #simulation_box_sizes= SIMP(statut ='o', typ=Tuple(3),validators=VerifTypeTuple(('R','R','R')),), computational_boundary_conditions = SIMP(statut='o',typ='TXM',min=3,max=3, into=['periodic','reflective'],), number_of_species = SIMP(statut='o', typ='I', defaut=1, val_min=1), @@ -85,16 +84,17 @@ DPD_Input = PROC(nom = 'DPD_Input', species_name=SIMP(statut='o',typ='TXM'), species_mass=SIMP(statut='o',typ='R',defaut=1.0), # todoPascale -> essayer de faire un global - #b_electrostatics_is_on = BLOC( condition= "electrostatics_is_on == True", - # species_electric_charge=SIMP(statut='o',typ='R',defaut=0.0), - #), # fin du bloc b_electrostatics_is_on - species_electric_charge=SIMP(statut='o',typ='R',defaut=0.0), + electrostatics_is_on = SIMP(statut='o', typ=bool, defaut=False), + b_electrostatics_is_on = BLOC( condition= "electrostatics_is_on == True", + species_electric_charge=SIMP(statut='o',typ='R',defaut=0.0), + ), # fin du bloc b_electrostatics_is_on species_is_frozen = SIMP(statut='f', typ=bool,), species_population = SIMP(statut='o', typ='R', val_min=0.0), # todo --> verificateur de PROC : la somme des species_population doit etre au minimun 1 ),# fin du fact species_parameters species_pair_parameters = FACT(statut='o', max="**", #pair_identification= SIMP(statut ='o', typ=Tuple(2),validators=VerifTypeTuple(('TXM','TXM')),), + pair_identification= SIMP(statut ='o', max=2, typ = 'TXM'), species_pair_parameters_potential_type=SIMP(statut='o', typ='TXM',into=['groot_warren','lennard_jones']), b_parameters_potential_type_groot_warren= BLOC(condition= "species_pair_parameters_potential_type == 'groot_warren'", groot_warren_repulsion=SIMP(statut='o',typ='R',defaut=25.0,val_min=0), @@ -103,7 +103,7 @@ DPD_Input = PROC(nom = 'DPD_Input', ),# fin du fact species_pair_parameters ) -trajectory_output_setting = PROC(nom = 'trajectory_output_setting', +Trajectory_output_setting = PROC(nom = 'Trajectory_output_setting', trajectory_output = SIMP(statut='o', typ=bool, defaut=False), b_trajectory_output_true= BLOC(condition= "trajectory_output == True", trajectory_first_name=SIMP(statut='o',typ='I', val_min=1), @@ -112,12 +112,11 @@ trajectory_output_setting = PROC(nom = 'trajectory_output_setting', ),# fin du bloc b_trajectory_output_true ) -thermodynamic_sampling = PROC(nom = 'thermodynamic_sampling', - number_of_steps_between_thermodynamics_samplings=SIMP(statut='o',typ='I',defaut=200,val_min=1), +Thermodynamic_sampling = PROC(nom = 'Thermodynamic_sampling', + number_of_steps_between_thermodynamics_samplings=SIMP(statut='f',typ='I',defaut=200,val_min=1), ) -TEXTE_NEW_JDC = 'Solver_Input();DPD_Input();trajectory_output_setting()' - +#TEXTE_NEW_JDC = 'Solver_Input();DPD_Input();trajectory_output_setting()' diff --git a/silvia/qtEficasDPD.py b/silvia/qtEficasDPD.py index 91140d97..49a3f538 100755 --- a/silvia/qtEficasDPD.py +++ b/silvia/qtEficasDPD.py @@ -28,8 +28,6 @@ name='prefs_'+prefs.code __import__(name) import sys -reload(sys) -sys.setdefaultencoding('latin1') import os sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) -- 2.39.2