]> SALOME platform Git repositories - tools/eficas.git/blob - VirtualPolymer/lienDB.py
Salome HOME
sauvegarde du 21 04
[tools/eficas.git] / VirtualPolymer / lienDB.py
1 # coding: utf-8\r
2 import types\r
3 import sys,os\r
4 \r
5 import listesDB\r
6 \r
7 \r
8 maClasseDelistesDB = listesDB.classeListesDB()\r
9 monModele=listesDB.sModele().monModele\r
10 \r
11 \r
12 # --------------------------------------\r
13 # Fonctions appellees depuis le catalogue\r
14 # --------------------------------------\r
15  \r
16 # --------------------------------------\r
17 # Dans Equation\r
18 # --------------------------------------\r
19 \r
20 def recupereDicoEquation(monMC):\r
21     # Equation_reaction (ds 2 blocs)\r
22     #  ou dans Equation b_type_show b_reaction_type\r
23     #  ou dans Equation b_type_show b_aging_type\r
24 \r
25     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
26     editor=monMC.jdc.editor\r
27 \r
28     valeurDB=editor.getValeur('Equation','Equation_DB',())\r
29     maClasseDelistesDB.metAJour(valeurDB)\r
30     listEquation=maClasseDelistesDB.getListEquation()\r
31 \r
32     valeurEquationListe=editor.getValeur('Equation','Equation_Liste',('b_type_show',))\r
33     valeurAgingType=editor.getValeur('Equation','Equation_reaction',('b_type_show','b_reaction_type',))\r
34     if valeurAgingType == None :\r
35        valeurAgingType=editor.getValeur('Equation','Equation_reaction',('b_type_show','b_aging_type',))\r
36     if valeurAgingType == None : monMC.dsMaFunct = False; return\r
37 \r
38     listeEquationPourIhm = []\r
39     listeReprEquationPourIhm = []\r
40     dicoListAffiche = {}\r
41    \r
42     for equation in listEquation :\r
43         if valeurEquationListe == 'aging_type' :\r
44            if equation.type_vieil == valeurAgingType : \r
45               listeEquationPourIhm.append(equation)\r
46               listeReprEquationPourIhm.append(equation.representation)\r
47               dicoListAffiche[equation.representation]=equation\r
48         else:\r
49            if equation.type_react == valeurAgingType : \r
50               listeEquationPourIhm.append(equation)\r
51               listeReprEquationPourIhm.append(equation.representation)\r
52               dicoListAffiche[equation.representation]=equation\r
53     maClasseDelistesDB.dicoListAffiche = dicoListAffiche\r
54 \r
55     change=editor.changeIntoDefMC('Equation', ('b_type_show','ListeEquation'), listeReprEquationPourIhm )\r
56     if change :\r
57        editor.reCalculeValiditeMCApresChgtInto('Equation', 'listeEquation', ('b_type_show',)) \r
58        if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()\r
59     monMC.dsMaFunct = False\r
60 \r
61 def afficheValeurEquation(monMC):\r
62     # Equation b_modification modification\r
63     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
64     valeur=monMC.valeur\r
65     if valeur == None : return\r
66     maClasseDelistesDB.valeurEquationChoisie=str(valeur)\r
67     monEquation=maClasseDelistesDB.dicoListAffiche[str(valeur)]\r
68 \r
69     aAfficher='jkljkljk \n je ne sais plus \njfkqsljqfkl\nkfsjqklfjkl\n'\r
70     editor=monMC.jdc.editor\r
71     editor._viewText(aAfficher, "Rapport",largeur=30,hauteur=150)\r
72     \r
73     monMC.dsMaFunct = False\r
74               \r
75 \r
76 def instancieChemicalFormulation(monMC):\r
77     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
78     if monMC.valeur == False : return\r
79 \r
80     editor=monMC.jdc.editor\r
81     if hasattr(editor,'dsMaFunct') and editor.dsMaFunct== True : return\r
82     editor.dsMaFunct = True\r
83 \r
84     print ('ds instancie')\r
85     v=maClasseDelistesDB.valeurEquationChoisie\r
86     monEquation=maClasseDelistesDB.dicoListAffiche[v]\r
87     type_react=monEquation.type_react\r
88     type_vieil=monEquation.type_vieil\r
89 \r
90     editor.changeIntoMCandSet('Equation', ('b_type_show','b_modification','b_modif','ChemicalFormulation'),( v,),v )\r
91     return\r
92     #change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Reaction_Type'),type_react )\r
93     change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Aging_Type'), type_vieil )\r
94 \r
95     for index,valeurConstituant in enumerate(monEquation.constituants):\r
96         valeurEquation=monEquation.equation[index] \r
97         editor.ajoutMC(monMC.etape,'OptionnelConstituant',None,('b_type_show','b_modification','b_modif',))\r
98         print (index,valeurConstituant,valeurEquation)\r
99 \r
100             #OptionnelConstituant =  FACT ( statut = 'f',max = '**',\r
101             #    Constituant = SIMP (statut = 'o', typ = 'TXM'),\r
102             #    Differential_Equation =  SIMP(statut= 'o',typ= 'TXM'),\r
103 \r
104     for index,valeurConstituant in enumerate(monEquation.const_cine_nom):\r
105          valeurArrhe=monEquation.arrhenius[index] \r
106          if valeurArrhe : valeurConstanteType='Arrhenius type'\r
107          else           : valeurConstanteType='non Arrhenius type'\r
108          print (index,valeurConstituant,valeurConstanteType)\r
109             #OptionnelleConstante  = FACT (statut = 'f', max = '**',\r
110             #     ConstanteName= SIMP (statut = 'o', typ = 'TXM',),\r
111             #    ConstanteType =  SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'),\r
112 \r
113     change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Commentaire'),monEquation.comment )\r
114     print (monEquation.comment )\r
115     if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()\r
116 \r
117     monMC.dsMaFunct = False\r
118     editor.dsMaFunct = False\r
119  \r
120 # TEMPORAIRE \r
121 # TODO TODO TODO\r
122 # PNPNPNPNPN\r
123 \r
124 \r
125 \r
126 def recupereDicoModele(monMC):\r
127     if monMC.valeur == None: return\r
128     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
129     print ('je passe dans recupereDicoModele')\r
130     listEquation, listModele,listPostTraitement=recupereDicoGenerique(monMC)\r
131     editor=monMC.jdc.editor\r
132     editor.maClasseVisuEquation = classeVisuEquation({},listEquation, listModele,listPostTraitement)\r
133     monMC.dsMaFunct = False\r
134 \r
135 \r
136 def creeListeEquation(monMC):\r
137     if monMC.valeur == None: return\r
138     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
139 \r
140     editor=monMC.jdc.editor\r
141 # TEMPORAIRE \r
142 # TODO TODO TODO\r
143     listeEquationsAAfficher=[]\r
144     listeConstantesAAfficher=[]\r
145     for index,equation in enumerate( editor.maClasseVisuEquation.listEquation):\r
146         if index in monModele.equa:\r
147             listeEquationsAAfficher.append(equation.representation)\r
148             listeConstantesAAfficher.append(equation.const_cine_nom)\r
149 \r
150     monMC.dsMaFunct = False\r
151 \r
152   #        listeEquation_stabilization=SIMP(statut='o', homo='SansOrdreNiDoublon', max='**', min=0 ),\r
153 \r
154 def recupereModeleEquation(monMC):\r
155     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
156     if monMC.valeur==False : return\r
157     editor=monMC.jdc.editor\r
158     if hasattr(editor,'dsMaFunct') and editor.dsMaFunct== True : return\r
159 \r
160     editor.dsMaFunct = True\r
161     dicoListeEquationAAfficher={}\r
162 \r
163     for valeurReactionType in monDico['Equation_Liste']:\r
164       dicoListeEquationAAfficher[valeurReactionType] = [] \r
165       for index,equation in enumerate( editor.maClasseVisuEquation.listEquation):\r
166         if equation.type_react==valeurReactionType : \r
167            dicoListeEquationAAfficher[valeurReactionType].append(equation.representation)\r
168     print (dicoListeEquationAAfficher)\r
169        \r
170     change=editor.changeIntoDefMC('Modele', ('b_type_creation','b_ajout_equation','listeEquation_initiation'),dicoListeEquationAAfficher['initiation'] )\r
171     change=editor.changeIntoDefMC('Modele', ('b_type_creation','b_ajout_equation','listeEquation_propagation'),dicoListeEquationAAfficher['propagation'] )\r
172     change=editor.changeIntoDefMC('Modele', ('b_type_creation','b_ajout_equation','listeEquation_termination'),dicoListeEquationAAfficher['termination'] )\r
173     change=editor.changeIntoDefMC('Modele', ('b_type_creation','b_ajout_equation','listeEquation_stabilization'),dicoListeEquationAAfficher['stabilization'] )\r
174     if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()\r
175     editor.dsMaFunct = False\r
176 \r
177 def prepareDiffusion(monMC):\r
178     print ('je suis dans prepareDiffusion')\r
179     if monMC.valeur==False : return\r
180     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
181     monMC.dsMaFunct=True\r
182     editor=monMC.jdc.editor\r
183     if hasattr(editor,'dsMaFunct') and editor.dsMaFunct== True : return\r
184     editor.dsMaFunct = True\r
185     editor.dicoCoefS={}\r
186     editor.dicoCoefD={}\r
187     for c in monModele.coef[0].keys() :\r
188         if c[0]=='S':\r
189            clef=c[1:]\r
190            valeur= monModele.coef[0][c]\r
191            editor.dicoCoefS[clef]=valeur\r
192         if c[0]=='D':\r
193            clef=c[1:]\r
194            valeur= monModele.coef[0][c]\r
195            editor.dicoCoefD[clef]=valeur\r
196     print (editor.dicoCoefS,editor.dicoCoefD)\r
197     monMC.dsMaFunct=False\r
198     editor.dsMaFunct = False\r
199 \r
200 \r
201 def ajouteDiffusion(monMC):\r
202     print ('je suis dans ajouteDiffusion')\r
203     if monMC.valeur == None : return\r
204     print (monMC.valeur)\r
205     if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return\r
206     monMC.dsMaFunct=True\r
207     editor=monMC.jdc.editor\r
208     if hasattr(editor,'dsMaFunct') and editor.dsMaFunct== True : return\r
209     editor.dsMaFunct = True\r
210 \r
211 \r
212     for v in monMC.valeur :\r
213         print (v)\r
214         mesValeurs=editor.dicoCoefS[v]\r
215         print (editor.dicoCoefS)\r
216         print (mesValeurs) \r
217         MCFils='S'+v\r
218         for e in monMC.jdc.etapes:\r
219             if e.nom == Modele :break\r
220 \r
221         print (e)\r
222         editor.ajoutDefinitionMC(e,('b_type_creation','b_diffusion'),MCFils,typ='TXM',statut='o' )\r
223         print ('ggggg')\r
224         editor.ajoutMC(e,MCFils,mesValeurs,('b_type_creation','b_diffusion',))\r
225         print ('______')\r
226     if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()\r
227     monMC.dsMaFunct=False\r
228     editor.dsMaFunct = False\r
229 \r