From 76e3bc22cde18a5f9edebdb8509adf92017f69bb Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Thu, 20 Apr 2017 10:09:11 +0200 Subject: [PATCH] VirtualPolymer --- VirtualPolymer/Readme.tx | 1 - VirtualPolymer/VP_Cata_V1.py.equation | 260 -------------------------- VirtualPolymer/VP_Cata_V1.py.ok | 123 ------------ VirtualPolymer/toto_VP.py | 17 -- 4 files changed, 401 deletions(-) delete mode 100644 VirtualPolymer/Readme.tx delete mode 100644 VirtualPolymer/VP_Cata_V1.py.equation delete mode 100644 VirtualPolymer/VP_Cata_V1.py.ok delete mode 100644 VirtualPolymer/toto_VP.py diff --git a/VirtualPolymer/Readme.tx b/VirtualPolymer/Readme.tx deleted file mode 100644 index b3d7bd00..00000000 --- a/VirtualPolymer/Readme.tx +++ /dev/null @@ -1 +0,0 @@ -source opt/MAP/map-2016.1/share/map/scripts/envMAP.sh diff --git a/VirtualPolymer/VP_Cata_V1.py.equation b/VirtualPolymer/VP_Cata_V1.py.equation deleted file mode 100644 index 5296cdb0..00000000 --- a/VirtualPolymer/VP_Cata_V1.py.equation +++ /dev/null @@ -1,260 +0,0 @@ -# coding: utf-8 -import types -from Accas import * -import sys,os -sys.path.append('/home/A96028/opt/MAP/map-2016.1/lib/python2.7/site-packages/mapy/components/c_pre_polymer_data_management') -sys.path.append('/home/A96028/opt/MAP/map-2016.1/lib/python2.7/site-packages/mapy/virtual_polymer_common') -sys.path.append('/home/A96028/opt/MAP/map-2016.1/lib/python2.7/site-packages/') -import pckdb, class_data, instruction, equation_part, utils - - -class Tuple: - def __init__(self,ntuple): - self.ntuple=ntuple - - def __convert__(self,valeur): - if type(valeur) == types.StringType: return None - if len(valeur) != self.ntuple: return None - return valeur - - def info(self): - return "Tuple de %s elements" % self.ntuple - - __repr__=info - __str__=info - -#class ObjetUtilisateur(ASSD): pass - -class classeVisuEquation : - def __init__(self,dicoListeAffiche): - self.dicoListeAffiche=dicoListeAffiche - - -def maFunc(): - return ('a1','a2','a3') - -def maFuncWithArg(monMC): - if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return - monMC.dsMaFunct = True - - editor=monMC.jdc.editor - if monMC.valeur == 'POOH->P' : monInto=('a1','a2','a3') - else : monInto=('b1','b2','b3') - - change=editor.changeIntoDefMC('AGING', ('Equation', 'b_approved','b_type_creation','Equation_Modification','Type2'), monInto ) - if change : - print ('j ai change le into') - editor.reCalculeValiditeMCApresChgtInto('AGING', 'Type2', ('Equation', 'b_approved','b_type_creation','Equation_Modification')) - if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau() - - monMC.dsMaFunct = False - -def recupereDicoGenerique(monMC): - if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return - print ('je passe dans la recuperation') - editor=monMC.jdc.editor - valeurDB=editor.getValeur('Equation','Equation_DB',()) - print ('valeurDB',valeurDB) - correspond=pckdb.DBRENAME - if valeurDB != None : - listEquation, listModele,listePostTraitement=pckdb.read_pckdb(correspond[valeurDB]) - print (listEquation, listModele,listePostTraitement) - monMC.dsMaFunct = False - return listEquation, listModele,listePostTraitement - -def recupereDicoEquation(monMC): - if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return - listEquation, listModele,listePostTraitement=recupereDicoGenerique(monMC) - editor=monMC.jdc.editor - - valeurEquationListe=editor.getValeur('Equation','Equation_Liste',('b_type_show',)) - valeurAgingType=editor.getValeur('Equation','Equation_reaction',('b_type_show','b_reaction_type',)) - if valeurAgingType == None : - print ('dans reaction-type') - valeurAgingType=editor.getValeur('Equation','Equation_reaction',('b_type_show','b_aging_type',)) - if valeurAgingType == None : monMC.dsMaFunct = False; return - - print ('valeurType',valeurAgingType) - listeEquationPourIhm = [] - listeReprEquationPourIhm = [] - dicoListeAffiche={} - for equation in listEquation : - if valeurEquationListe == 'aging_type' : - if equation.type_vieil == valeurAgingType : - listeEquationPourIhm.append(equation) - listeReprEquationPourIhm.append(equation.representation) - dicoListeAffiche[equation.representation]=equation - else: - if equation.type_react == valeurAgingType : - listeEquationPourIhm.append(equation) - listeReprEquationPourIhm.append(equation.representation) - dicoListeAffiche[equation.representation]=equation - change=editor.changeIntoDefMC('Equation', ('b_type_show','ListeEquation'), listeReprEquationPourIhm ) - if change : - editor.reCalculeValiditeMCApresChgtInto('Equation', 'listeEquation', ('b_type_show',)) - if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau() - editor.maClasseVisuEquation = classeVisuEquation(dicoListeAffiche) - monMC.dsMaFunct = False - -def afficheValeurEquation(monMC): - if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return - editor=monMC.jdc.editor - valeur=monMC.valeur - if valeur == None : - monMC.dsMaFunct = False - return - print (editor.maClasseVisuEquation.dicoListeAffiche[valeur]) - print(str (editor.maClasseVisuEquation.dicoListeAffiche[valeur])) - editor.maClasseVisuEquation.valeurEquationChoisie=valeur - monMC.dsMaFunct = False - - -def instancieChemicalFormulation(monMC): - if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return - if monMC.valeur == False : return - - editor=monMC.jdc.editor - if hasattr(editor,'dsMaFunct') and editor.dsMaFunct== True : return - editor.dsMaFunct = True - - print ('ds instancie') - v=editor.maClasseVisuEquation.valeurEquationChoisie - monEquation=editor.maClasseVisuEquation.dicoListeAffiche[v] - type_react=monEquation.type_react - type_vieil=monEquation.type_vieil - print (v, type_react, type_vieil) - #editor.changeIntoMCandSet('Equation', ('b_type_show','b_modification','b_modif','ChemicalFormulation'),( v,),v ) - change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Reaction_Type'),type_react ) - change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Aging_Type'), type_vieil ) - - for index,valeurConstituant in enumerate(monEquation.constituants): - valeurEquation=monEquation.equation[index] - editor.ajoutMC(monMC.etape,'OptionnelConstituant',None,('b_type_show','b_modification','b_modif',)) - print (index,valeurConstituant,valeurEquation) - - #OptionnelConstituant = FACT ( statut = 'f',max = '**', - # Constituant = SIMP (statut = 'o', typ = 'TXM'), - # Differential_Equation = SIMP(statut= 'o',typ= 'TXM'), - for index,valeurConstituant in enumerate(monEquation.const_cine_nom): - valeurArrhe=monEquation.arrhenius[index] - if valeurArrhe : valeurConstanteType='Arrhenius type' - else : valeurConstanteType='non Arrhenius type' - - print (index,valeurConstituant,valeurConstanteType) - #OptionnelleConstante = FACT (statut = 'f', max = '**', - # ConstanteName= SIMP (statut = 'o', typ = 'TXM',), - # ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'), - change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Commentaire'),monEquation.comment ) - print (monEquation.comment ) - #if change : - if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau() - monMC.dsMaFunct = False - editor.dsMaFunct = False - - - -monDico= { 'Equation_Liste' : ('initiation', 'propagation', 'termination', 'stabilization')} - -JdC = JDC_CATA(code='VP', - execmodul=None, - ) - - - -#--------------------------------- -Equation = PROC (nom="Equation", - op=None, -#--------------------------------- - Equation_DB=SIMP(statut= 'o',typ= 'TXM', into=("Approved data base", "My data base") ), - Equation_Type = SIMP(statut= 'o',typ= 'TXM', into=("Show equation database", "Equation creation"),), - - -# --------------------------------------------------------------------------- - b_type_show = BLOC(condition = " Equation_Type == 'Show equation database'", -# --------------------------------------------------------------------------- - Equation_Liste=SIMP(statut= 'o',typ= 'TXM', into=('reaction_type','aging_type')), - - b_reaction_type = BLOC(condition = " Equation_Liste == 'reaction_type'", - Equation_reaction=SIMP(statut= 'o',typ= 'TXM', into=monDico['Equation_Liste'],siValide=recupereDicoEquation), - ), # Fin b_reaction_type - - b_aging_type = BLOC(condition = " Equation_Liste == 'aging_type'", - Equation_reaction=SIMP(statut= 'o',typ= 'TXM', into=('All', 'thermo', 'radio'),siValide=recupereDicoEquation), - ), # Fin b_reaction_type - - ListeEquation = SIMP(statut='o', typ='TXM', homo='SansOrdreNiDoublon',siValide=afficheValeurEquation), - b_modification = BLOC(condition = " ListeEquation != None ", - modification = SIMP(typ = bool, statut = 'o',defaut = False, fr='toto', ang='toto en anglais', siValide=instancieChemicalFormulation), - - b_modif = BLOC(condition = "modification == True", - Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'],), - Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max='**', homo='SansOrdreNiDoublon', into=('All', 'thermo', 'radio'),), - - OptionnelConstituant = FACT ( statut = 'f',max = '**', - Constituant = SIMP (statut = 'o', typ = 'TXM'), - Differential_Equation = SIMP(statut= 'o',typ= 'TXM'), - ), # fin Const_Equa - OptionnelleConstante = FACT (statut = 'f', max = '**', - ConstanteName= SIMP (statut = 'o', typ = 'TXM',), - ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'), - ),# fin ConstanteOptionnelle - Commentaire = SIMP (statut = 'f', typ = 'TXM', defaut = ' '), - - ),# fin b_modif - - ), # fin b_modification - ), # Fin b_type_show - - -# --------------------------------------------------------------------------- - b_type_creation = BLOC(condition = " Equation_Type == 'Equation creation'", -# --------------------------------------------------------------------------- - Equation_Modification = FACT ( statut = 'o', - - ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = 'POOH -> 2P'), - - Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'],), - Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max='**', homo='SansOrdreNiDoublon', into=('All', 'thermo', 'radio'),), - - Constituants = FACT ( statut = 'o', - ConstituantPOOH = SIMP (statut = 'f', typ = 'TXM', into = ('POOH',), defaut= 'POOH'), - b_pooh = BLOC(condition = " ConstituantPOOH == 'POOH'" , - Differential_Equation = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'), - ), # Fin b_pooh - ConstituantP = SIMP (statut = 'f', typ = 'TXM', into = ('P',),defaut='P'), - b_p = BLOC(condition = " ConstituantP == 'P'" , - Differential_Equation = SIMP(statut= 'o',typ= 'TXM', defaut = '2*ku1*POOH'), - ), # Fin b_p - OptionnelConstituant = FACT ( statut = 'f',max = '**', - Constituant = SIMP (statut = 'o', typ = 'TXM'), - Differential_Equation = SIMP(statut= 'o',typ= 'TXM'), - ), # fin Const_Equa - ),# Fin Constituants - - Constante = FACT ( statut = 'o', - Constanteku1 = SIMP (statut = 'f', typ = 'TXM', into = ('ku1',), defaut= 'ku1'), - b_cku1 = BLOC(condition = "Constanteku1 == 'ku1'" , - ConstanteType = SIMP(statut= 'o',typ= 'TXM', into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'), - ), - OptionnelleConstante = FACT (statut = 'f', max = '**', - ConstanteName= SIMP (statut = 'o', typ = 'TXM',), - ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'), - ),# fin ConstanteOptionnelle - ), # fin constante - Commentaire = SIMP (statut = 'f', typ = 'TXM', defaut = ' '), - - ), # Fin Equation_Modification - - #Chemical_Formulation = SIMP(statut= 'o',typ= 'TXM', defaut = 'POOH->P',siValide=maFuncWithArg), - #Type1 = SIMP(statut='o', typ = 'TXM', into=maFunc), - #Type2 = SIMP(statut='o', typ = 'TXM'), - - ), # fin b_type_creation - - -) # Fin Equation - -Modele = PROC (nom="Modele", - op=None, - Commentaire = SIMP (statut = 'f', typ = 'TXM'), -) # Fin Modele diff --git a/VirtualPolymer/VP_Cata_V1.py.ok b/VirtualPolymer/VP_Cata_V1.py.ok deleted file mode 100644 index 1e720678..00000000 --- a/VirtualPolymer/VP_Cata_V1.py.ok +++ /dev/null @@ -1,123 +0,0 @@ -# coding: utf-8 -import types -from Accas import * - - -class Tuple: - def __init__(self,ntuple): - self.ntuple=ntuple - - def __convert__(self,valeur): - if type(valeur) == types.StringType: return None - if len(valeur) != self.ntuple: return None - return valeur - - def info(self): - return "Tuple de %s elements" % self.ntuple - - __repr__=info - __str__=info - -#class ObjetUtilisateur(ASSD): pass - -def maFunc(): - return ('a1','a2','a3') - -def maFuncWithArg(monMC): - if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return - monMC.dsMaFunct = True - - editor=monMC.jdc.editor - if monMC.valeur == 'POOH->P' : monInto=('a1','a2','a3') - else : monInto=('b1','b2','b3') - - change=editor.changeIntoDefMC('AGING', ('Equation', 'b_approved','b_type_creation','Equation_Modification','Type2'), monInto ) - if change : - print ('j ai change le into') - editor.reCalculeValiditeMCApresChgtInto('AGING', 'Type2', ('Equation', 'b_approved','b_type_creation','Equation_Modification')) - if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau() - - monMC.dsMaFunct = False - - - -monDico= { 'Equation_Liste' : ('initiation', 'propagation', 'termination', 'stabilization')} - -JdC = JDC_CATA(code='VP', - execmodul=None, - ) - - -AGING = PROC (nom="AGING", - op=None, - -#--------------------------------- - Equation = FACT(statut= 'o', -#--------------------------------- - Equation_DB=SIMP(statut= 'o',typ= 'TXM', into=("Approved data base", "My data base") ), - Equation_Type = SIMP(statut= 'o',typ= 'TXM', into=("Show equation database", "Equation creation"),), - -# --------------------------------------------------------------------------- - b_type_show = BLOC(condition = " Equation_Type == 'Show equation database'", -# --------------------------------------------------------------------------- - Equation_Liste=SIMP(statut= 'o',typ= 'TXM', into=('reaction_type','aging_type')), - - b_reaction_type = BLOC(condition = " Equation_Liste == 'reaction_type'", - Equation_reaction=SIMP(statut= 'o',typ= 'TXM', into=monDico['Equation_Liste'],), - ), # Fin b_reaction_type - - b_aging_type = BLOC(condition = " Equation_Liste == 'aging_type'", - Equation_reaction=SIMP(statut= 'o',typ= 'TXM', into=('All', 'thermo', 'radio'),), - ), # Fin b_reaction_type - - ), # Fin b_type_show - -# --------------------------------------------------------------------------- - b_type_creation = BLOC(condition = " Equation_Type == 'Equation creation'", -# --------------------------------------------------------------------------- - Equation_Modification = FACT ( statut = 'o', - Chemical_Formulation = SIMP(statut= 'o',typ= 'TXM', defaut = 'POOH->P'), - Equation_reaction1=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'],), - Equation_reaction2=SIMP(statut= 'o',typ= 'TXM', min=1,max='**', homo='SansOrdreNiDoublon', into=('All', 'thermo', 'radio'),), - - Constituants = FACT ( statut = 'o', - ConstituantPOOH = SIMP (statut = 'f', typ = 'TXM', into = ('POOH',), defaut= 'POOH'), - b_pooh = BLOC(condition = " ConstituantPOOH == 'POOH'" , - Differential_Equation = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'), - ), # Fin b_pooh - ConstituantP = SIMP (statut = 'f', typ = 'TXM', into = ('P',),defaut='P'), - b_p = BLOC(condition = " ConstituantP == 'P'" , - Differential_Equation = SIMP(statut= 'o',typ= 'TXM', defaut = '2*ku1*POOH'), - ), # Fin b_p - OptionnelConstituant = FACT ( statut = 'f',max = '**', - Constituant = SIMP (statut = 'o', typ = 'TXM'), - Differential_Equation = SIMP(statut= 'o',typ= 'TXM'), - ), # fin Const_Equa - ),# Fin Constituants - - Constante = FACT ( statut = 'o', - Constanteku1 = SIMP (statut = 'f', typ = 'TXM', into = ('ku1',), defaut= 'ku1'), - b_cku1 = BLOC(condition = "Constanteku1 == 'ku1'" , - ConstanteType = SIMP(statut= 'o',typ= 'TXM', into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'), - ), - ConstanteOptionnelle = FACT (statut = 'f', max = '**', - ConstanteName= SIMP (statut = 'o', typ = 'TXM',), - ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'), - ),# fin ConstanteOptionnelle - ), # fin constante - Commentaire = SIMP (statut = 'f', typ = 'TXM'), - - ), # Fin Equation_Modification - - - #Chemical_Formulation = SIMP(statut= 'o',typ= 'TXM', defaut = 'POOH->P',siValide=maFuncWithArg), - #Type1 = SIMP(statut='o', typ = 'TXM', into=maFunc), - #Type2 = SIMP(statut='o', typ = 'TXM'), - - ), # fin b_type_creation - - - ), # Fin Equation -) - -TEXTE_NEW_JDC="AGING()" diff --git a/VirtualPolymer/toto_VP.py b/VirtualPolymer/toto_VP.py deleted file mode 100644 index 006f2a8c..00000000 --- a/VirtualPolymer/toto_VP.py +++ /dev/null @@ -1,17 +0,0 @@ -def model_saved(listeparam) : - editor=listeparam[0] - print (editor) - print (editor.process_VP()) - -# le dictionnaire des commandes a la structure suivante : -# la clef est la commande qui va proposer l action -# puis un tuple qui contient -# - la fonction a appeler -# - le label dans le menu du clic droit -# - un tuple contenant les parametres attendus par la fonction -# - appelable depuis Salome uniquement -) -# - appelable depuis un item valide uniquement -# - toolTip -dict_commandes={ - 'Equation':((model_saved,"model_saved",('editor','self'),False,True,""),), - } -- 2.39.2