From: PASCALE NOYRET Date: Fri, 8 Dec 2023 08:08:32 +0000 (+0100) Subject: changement de place des morceaux morts X-Git-Tag: avantLeRenommagePourEric~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0d64edd729ec67bb39f967e1c99cbf736a46f7aa;p=tools%2Feficas.git changement de place des morceaux morts --- diff --git a/Codes/ReacteurNumerique/qtEficasReacteurNumerique.py b/Codes/ReacteurNumerique/qtEficasReacteurNumerique.py index 4fcb6536..19d451aa 100755 --- a/Codes/ReacteurNumerique/qtEficasReacteurNumerique.py +++ b/Codes/ReacteurNumerique/qtEficasReacteurNumerique.py @@ -28,7 +28,8 @@ name='prefs_'+prefs.code __import__(name) import os, sys -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) + +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..','..')) import prefs from InterfaceQT4 import eficas_go diff --git a/Editeur/TroisDPal.py b/Editeur/TroisDPal.py deleted file mode 100644 index 561ff1c7..00000000 --- a/Editeur/TroisDPal.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -""" - Ce module contient la classe 3Dpilote qui va creer les ordres - de pilotage de l idl PAL pour un element de structure -""" -from __future__ import absolute_import -from __future__ import print_function -try : - from builtins import object -except : - pass -import generator -from Extensions.i18n import tr - -class TroisDPilote(object): - - def __init__(self,node,appliEficas): - self.node=node - self.appliEficas=appliEficas - - def envoievisu(self): - """ - """ - format="vers3DSalome" - if format in generator.plugins : - # Le generateur existe on l'utilise - g=generator.plugins[format]() - g.initJdc(self.node.getJdc()) - texte=g.gener(self.node) - else: - print ("Le generateur n'a pas ete trouve") - print ("Erreur ! Erreur!") - return "" - from Extensions.param2 import originalMath - originalMath.toOriginal() - self.appliEficas.envoievisu(texte) - originalMath.toSurcharge() diff --git a/Editeur/basestyle.py b/Editeur/basestyle.py deleted file mode 100644 index 65fc785c..00000000 --- a/Editeur/basestyle.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -try : - from builtins import object -except : pass - -class STYLE(object): - background='gray90' - foreground='black' - entry_background='white' - list_background='white' - list_select_background='#00008b' - list_select_foreground='grey' - tooltip_background="yellow" - - standard = ("Helvetica",12) - standard_italique = ("Helvetica",12,'italic') - standard_gras = ("Helvetica",12,'bold') - standard_gras_souligne = ("Helvetica",12,'bold','underline') - - canvas = ('Helvetica',10) - canvas_italique = ('Helvetica',10,'italic') - canvas_gras = ("Helvetica",10,'bold') - canvas_gras_italique = ("Helvetica",12,'bold','italic') - - standard12 = ("Helvetica",14) - standard12_gras = ("Helvetica",14,'bold') - standard12_gras_italique = ( "Helvetica",14,'bold','italic') - - standardcourier10 = ("Courier",14) - statusfont = ("Helvetica",16) - -style=STYLE() diff --git a/Editeur/chercheBlocInto.py b/Editeur/chercheBlocInto.py deleted file mode 100755 index 3349c1a1..00000000 --- a/Editeur/chercheBlocInto.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import sys,os -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4')) -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4')) -from Extensions.i18n import tr -from string import split,strip,lowercase,uppercase -import re,string -import Accas - - -class ChercheInto: - def __init__(self,cata,cataName): - self.cata=cata - self.dictInto={} - mesCommandes=self.cata.JdC.commandes - for maCommande in mesCommandes: - self.construitListeInto(maCommande) - - - def construitListeInto(self,e): - if isinstance(e,Accas.A_BLOC.BLOC) : - print (e.condition) - for nomFils, fils in e.entites.items(): - self.construitListeInto(fils) - - -if __name__ == "__main__" : - #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" - #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py" - #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" - #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" - code="Aster" - version=None - - from Editeur import session - options=session.parse(sys.argv) - if options.code!= None : code=options.code - if options.cata!= None : monCata=options.cata - if options.ssCode!= None : ssCode=options.ssCode - - sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code)) - - from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm - Eficas=appliEficasSSIhm(code=code) - parent=QWParentSSIhm(code,Eficas,version) - - import readercata - monreadercata = readercata.READERCATA( parent, parent ) - Eficas.readercata=monreadercata - monCata=monreadercata.cata - - monConstruitInto=ChercheInto(monCata,code) diff --git a/Editeur/chercheNbElem.py b/Editeur/chercheNbElem.py deleted file mode 100755 index 23890331..00000000 --- a/Editeur/chercheNbElem.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -import sys,os -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4')) -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4')) -from Extensions.i18n import tr -from string import split,strip,lowercase,uppercase -import re,string -import Accas - - -class ChercheInto: - def __init__(self,cata,cataName): - self.cata=cata - self.dictInto={} - mesCommandes=self.cata.JdC.commandes - for maCommande in mesCommandes: - print (maCommande.nom) - print (maCommande.entites ) - print (len(maCommande.entites) ) - - -# def construitListeInto(self,e): -# if isinstance(e,Accas.A_BLOC.BLOC) : -# print (e.condition. -# for nomFils, fils in e.entites.items(): -# self.construitListeInto(fils) - - -if __name__ == "__main__" : - #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" - #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py" - #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" - monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" - code="MAP" - version=None - - from Editeur import session - options=session.parse(sys.argv) - if options.code!= None : code=options.code - if options.cata!= None : monCata=options.cata - if options.ssCode!= None : ssCode=options.ssCode - - sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code)) - - from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm - Eficas=appliEficasSSIhm(code=code) - parent=QWParentSSIhm(code,Eficas,version) - - import readercata - monreadercata = readercata.READERCATA( parent, parent ) - Eficas.readercata=monreadercata - monCata=monreadercata.cata - - monConstruitInto=ChercheInto(monCata,code) diff --git a/Editeur/faqs.txt b/Editeur/faqs.txt deleted file mode 100755 index b087c34e..00000000 --- a/Editeur/faqs.txt +++ /dev/null @@ -1,46 +0,0 @@ - -------------------------------------------------------------------------------------------------------------- - FAQs et Limitations d'EFICAS -------------------------------------------------------------------------------------------------------------- - - -1. Mots réservés : - - Tous les mots du langage Python sont des mots réservés. - On ne peut donc pas appeler une variable ou un concept 'fin' ou 'dir' - Pour la liste complète de ces mots-clés, veuillez vous référer à la - documentation Python - -2. Concepts réentrants : - - Ne pas indiquer par un '&' devant son nom qu'un concept est utilisé comme - concept réentrant. En effet EFICAS le sait ! - -3. Carte commentaire : - - La carte commentaire est désormais le '#' (dièse) au lieu du '%' (pourcent) - Les commentaires sont gérés comme des objets de même niveau que les - commandes ; il n'est plus possible de placer des commentaires "dans" - une commande. Attention, lors de la traduction d'un fichier de version 5 - en 6, les commentaires "dans" les commandes seront perdus. - -4. Nommer le concept produit par un opérateur : - - Vous ne pouvez nommer le concept produit d'un opérateur que lorsque - celui-ci aura été entièrement et correctement rempli. - -5. Règle de rémanence dans les mots-clés facteurs répétés : - - La règle de rémanence qui permettait pour certains mots-clés facteurs - et pour certains de leurs mots-clés simples de ne pas répeter la valeur - de ces derniers dans toutes les occurrences du mot-clé facteur n'est pas - connue d'EFICAS. - En conséquence, vous devez répéter les mots-clés simples concernés dans - toutes les occurrences des mots-clés facteurs. - -6. Besoin d'aide ? - - La documentation d'utilisation d'EFICAS a pris un peu de retard sur le produit ... - Néanmoins, vous disposez sur la plupart des panneaux contextuels ( les panneaux à - droite de l'arbre) d'une aide en ligne que vous pouvez activer en maintenant le - bouton droit de votre souris enfoncé. diff --git a/Editeur/fontes.py b/Editeur/fontes.py deleted file mode 100644 index ab0c8b8d..00000000 --- a/Editeur/fontes.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -standard = ("Times",10) -standard_italique = ("Times",10,'italic') -standard_gras = ("Times",10,'bold') -standard_gras_souligne = ("Times",10,'bold','underline') - -canvas = ('times',8) -canvas_italique = ('times',8,'italic') -canvas_gras = ("Times",8,'bold') -canvas_gras_italique = ("Times",10,'bold','italic') - -standard12 = ("Times",12) -standard12_gras = ("Times",12,'bold') -standard12_gras_italique = ( "times",12,'bold','italic') - -standardcourier10 = ("Courier",10) diff --git a/Editeur/import_code.py b/Editeur/import_code.py deleted file mode 100644 index c9295e84..00000000 --- a/Editeur/import_code.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -""" - Ce module realise toutes les mises a jour du chemin pour - les imports de modules Python -""" -from __future__ import absolute_import -import sys -import os - -import prefs -name='prefs_'+prefs.code -prefs_Code=__import__(name) -INSTALLDIR=prefs_Code.INSTALLDIR - -# Ce chemin permet d'importer les modules Noyau et Validation -# representant le code utilise (si fourni) -# Ensuite on utilise les packages de l'intallation -if hasattr(prefs_Code,'CODE_PATH'): - if prefs_Code.CODE_PATH: - sys.path[:0]=[prefs_Code.CODE_PATH] - import Noyau,Validation - del sys.path[0] -sys.path[:0]=[prefs_Code.INSTALLDIR] - -import Accas diff --git a/Editeur/old/Structure/chercheBlocInto.py b/Editeur/old/Structure/chercheBlocInto.py new file mode 100755 index 00000000..3349c1a1 --- /dev/null +++ b/Editeur/old/Structure/chercheBlocInto.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import sys,os +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4')) +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4')) +from Extensions.i18n import tr +from string import split,strip,lowercase,uppercase +import re,string +import Accas + + +class ChercheInto: + def __init__(self,cata,cataName): + self.cata=cata + self.dictInto={} + mesCommandes=self.cata.JdC.commandes + for maCommande in mesCommandes: + self.construitListeInto(maCommande) + + + def construitListeInto(self,e): + if isinstance(e,Accas.A_BLOC.BLOC) : + print (e.condition) + for nomFils, fils in e.entites.items(): + self.construitListeInto(fils) + + +if __name__ == "__main__" : + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py" + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + code="Aster" + version=None + + from Editeur import session + options=session.parse(sys.argv) + if options.code!= None : code=options.code + if options.cata!= None : monCata=options.cata + if options.ssCode!= None : ssCode=options.ssCode + + sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code)) + + from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm + Eficas=appliEficasSSIhm(code=code) + parent=QWParentSSIhm(code,Eficas,version) + + import readercata + monreadercata = readercata.READERCATA( parent, parent ) + Eficas.readercata=monreadercata + monCata=monreadercata.cata + + monConstruitInto=ChercheInto(monCata,code) diff --git a/Editeur/old/Structure/chercheNbElem.py b/Editeur/old/Structure/chercheNbElem.py new file mode 100755 index 00000000..23890331 --- /dev/null +++ b/Editeur/old/Structure/chercheNbElem.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import sys,os +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4')) +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4')) +from Extensions.i18n import tr +from string import split,strip,lowercase,uppercase +import re,string +import Accas + + +class ChercheInto: + def __init__(self,cata,cataName): + self.cata=cata + self.dictInto={} + mesCommandes=self.cata.JdC.commandes + for maCommande in mesCommandes: + print (maCommande.nom) + print (maCommande.entites ) + print (len(maCommande.entites) ) + + +# def construitListeInto(self,e): +# if isinstance(e,Accas.A_BLOC.BLOC) : +# print (e.condition. +# for nomFils, fils in e.entites.items(): +# self.construitListeInto(fils) + + +if __name__ == "__main__" : + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py" + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + code="MAP" + version=None + + from Editeur import session + options=session.parse(sys.argv) + if options.code!= None : code=options.code + if options.cata!= None : monCata=options.cata + if options.ssCode!= None : ssCode=options.ssCode + + sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code)) + + from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm + Eficas=appliEficasSSIhm(code=code) + parent=QWParentSSIhm(code,Eficas,version) + + import readercata + monreadercata = readercata.READERCATA( parent, parent ) + Eficas.readercata=monreadercata + monCata=monreadercata.cata + + monConstruitInto=ChercheInto(monCata,code) diff --git a/Editeur/old/TroisDPal.py b/Editeur/old/TroisDPal.py new file mode 100644 index 00000000..561ff1c7 --- /dev/null +++ b/Editeur/old/TroisDPal.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module contient la classe 3Dpilote qui va creer les ordres + de pilotage de l idl PAL pour un element de structure +""" +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import object +except : + pass +import generator +from Extensions.i18n import tr + +class TroisDPilote(object): + + def __init__(self,node,appliEficas): + self.node=node + self.appliEficas=appliEficas + + def envoievisu(self): + """ + """ + format="vers3DSalome" + if format in generator.plugins : + # Le generateur existe on l'utilise + g=generator.plugins[format]() + g.initJdc(self.node.getJdc()) + texte=g.gener(self.node) + else: + print ("Le generateur n'a pas ete trouve") + print ("Erreur ! Erreur!") + return "" + from Extensions.param2 import originalMath + originalMath.toOriginal() + self.appliEficas.envoievisu(texte) + originalMath.toSurcharge() diff --git a/Editeur/old/basestyle.py b/Editeur/old/basestyle.py new file mode 100644 index 00000000..65fc785c --- /dev/null +++ b/Editeur/old/basestyle.py @@ -0,0 +1,49 @@ +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +try : + from builtins import object +except : pass + +class STYLE(object): + background='gray90' + foreground='black' + entry_background='white' + list_background='white' + list_select_background='#00008b' + list_select_foreground='grey' + tooltip_background="yellow" + + standard = ("Helvetica",12) + standard_italique = ("Helvetica",12,'italic') + standard_gras = ("Helvetica",12,'bold') + standard_gras_souligne = ("Helvetica",12,'bold','underline') + + canvas = ('Helvetica',10) + canvas_italique = ('Helvetica',10,'italic') + canvas_gras = ("Helvetica",10,'bold') + canvas_gras_italique = ("Helvetica",12,'bold','italic') + + standard12 = ("Helvetica",14) + standard12_gras = ("Helvetica",14,'bold') + standard12_gras_italique = ( "Helvetica",14,'bold','italic') + + standardcourier10 = ("Courier",14) + statusfont = ("Helvetica",16) + +style=STYLE() diff --git a/Editeur/old/cata2Xml.py b/Editeur/old/cata2Xml.py new file mode 100755 index 00000000..516c8a59 --- /dev/null +++ b/Editeur/old/cata2Xml.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import str + from builtins import object +except : + pass +import sys,os +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4')) +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4')) +from Extensions.i18n import tr +from string import split,strip,lowercase,uppercase +import re,string + +import xml.etree.ElementTree as ET +from xml.dom import minidom + +from PyQt4.QtGui import * + +def prettify(elem): + """Return a pretty-printed XML string for the Element. + """ + rough_string = ET.tostring(elem, 'iso-8859-1') + reparsed = minidom.parseString(rough_string) + return reparsed.toprettyxml(indent=" ") + + +class CatalogueXML(object): + def __init__(self,cata,cataName): + self.fichier="/tmp/XML/"+cataName+".xml" + self.cata=cata + self.first=ET.Element('cata') + comment=ET.Comment("catalogue "+str(cataName)) + self.first.append(comment) + self.reglesUtilisees=[] + self.validatorsUtilises=[] + self.constrListTxtCmd() + self.ecrire_fichier() + + + def ecrire_fichier(self): + try : + import codecs + f = codecs.open(self.fichier, "w", "ISO-8859-1") + #print prettify(self.first) + f.write(prettify(self.first)) + f.close() + except : + print(("Impossible d'ecrire le fichier : "+ str(self.fichier))) + + def constrListTxtCmd(self): + mesCommandes=self.cata.JdC.commandes + self.commandes=ET.SubElement(self.first,'commandes') + for maCommande in mesCommandes: + maCommande.enregistreXMLStructure(self.commandes,self) + + +if __name__ == "__main__" : + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py" + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py" + code="Aster" + version=None + + from Editeur import session + options=session.parse(sys.argv) + if options.code!= None : code=options.code + if options.cata!= None : monCata=options.cata + if options.ssCode!= None : ssCode=options.ssCode + + sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code)) + + from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm + Eficas=appliEficasSSIhm(code=code) + parent=QWParentSSIhm(code,Eficas,version) + + import readercata + monreadercata = readercata.READERCATA( parent, parent ) + Eficas.readercata=monreadercata + monCata=monreadercata.cata + + monCataXML=CatalogueXML(monCata,code) diff --git a/Editeur/old/faqs.txt b/Editeur/old/faqs.txt new file mode 100755 index 00000000..b087c34e --- /dev/null +++ b/Editeur/old/faqs.txt @@ -0,0 +1,46 @@ + +------------------------------------------------------------------------------------------------------------- + FAQs et Limitations d'EFICAS +------------------------------------------------------------------------------------------------------------- + + +1. Mots réservés : + + Tous les mots du langage Python sont des mots réservés. + On ne peut donc pas appeler une variable ou un concept 'fin' ou 'dir' + Pour la liste complète de ces mots-clés, veuillez vous référer à la + documentation Python + +2. Concepts réentrants : + + Ne pas indiquer par un '&' devant son nom qu'un concept est utilisé comme + concept réentrant. En effet EFICAS le sait ! + +3. Carte commentaire : + + La carte commentaire est désormais le '#' (dièse) au lieu du '%' (pourcent) + Les commentaires sont gérés comme des objets de même niveau que les + commandes ; il n'est plus possible de placer des commentaires "dans" + une commande. Attention, lors de la traduction d'un fichier de version 5 + en 6, les commentaires "dans" les commandes seront perdus. + +4. Nommer le concept produit par un opérateur : + + Vous ne pouvez nommer le concept produit d'un opérateur que lorsque + celui-ci aura été entièrement et correctement rempli. + +5. Règle de rémanence dans les mots-clés facteurs répétés : + + La règle de rémanence qui permettait pour certains mots-clés facteurs + et pour certains de leurs mots-clés simples de ne pas répeter la valeur + de ces derniers dans toutes les occurrences du mot-clé facteur n'est pas + connue d'EFICAS. + En conséquence, vous devez répéter les mots-clés simples concernés dans + toutes les occurrences des mots-clés facteurs. + +6. Besoin d'aide ? + + La documentation d'utilisation d'EFICAS a pris un peu de retard sur le produit ... + Néanmoins, vous disposez sur la plupart des panneaux contextuels ( les panneaux à + droite de l'arbre) d'une aide en ligne que vous pouvez activer en maintenant le + bouton droit de votre souris enfoncé. diff --git a/Editeur/old/fontes.py b/Editeur/old/fontes.py new file mode 100644 index 00000000..ab0c8b8d --- /dev/null +++ b/Editeur/old/fontes.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +standard = ("Times",10) +standard_italique = ("Times",10,'italic') +standard_gras = ("Times",10,'bold') +standard_gras_souligne = ("Times",10,'bold','underline') + +canvas = ('times',8) +canvas_italique = ('times',8,'italic') +canvas_gras = ("Times",8,'bold') +canvas_gras_italique = ("Times",10,'bold','italic') + +standard12 = ("Times",12) +standard12_gras = ("Times",12,'bold') +standard12_gras_italique = ( "times",12,'bold','italic') + +standardcourier10 = ("Courier",10) diff --git a/Editeur/old/import_code.py b/Editeur/old/import_code.py new file mode 100644 index 00000000..c9295e84 --- /dev/null +++ b/Editeur/old/import_code.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module realise toutes les mises a jour du chemin pour + les imports de modules Python +""" +from __future__ import absolute_import +import sys +import os + +import prefs +name='prefs_'+prefs.code +prefs_Code=__import__(name) +INSTALLDIR=prefs_Code.INSTALLDIR + +# Ce chemin permet d'importer les modules Noyau et Validation +# representant le code utilise (si fourni) +# Ensuite on utilise les packages de l'intallation +if hasattr(prefs_Code,'CODE_PATH'): + if prefs_Code.CODE_PATH: + sys.path[:0]=[prefs_Code.CODE_PATH] + import Noyau,Validation + del sys.path[0] +sys.path[:0]=[prefs_Code.INSTALLDIR] + +import Accas diff --git a/Editeur/old/styles.py b/Editeur/old/styles.py new file mode 100644 index 00000000..d87ae630 --- /dev/null +++ b/Editeur/old/styles.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +from __future__ import absolute_import +import os +import prefs +name='prefs_'+prefs.code +prefsCode=__import__(name) +from basestyle import STYLE,style + +inistylefile=os.path.join(prefsCode.repIni,"style.py") +if os.path.isfile(inistylefile): + exec(compile(open(inistylefile).read(), inistylefile, 'exec')) + +import fontes +for attr in dir(style): + if attr[0]=='_':continue + if not hasattr(fontes,attr):continue + setattr(fontes,attr,getattr(style,attr)) diff --git a/Editeur/styles.py b/Editeur/styles.py deleted file mode 100644 index d87ae630..00000000 --- a/Editeur/styles.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -from __future__ import absolute_import -import os -import prefs -name='prefs_'+prefs.code -prefsCode=__import__(name) -from basestyle import STYLE,style - -inistylefile=os.path.join(prefsCode.repIni,"style.py") -if os.path.isfile(inistylefile): - exec(compile(open(inistylefile).read(), inistylefile, 'exec')) - -import fontes -for attr in dir(style): - if attr[0]=='_':continue - if not hasattr(fontes,attr):continue - setattr(fontes,attr,getattr(style,attr)) diff --git a/Editeur/tout.sh b/Editeur/tout.sh deleted file mode 100644 index 885b50e4..00000000 --- a/Editeur/tout.sh +++ /dev/null @@ -1,35 +0,0 @@ -echo "Aster" -./cata2Xml.py -k Aster - -echo "Adao" -read a -./cata2Xml.py -k Adao - -echo "Carmel3D" -read a -./cata2Xml.py -k Carmel3D - -echo "CarmelCND" -read a -./cata2Xml.py -k CarmelCND - -echo "Openturns_Wrapper" -read a -./cata2Xml.py -k Openturns_Wrapper - -echo "Openturns_Study" -read a -./cata2Xml.py -k Openturns_Study - -echo "MAP" -read a -./cata2Xml.py -k MAP - -echo "MT" -read a -./cata2Xml.py -k MT - -echo "SPECA" -read a -./cata2Xml.py -k SPECA - diff --git a/Editeur/toutBloc.sh b/Editeur/toutBloc.sh deleted file mode 100644 index c77c2fb2..00000000 --- a/Editeur/toutBloc.sh +++ /dev/null @@ -1,35 +0,0 @@ -echo "Aster" -./chercheBlocInto.py -k Aster - -echo "Adao" -read a -./chercheBlocInto.py -k Adao - -echo "Carmel3D" -read a -./chercheBlocInto.py -k Carmel3D - -echo "CarmelCND" -read a -./chercheBlocInto.py -k CarmelCND - -echo "Openturns_Wrapper" -read a -./chercheBlocInto.py -k Openturns_Wrapper - -echo "Openturns_Study" -read a -./chercheBlocInto.py -k Openturns_Study - -echo "MAP" -read a -./chercheBlocInto.py -k MAP - -echo "MT" -read a -./chercheBlocInto.py -k MT - -echo "SPECA" -read a -./chercheBlocInto.py -k SPECA - diff --git a/Editeur/toutInto.sh b/Editeur/toutInto.sh deleted file mode 100644 index 6f2458a0..00000000 --- a/Editeur/toutInto.sh +++ /dev/null @@ -1,35 +0,0 @@ -echo "Aster" -./construitInto.py -k Aster - -echo "Adao" -read a -./construitInto.py -k Adao - -echo "Carmel3D" -read a -./construitInto.py -k Carmel3D - -echo "CarmelCND" -read a -./construitInto.py -k CarmelCND - -echo "Openturns_Wrapper" -read a -./construitInto.py -k Openturns_Wrapper - -echo "Openturns_Study" -read a -./construitInto.py -k Openturns_Study - -echo "MAP" -read a -./construitInto.py -k MAP - -echo "MT" -read a -./construitInto.py -k MT - -echo "SPECA" -read a -./construitInto.py -k SPECA - diff --git a/Ihm/I_VALIDATOR.py b/Ihm/I_VALIDATOR.py index a1e3006c..f5434cbd 100644 --- a/Ihm/I_VALIDATOR.py +++ b/Ihm/I_VALIDATOR.py @@ -38,3 +38,72 @@ class OrdList(OrdList): except : valid=0 return valid +class compareAutreMC(Valid) : +#---------------------------- + def __init__(self,frere=None): + Valid.__init__(self, frere=frere) + self.nomFrere=frere + + def set_MCSimp (self, MCSimp): + debug = 1 + if debug : print ('je passe la pour ', self, MCSimp.nom) + self.MCSimp=MCSimp + +class infFrereMC(compareAutreMC): +#------------------------------- + def convert(self, valeur): + # on sort de cardProto on a une liste + valeur=valeur[0] + try: MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere) + except : return valeur + if not MCFrere : return valeur + if MCFrere== None : return valeur + if MCFrere.valeur == None : return valeur + if MCFrere.valeur < valeur : + raise CataError('la valeur de '+self.nomFrere + ' est inferieure a la valeur entree ') + return valeur + + def verifItem(self, valeur): + try: MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere) + except : return valeur + if not MCFrere : return valeur + if MCFrere== None : return valeur + if MCFrere.valeur == None : return valeur + if MCFrere.valeur < valeur : + raise CataError('la valeur de '+self.nomFrere + ' est inferieure a la valeur entree et doit etre superieure') + return 0 + return 1 + + def infoErreurItem(self, valeur): + return 'la valeur de '+self.nomFrere + ' est inferieure a la valeur entree et doit etre superieure' + + def info(self): + return 'la valeur de '+self.nomFrere + ' est inferieure a la valeur entree et doit etre superieure' + +class supFrereMC(compareAutreMC): +#-------------------------------- + def convert(self, valeur): + # on sort de cardProto on a une liste + valeur=valeur[0] + MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere) + if not MCFrere : return valeur + if MCFrere== None : return valeur + if MCFrere.valeur > valeur : + raise CataError('la valeur de '+self.nomFrere + ' est superieure a la valeur entree et doit etre inferieure') + return valeur + + def verifItem(self, valeur): + MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere) + if not MCFrere : return 1 + if MCFrere== None : return 1 + if MCFrere.valeur > valeur : + raise CataError('la valeur de '+self.nomFrere + ' est superieure a la valeur entree et doit etre inferieure') + return 0 + return 1 + + def infoErreurItem(self, valeur): + return 'la valeur de '+self.nomFrere + ' est superieure a la valeur entree et doit etre inferieure' + + def info(self): + return 'la valeur de '+self.nomFrere + ' est superieure a la valeur entree ' + diff --git a/generator/generator_PSEN.py b/generator/generator_PSEN.py deleted file mode 100755 index b083c961..00000000 --- a/generator/generator_PSEN.py +++ /dev/null @@ -1,126 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -"""Ce module contient le plugin generateur de fichier au format Code_Carmel3D pour EFICAS. -""" - -from __future__ import absolute_import -try : - from builtins import str -except : pass - -texte_debut="int main() \n{ \n init_var();\n" -texte_debut+=' format="med";\n' -import traceback -import types,re,os -from Extensions.i18n import tr -from .generator_dicoImbrique import DicoImbriqueGenerator - -def entryPoint(): - """ - Retourne les informations necessaires pour le chargeur de plugins - Ces informations sont retournees dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'PSEN', - # La factory pour creer une instance du plugin - 'factory' : PSENGenerator, - } - - -class PSENGenerator(DicoImbriqueGenerator): - """ - Ce generateur parcourt un objet de type JDC et produit - un texte au format eficas et - un texte au format dictionnaire - - """ - # Les extensions de fichier permis? - extensions=('.comm',) - -#---------------------------------------------------------------------------------------- - def gener(self,obj,format='brut',config=None, appliEficas=None): - - try : - self.MachineDico = obj.MachineDico - self.LoadDico = obj.LoadDico - self.LineDico = obj.LineDico - self.TransfoDico = obj.TransfoDico - self.MotorDico = obj.MotorDico - except : - self.MachineDico = None - self.LoadDico = None - self.LineDico = None - self.TransfoDico = None - self.MotorDico = None - - self.initDico() - # Cette instruction genere le contenu du fichier de commandes (persistance) - self.text=DicoImbriqueGenerator.gener(self,obj,format) - return self.text - - -#---------------------------------------------------------------------------------------- -# initialisations -#---------------------------------------------------------------------------------------- - - def initDico(self) : - DicoImbriqueGenerator.initDico(self) - self.Entete = 'MachineDico = ' + str(self.MachineDico) +'\n' - self.Entete += 'LoadDico = ' + str(self.LoadDico) +'\n' - self.Entete += 'LineDico = ' + str(self.LineDico) +'\n' - self.Entete += 'TransfoDico = ' + str(self.TransfoDico) +'\n' - self.Entete += 'MotorDico = ' + str(self.MotorDico) + '\n' - self.Entete +='\n' - - -#---------------------------------------------------------------------------------------- -# ecriture -#---------------------------------------------------------------------------------------- - - def writeDefault(self,fn) : - fileDico=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..','PSEN_Eficas','PSEN','PSENconfig.py')) - f = open( str(fileDico), 'wb') - f.write( self.Entete + "Dico =" + str(self.Dico) ) - f.close() - - - -#---------------------------------------------------------------------------------------- -# analyse de chaque noeud de l'arbre -#---------------------------------------------------------------------------------------- - -## def generMCSIMP(self,obj) : -## """recuperation de l objet MCSIMP""" -## #print dir(obj) -## self.dicoMCSIMP[obj.nom]=obj.val -## self.dicoTemp[obj.nom]=obj.val -## s=DicoImbriqueGenerator.generMCSIMP(self,obj) -## return s -## -## def generETAPE(self,obj): -## self.dicoTemp={} -## s=DicoImbriqueGenerator.generETAPE(self,obj) -## if obj.nom=="DISTRIBUTION" : self.dicoLois[obj.sd.nom]=self.dicoTemp -## self.dicoTemp={} -## return s - - -# si repertoire on change tous les noms de fichier diff --git a/generator/generator_ProcessOutputs.py b/generator/generator_ProcessOutputs.py deleted file mode 100755 index 7c87e7e8..00000000 --- a/generator/generator_ProcessOutputs.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -"""Ce module contient le plugin generateur de fichier au format Code_Carmel3D pour EFICAS. -""" - -from __future__ import absolute_import -import types,re,os -from Extensions.i18n import tr -from .generator_python import PythonGenerator -from .generator_modification import ModificationGenerator - -def entryPoint(): - """ - Retourne les informations necessaires pour le chargeur de plugins - Ces informations sont retournees dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'ProcessOutputs', - # La factory pour creer une instance du plugin - 'factory' : ProcessOutputsGenerator, - } - - -class ProcessOutputsGenerator(PythonGenerator,ModificationGenerator): - """ - Ce generateur parcourt un objet de type JDC et produit - un texte au format eficas et - un texte au format dictionnaire - - """ - # Les extensions de fichier permis? - extensions=('.comm',) - -#---------------------------------------------------------------------------------------- - def gener(self,obj,format='brut',config=None, appliEficas=None): - - # Cette instruction genere le contenu du fichier de commandes (persistance) - texteModification=self.generTexteModif(obj) - text=PythonGenerator.gener(self,obj,format) - self.text=texteModification+text - - return self.text - - - -# si repertoire on change tous les noms de fichier diff --git a/generator/generator_map.py b/generator/generator_map.py deleted file mode 100644 index 32cee7be..00000000 --- a/generator/generator_map.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -""" - Ce module contient le plugin generateur de fichier au format - CARMEL3D pour EFICAS. - -""" -from __future__ import print_function -from __future__ import absolute_import -try : - from builtins import str -except : pass - -import traceback -import types,re,os -import Accas - -from .generator_python import PythonGenerator - -def entryPoint(): - """ - Retourne les informations necessaires pour le chargeur de plugins - - Ces informations sont retournees dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'MAP', - # La factory pour creer une instance du plugin - 'factory' : MapGenerator, - } - - -class MapGenerator(PythonGenerator): - """ - Ce generateur parcourt un objet de type JDC et produit - un texte au format eficas et - un texte au format py - - """ - - def gener(self,obj,format='brut',config=None,appliEficas=None): - self.initDico() - self.text=PythonGenerator.gener(self,obj,format) - if obj.isValid() :self.genereExeMap() - return self.text - - - def genereExeMap(self) : - ''' - Prepare le contenu du fichier de parametres python - peut ensuite etre obtenu au moyen de la fonction getTubePy(). - ''' - nomSpec="spec_"+self.schema - self.texteEXE="from map.spec import %s;\n"%nomSpec - self.texteEXE+="node=%s.new();\n"%nomSpec - self.texteEXE+="node.getInputData();\n" - self.texteEXE+="node.setInputData(%s);\n"%self.dictValeur - self.texteEXE+="node.execute();\n" - self.texteEXE+="res=node.getOutputData();\n" - - - def initDico(self) : - if not hasattr(self,'schema') : self.schema="" - self.dictParam={} - self.dictValeur={} - - def writeDefault(self, fn): - fileEXE = fn[:fn.rfind(".")] + '.py' - f = open( str(fileEXE), 'wb') - f.write( self.texteEXE ) - f.close() - - def generMCSIMP(self,obj) : - """ - Convertit un objet MCSIMP en texte python - Remplit le dictionnaire des MCSIMP - """ - - if obj.getGenealogie()[0][-6:-1]=="_PARA": - self.dictParam[obj.nom]=obj.valeur - else : - self.dictValeur[obj.nom]=obj.valeur - s=PythonGenerator.generMCSIMP(self,obj) - return s - - - def generRUN(self,obj,schema): - if not(obj.isValid()) : - print ("TODO TODO TODO") - self.texteEXE="" - self.schema=schema - textComm=self.gener(obj) - return self.texteEXE diff --git a/generator/generator_mapVP.py b/generator/generator_mapVP.py deleted file mode 100644 index a5b8ef4c..00000000 --- a/generator/generator_mapVP.py +++ /dev/null @@ -1,237 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -""" - Ce module contient le plugin generateur de fichier au format - CARMEL3D pour EFICAS. - -""" -from __future__ import print_function -from __future__ import absolute_import -try : - from builtins import str -except : pass - -import traceback -import types,re,os -import Accas - -from .generator_python import PythonGenerator - -listeCalParName = ('Time' , 'Temperature', 'DoseRate', 'Thickness') #'calculation_parameter_names' - - -def entryPoint(): - """ - Retourne les informations necessaires pour le chargeur de plugins - - Ces informations sont retournees dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'MAPVp', - # La factory pour creer une instance du plugin - 'factory' : MapGenerator, - } - - -class MapGenerator(PythonGenerator): - """ - Ce generateur parcourt un objet de type JDC et produit - un texte au format eficas et - un texte au format py - - """ - - def gener(self,obj,format='brut',config=None,appliEficas=None): - self.appliEficas=appliEficas - self.cata=self.appliEficas.readercata.cata - self.initDico() - self.text=PythonGenerator.gener(self,obj,format) - if obj.isValid() :self.genereTexte(obj) - return self.text - - def initDico(self) : - self.texteInput = "" - self.dictParam={} - self.dictValeur={} - self.listeEquations=[] - self.typeEtude = "" - - - def genereTexte(self,obj) : - print ('genereTexte', self.typeEtude) - if self.typeEtude == "Calculation" : self.genereCalculation() - - - def generPROC_ETAPE(self,obj): - s=PythonGenerator.generPROC_ETAPE(self,obj) - if obj.nom == "Calculation_for_Mechanistic" : print ('hjkhjkh');self.typeEtude="Calculation" - return s - - def genereCalculation(self) : - ''' - Prepare le contenu du fichier de parametres python - ''' - self.texteInput = "" - self.texteInput += self.genereCsv() - self.texteInput += self.genereCalculationParams() - self.texteInput += self.txtNomCst - self.texteInput += self.txtVal - self.texteInput += self.txtValAct - self.texteInput += self.txtNomCstNA - self.texteInput += self.txtValNA - self.texteInput += self.txtInitName - self.texteInput += self.txtInitVal - self.texteInput += self.genereEquations() - print (self.texteInput) - - def writeDefault(self, fn): - # normalement c_solver_polymer_kinetics_myStudy.input ou myStudy est le nom de l etude - fileInput = fn[:fn.rfind(".")] + '.input' - f = open( str(fileInput), 'wb') - f.write( self.texteInput ) - f.close() - - - def genereCalculationParams(self) : - txtNom = "calculation_parameter_names = [ " - txtVal = "calculation_parameters = [ " - for param in ('Time' , 'Temperature', 'DoseRate', 'Thickness') : - if param in self.dictValeur.keys() : - txtNom += "'"+param + "', " - txtVal += str(self.dictValeur[param]) + ", " - # on enleve les dernieres , et on ferme - txtNom = txtNom[0:-2] - txtNom += "]\n" - txtVal = txtVal[0:-2] - txtVal += "]\n" - txt = txtNom + txtVal - return txt - - def genereEquations(self) : - txt="equation =[" - index=0 - TechnicalUse = self.dictValeur['TechnicalUse'] - ModelName = self.dictValeur['ModelName'] - for param in self.listInitialParameters: - print ('*******************************************') - print (' je traite ', param , 'index : ', index) - trouveParam=False - - if index != 0 : txtParam = 'Dy[j*5 + '+str(index)+ '] = ' - else : txtParam = 'Dy[j*5] = ' - - for equation in self.listeEquations : - if param in (self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation].keys()): - print ('____________ trouve : ', param , 'in ', equation, ' ', self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]) - trouveParam = True - if self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param][0] == '-' : - txtParam += ' ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param] - else : - if index != 0 : - txtParam += ' + ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param] - else : - txtParam += self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param] - print (' txtParam intermediaire ', txtParam) - - if trouveParam : - txtParam = txtParam + ", " - txt += txtParam - index = index+1 - print (txtParam) - print ('fin param', param, 'trouve ', trouveParam, '___________________________') - print ('*************************************************') - print (' ') - print ('_________________fin for') - txt=txt[0:-3] - txt+="]\n" - return txt - - def genereCsv(self) : - txt = 'study_name = ' +self.dictValeur['SimulationName'] + "\n" - txt += 'csv_output_file_name = ' + self.dictValeur['OutPutFolder'] + '/c_solver_stiff_ode_1d_' + self.dictValeur['SimulationName']+ '.csv\n' - return txt - - - def generMCList(self,obj): - s=PythonGenerator.generMCList(self,obj) - if obj.nom == 'ConstantesArrhenius' : - self.txtNomCst = "Arrhenius_Name = [ " - self.txtVal = "Arrhenius_A = [ " - self.txtValAct = "Arrhenius_Ea = [ " - for objFils in obj.data: - for mc in objFils.mcListe : - self.txtNomCst += "'" + mc.nom + "', " - self.txtVal += str(mc.valeur[0]) + ", " - self.txtValAct += str(mc.valeur[1]) + ", " - self.txtNomCst = self.txtNomCst[0:-2] - self.txtVal = self.txtVal[0:-2] - self.txtValAct = self.txtValAct [0:-2] - self.txtNomCst += ']\n' - self.txtVal += ']\n' - self.txtValAct += ']\n' - - if obj.nom == 'ConstantesNonArrhenius' : - self.txtNomCstNA = "non_Arrhenius_coefs_names = [ " - self.txtValNA = "non_Arrhenius_coefs = [ " - for objFils in obj.data: - for mc in objFils.mcListe : - self.txtNomCstNA += "'" + mc.nom + "', " - self.txtValNA += str(mc.valeur) + ", " - self.txtNomCstNA = self.txtNomCstNA[0:-2] - self.txtValNA = self.txtValNA[0:-2] - self.txtNomCstNA += ']\n' - self.txtValNA += ']\n' - - if obj.nom == 'InitialParameters' : - self.listInitialParameters =[] - self.txtInitName = "initial_Value_names = [ " - self.txtInitVal = "initial_Values = [ " - for objFils in obj.data: - for mc in objFils.mcListe : - self.txtInitName += "'" + mc.nom + "', " - self.txtInitVal += str(mc.valeur) + ", " - self.listInitialParameters.append(mc.nom) - self.txtInitName = self.txtInitName[0:-2] - self.txtInitVal = self.txtInitVal[0:-2] - self.txtInitName += ']\n' - self.txtInitVal += ']\n' - - if obj.nom in( 'initiation','propagation','termination','stabilization') : - for o in obj : - for mc in o.mcListe : - nom=mc.nom.replace (' ','').replace ('+','_').replace ('-','_').replace ('>','_').replace('(','').replace(')','').replace('*','').replace('[','').replace(']','') - nom=obj.nom+'_'+nom - self.listeEquations.append(nom ) - return s - - def generMCSIMP(self,obj) : - """ - Convertit un objet MCSIMP en texte python - Remplit le dictionnaire des MCSIMP - """ - s=PythonGenerator.generMCSIMP(self,obj) - if obj.nom=='Consigne' : return s - - if obj.getGenealogie()[0][-6:-1]=="_PARA": - self.dictParam[obj.nom]=obj.valeur - else : - self.dictValeur[obj.nom]=obj.valeur - return s diff --git a/generator/generator_vers3DSalome.py b/generator/generator_vers3DSalome.py deleted file mode 100644 index 05b2dc14..00000000 --- a/generator/generator_vers3DSalome.py +++ /dev/null @@ -1,243 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2007-2021 EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -""" - Ce module contient le plugin generateur de fichier au format - python pour EFICAS. - PN - -""" -from __future__ import absolute_import -from __future__ import print_function -from __future__ import division -try : - from builtins import range -except : - pass -import traceback -import types,re -import math - -from Noyau import N_CR -from Noyau.N_utils import repr_float -import Accas -import Extensions -from Extensions.parametre import ITEM_PARAMETRE -from .Formatage import Formatage -from .generator_python import PythonGenerator -from six.moves import range -#from Editeur.widgets import showerror - -def entryPoint(): - """ - Retourne les informations necessaires pour le chargeur de plugins - - Ces informations sont retournees dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'vers3DSalome', - # La factory pour creer une instance du plugin - 'factory' : vers3DSalomeGenerator, - } - - -class vers3DSalomeGenerator(PythonGenerator): - """ - Ce generateur parcourt un objet AFFE-CARA_ELEM - et produit un fichier au format texte contenant - les instructions idl pour PAL - """ - - def __init__(self,cr=None): - self.list_commandes=[]; - self.jdc=None - self.node=None - self.clefs=None - self.liste_motetat = ("AFFE_CARA_ELEM", "ORIG_AXE", "AXE" , - "BARRE", "CABLE", "CARA", "COQUE", "EPAIS", - "EXCENTREMENT", "GROUP_MA", "ORIENTATION", - "POUTRE", "SECTION", "VALE", "VARI_SECT", - "GRILLE", "ANGL_REP", "VECTEUR", - "b_constant", "b_homothetique", - "b_rectangle", "b_affine", "b_cercle", "b_generale" ) - self.dict_deb_com={"POUTRE":"VisuPoutre", "CABLE" : "VisuCable", - "COQUE" : "VisuCoque", "GRILLE" : "VisuGrille", - "ORIENTATION" : "Orientation", "BARRE" : "VisuBarre"} - - self.dict_suite_com={"RECTANGLE":"Rectangle","GENERALE":"Generale", - "CERCLE":"Cercle"} - - self.dict_traduit={"VARI_SECT":"extrusion","EXCENTREMENT":"Excentre","EPAIS":"Epais","VECTEUR":"Vecteur"} - - self.initLigne () - - def initJdc(self,jdc) : - self.jdc=jdc - - def initLigne (self) : - self.boolGpMa = 0 - self.commande = "" - self.dict_attributs = {} - - def gener(self,node,config=None,appliEficas=None): - """ - """ - self.node=node - self.list_commandes=[]; - self.generator(self.node.object) - return self.list_commandes - - def generator(self,obj): - if (obj.nom in self.liste_motetat) and (self.calculeOuiNon(obj)): - PythonGenerator.generator(self,obj) - """ - f1=PythonGenerator.generator(self,obj) - else : - return "" - """ - - def calculeOuiNon(self,obj): - ouinon=1 - for l in obj.getGenealogie() : - if not l in self.liste_motetat : - ouinon=0 - break - return ouinon - - - def generETAPE(self,obj): - """ - """ - if obj.isValid() == 0 : - #showerror("Element non valide","Salome ne sait pas traiter les elements non valides") - return - for v in obj.mcListe: - liste=self.generator(v) - - def generMACRO_ETAPE(self,obj): - """ - """ - if obj.isValid() == 0 : - #showerror("Element non valide","Salome ne sait pas traiter les elements non valides") - return - for v in obj.mcListe: - liste=self.generator(v) - - - def generMCSIMP(self,obj) : - """ - """ - if obj.nom in dir(self) : - suite = self.__class__.__dict__[obj.nom](self,obj) - else : - clef=self.dict_traduit[obj.nom] - # traitement des parametres - try : - self.dict_attributs[clef]=obj.val.eval() - except : - self.dict_attributs[clef]=obj.val - - - def generMCFACT(self,obj): - """ - Convertit un objet MCFACT en une liste de chaines de caracteres a la - syntaxe python - """ - self.initLigne () - self.commande=self.dict_deb_com[obj.nom] - for v in obj.mcListe: - self.generator(v) - if self.boolGpMa == 1: - self.list_commandes.append((self.commande,self.dict_attributs)) - else : - #showerror("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element") - print(("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element")) - pass - - def generMCList(self,obj): - """ - """ - for mcfact in obj.data: - self.generator(mcfact) - - def generMCBLOC(self,obj): - """ - """ - for v in obj.mcListe: - self.generator(v) - - def GROUP_MA(self,obj): - self.boolGpMa = 1 - self.dict_attributs["Group_Maille"]=obj.val - - def SECTION(self,obj): - assert (self.commande != "" ) - if self.commande == "VisuCable" : - self.dict_attributs["R"]= math.sqrt(obj.val/math.pi).eval() - elif (self.commande !="VisuGrille") : - self.commande=self.commande+self.dict_suite_com[obj.valeur] - - def CARA(self,obj) : - self.clefs=obj.val - if type(self.clefs) == bytes or type(self.clefs) == str: - self.clefs=(obj.val,) - - def VALE(self,obj) : - atraiter=obj.val - if len(self.clefs) > 1 : - assert (len(atraiter) == len(self.clefs)) - else : - atraiter=(atraiter,) - for k in range(len(atraiter)) : - clef=self.clefs[k] - val =atraiter[k] - if isinstance(val, (tuple, list)) and len(val) == 1: - val = val[0] - if isinstance (val, Extensions.parametre.PARAMETRE): - val=val.valeur - print(( val.__class)) - context={} - if type(val) == type("aaa") : - for p in self.jdc.params: - context[p.nom]=eval(p.val,self.jdc.const_context, context) - print((context[p.nom])) - res=eval(val,self.jdc.const_context, context) - val=res - self.dict_attributs[clef]=val - - def ANGL_REP(self,obj) : - assert (len(obj.val) == 2) - alpha,beta=obj.val - self.dict_attributs["angleAlpha"]=alpha - self.dict_attributs["angleBeta"]=beta - - def ORIG_AXE(self,obj) : - assert (len(obj.val) == 3) - alpha,beta,gamma=obj.val - self.dict_attributs["origAxeX"]=alpha - self.dict_attributs["origAxeY"]=beta - self.dict_attributs["origAxeZ"]=gamma - - def AXE(self,obj) : - assert (len(obj.val) == 3) - alpha,beta,gamma=obj.val - self.dict_attributs["axeX"]=alpha - self.dict_attributs["axeY"]=beta - self.dict_attributs["axeZ"]=gamma diff --git a/generator/oldCodes/generator_PSEN.py b/generator/oldCodes/generator_PSEN.py new file mode 100755 index 00000000..b083c961 --- /dev/null +++ b/generator/oldCodes/generator_PSEN.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +"""Ce module contient le plugin generateur de fichier au format Code_Carmel3D pour EFICAS. +""" + +from __future__ import absolute_import +try : + from builtins import str +except : pass + +texte_debut="int main() \n{ \n init_var();\n" +texte_debut+=' format="med";\n' +import traceback +import types,re,os +from Extensions.i18n import tr +from .generator_dicoImbrique import DicoImbriqueGenerator + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'PSEN', + # La factory pour creer une instance du plugin + 'factory' : PSENGenerator, + } + + +class PSENGenerator(DicoImbriqueGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format dictionnaire + + """ + # Les extensions de fichier permis? + extensions=('.comm',) + +#---------------------------------------------------------------------------------------- + def gener(self,obj,format='brut',config=None, appliEficas=None): + + try : + self.MachineDico = obj.MachineDico + self.LoadDico = obj.LoadDico + self.LineDico = obj.LineDico + self.TransfoDico = obj.TransfoDico + self.MotorDico = obj.MotorDico + except : + self.MachineDico = None + self.LoadDico = None + self.LineDico = None + self.TransfoDico = None + self.MotorDico = None + + self.initDico() + # Cette instruction genere le contenu du fichier de commandes (persistance) + self.text=DicoImbriqueGenerator.gener(self,obj,format) + return self.text + + +#---------------------------------------------------------------------------------------- +# initialisations +#---------------------------------------------------------------------------------------- + + def initDico(self) : + DicoImbriqueGenerator.initDico(self) + self.Entete = 'MachineDico = ' + str(self.MachineDico) +'\n' + self.Entete += 'LoadDico = ' + str(self.LoadDico) +'\n' + self.Entete += 'LineDico = ' + str(self.LineDico) +'\n' + self.Entete += 'TransfoDico = ' + str(self.TransfoDico) +'\n' + self.Entete += 'MotorDico = ' + str(self.MotorDico) + '\n' + self.Entete +='\n' + + +#---------------------------------------------------------------------------------------- +# ecriture +#---------------------------------------------------------------------------------------- + + def writeDefault(self,fn) : + fileDico=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..','PSEN_Eficas','PSEN','PSENconfig.py')) + f = open( str(fileDico), 'wb') + f.write( self.Entete + "Dico =" + str(self.Dico) ) + f.close() + + + +#---------------------------------------------------------------------------------------- +# analyse de chaque noeud de l'arbre +#---------------------------------------------------------------------------------------- + +## def generMCSIMP(self,obj) : +## """recuperation de l objet MCSIMP""" +## #print dir(obj) +## self.dicoMCSIMP[obj.nom]=obj.val +## self.dicoTemp[obj.nom]=obj.val +## s=DicoImbriqueGenerator.generMCSIMP(self,obj) +## return s +## +## def generETAPE(self,obj): +## self.dicoTemp={} +## s=DicoImbriqueGenerator.generETAPE(self,obj) +## if obj.nom=="DISTRIBUTION" : self.dicoLois[obj.sd.nom]=self.dicoTemp +## self.dicoTemp={} +## return s + + +# si repertoire on change tous les noms de fichier diff --git a/generator/oldCodes/generator_ProcessOutputs.py b/generator/oldCodes/generator_ProcessOutputs.py new file mode 100755 index 00000000..7c87e7e8 --- /dev/null +++ b/generator/oldCodes/generator_ProcessOutputs.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +"""Ce module contient le plugin generateur de fichier au format Code_Carmel3D pour EFICAS. +""" + +from __future__ import absolute_import +import types,re,os +from Extensions.i18n import tr +from .generator_python import PythonGenerator +from .generator_modification import ModificationGenerator + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'ProcessOutputs', + # La factory pour creer une instance du plugin + 'factory' : ProcessOutputsGenerator, + } + + +class ProcessOutputsGenerator(PythonGenerator,ModificationGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format dictionnaire + + """ + # Les extensions de fichier permis? + extensions=('.comm',) + +#---------------------------------------------------------------------------------------- + def gener(self,obj,format='brut',config=None, appliEficas=None): + + # Cette instruction genere le contenu du fichier de commandes (persistance) + texteModification=self.generTexteModif(obj) + text=PythonGenerator.gener(self,obj,format) + self.text=texteModification+text + + return self.text + + + +# si repertoire on change tous les noms de fichier diff --git a/generator/oldCodes/generator_map.py b/generator/oldCodes/generator_map.py new file mode 100644 index 00000000..32cee7be --- /dev/null +++ b/generator/oldCodes/generator_map.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module contient le plugin generateur de fichier au format + CARMEL3D pour EFICAS. + +""" +from __future__ import print_function +from __future__ import absolute_import +try : + from builtins import str +except : pass + +import traceback +import types,re,os +import Accas + +from .generator_python import PythonGenerator + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'MAP', + # La factory pour creer une instance du plugin + 'factory' : MapGenerator, + } + + +class MapGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format py + + """ + + def gener(self,obj,format='brut',config=None,appliEficas=None): + self.initDico() + self.text=PythonGenerator.gener(self,obj,format) + if obj.isValid() :self.genereExeMap() + return self.text + + + def genereExeMap(self) : + ''' + Prepare le contenu du fichier de parametres python + peut ensuite etre obtenu au moyen de la fonction getTubePy(). + ''' + nomSpec="spec_"+self.schema + self.texteEXE="from map.spec import %s;\n"%nomSpec + self.texteEXE+="node=%s.new();\n"%nomSpec + self.texteEXE+="node.getInputData();\n" + self.texteEXE+="node.setInputData(%s);\n"%self.dictValeur + self.texteEXE+="node.execute();\n" + self.texteEXE+="res=node.getOutputData();\n" + + + def initDico(self) : + if not hasattr(self,'schema') : self.schema="" + self.dictParam={} + self.dictValeur={} + + def writeDefault(self, fn): + fileEXE = fn[:fn.rfind(".")] + '.py' + f = open( str(fileEXE), 'wb') + f.write( self.texteEXE ) + f.close() + + def generMCSIMP(self,obj) : + """ + Convertit un objet MCSIMP en texte python + Remplit le dictionnaire des MCSIMP + """ + + if obj.getGenealogie()[0][-6:-1]=="_PARA": + self.dictParam[obj.nom]=obj.valeur + else : + self.dictValeur[obj.nom]=obj.valeur + s=PythonGenerator.generMCSIMP(self,obj) + return s + + + def generRUN(self,obj,schema): + if not(obj.isValid()) : + print ("TODO TODO TODO") + self.texteEXE="" + self.schema=schema + textComm=self.gener(obj) + return self.texteEXE diff --git a/generator/oldCodes/generator_mapVP.py b/generator/oldCodes/generator_mapVP.py new file mode 100644 index 00000000..a5b8ef4c --- /dev/null +++ b/generator/oldCodes/generator_mapVP.py @@ -0,0 +1,237 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module contient le plugin generateur de fichier au format + CARMEL3D pour EFICAS. + +""" +from __future__ import print_function +from __future__ import absolute_import +try : + from builtins import str +except : pass + +import traceback +import types,re,os +import Accas + +from .generator_python import PythonGenerator + +listeCalParName = ('Time' , 'Temperature', 'DoseRate', 'Thickness') #'calculation_parameter_names' + + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'MAPVp', + # La factory pour creer une instance du plugin + 'factory' : MapGenerator, + } + + +class MapGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format py + + """ + + def gener(self,obj,format='brut',config=None,appliEficas=None): + self.appliEficas=appliEficas + self.cata=self.appliEficas.readercata.cata + self.initDico() + self.text=PythonGenerator.gener(self,obj,format) + if obj.isValid() :self.genereTexte(obj) + return self.text + + def initDico(self) : + self.texteInput = "" + self.dictParam={} + self.dictValeur={} + self.listeEquations=[] + self.typeEtude = "" + + + def genereTexte(self,obj) : + print ('genereTexte', self.typeEtude) + if self.typeEtude == "Calculation" : self.genereCalculation() + + + def generPROC_ETAPE(self,obj): + s=PythonGenerator.generPROC_ETAPE(self,obj) + if obj.nom == "Calculation_for_Mechanistic" : print ('hjkhjkh');self.typeEtude="Calculation" + return s + + def genereCalculation(self) : + ''' + Prepare le contenu du fichier de parametres python + ''' + self.texteInput = "" + self.texteInput += self.genereCsv() + self.texteInput += self.genereCalculationParams() + self.texteInput += self.txtNomCst + self.texteInput += self.txtVal + self.texteInput += self.txtValAct + self.texteInput += self.txtNomCstNA + self.texteInput += self.txtValNA + self.texteInput += self.txtInitName + self.texteInput += self.txtInitVal + self.texteInput += self.genereEquations() + print (self.texteInput) + + def writeDefault(self, fn): + # normalement c_solver_polymer_kinetics_myStudy.input ou myStudy est le nom de l etude + fileInput = fn[:fn.rfind(".")] + '.input' + f = open( str(fileInput), 'wb') + f.write( self.texteInput ) + f.close() + + + def genereCalculationParams(self) : + txtNom = "calculation_parameter_names = [ " + txtVal = "calculation_parameters = [ " + for param in ('Time' , 'Temperature', 'DoseRate', 'Thickness') : + if param in self.dictValeur.keys() : + txtNom += "'"+param + "', " + txtVal += str(self.dictValeur[param]) + ", " + # on enleve les dernieres , et on ferme + txtNom = txtNom[0:-2] + txtNom += "]\n" + txtVal = txtVal[0:-2] + txtVal += "]\n" + txt = txtNom + txtVal + return txt + + def genereEquations(self) : + txt="equation =[" + index=0 + TechnicalUse = self.dictValeur['TechnicalUse'] + ModelName = self.dictValeur['ModelName'] + for param in self.listInitialParameters: + print ('*******************************************') + print (' je traite ', param , 'index : ', index) + trouveParam=False + + if index != 0 : txtParam = 'Dy[j*5 + '+str(index)+ '] = ' + else : txtParam = 'Dy[j*5] = ' + + for equation in self.listeEquations : + if param in (self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation].keys()): + print ('____________ trouve : ', param , 'in ', equation, ' ', self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]) + trouveParam = True + if self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param][0] == '-' : + txtParam += ' ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param] + else : + if index != 0 : + txtParam += ' + ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param] + else : + txtParam += self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param] + print (' txtParam intermediaire ', txtParam) + + if trouveParam : + txtParam = txtParam + ", " + txt += txtParam + index = index+1 + print (txtParam) + print ('fin param', param, 'trouve ', trouveParam, '___________________________') + print ('*************************************************') + print (' ') + print ('_________________fin for') + txt=txt[0:-3] + txt+="]\n" + return txt + + def genereCsv(self) : + txt = 'study_name = ' +self.dictValeur['SimulationName'] + "\n" + txt += 'csv_output_file_name = ' + self.dictValeur['OutPutFolder'] + '/c_solver_stiff_ode_1d_' + self.dictValeur['SimulationName']+ '.csv\n' + return txt + + + def generMCList(self,obj): + s=PythonGenerator.generMCList(self,obj) + if obj.nom == 'ConstantesArrhenius' : + self.txtNomCst = "Arrhenius_Name = [ " + self.txtVal = "Arrhenius_A = [ " + self.txtValAct = "Arrhenius_Ea = [ " + for objFils in obj.data: + for mc in objFils.mcListe : + self.txtNomCst += "'" + mc.nom + "', " + self.txtVal += str(mc.valeur[0]) + ", " + self.txtValAct += str(mc.valeur[1]) + ", " + self.txtNomCst = self.txtNomCst[0:-2] + self.txtVal = self.txtVal[0:-2] + self.txtValAct = self.txtValAct [0:-2] + self.txtNomCst += ']\n' + self.txtVal += ']\n' + self.txtValAct += ']\n' + + if obj.nom == 'ConstantesNonArrhenius' : + self.txtNomCstNA = "non_Arrhenius_coefs_names = [ " + self.txtValNA = "non_Arrhenius_coefs = [ " + for objFils in obj.data: + for mc in objFils.mcListe : + self.txtNomCstNA += "'" + mc.nom + "', " + self.txtValNA += str(mc.valeur) + ", " + self.txtNomCstNA = self.txtNomCstNA[0:-2] + self.txtValNA = self.txtValNA[0:-2] + self.txtNomCstNA += ']\n' + self.txtValNA += ']\n' + + if obj.nom == 'InitialParameters' : + self.listInitialParameters =[] + self.txtInitName = "initial_Value_names = [ " + self.txtInitVal = "initial_Values = [ " + for objFils in obj.data: + for mc in objFils.mcListe : + self.txtInitName += "'" + mc.nom + "', " + self.txtInitVal += str(mc.valeur) + ", " + self.listInitialParameters.append(mc.nom) + self.txtInitName = self.txtInitName[0:-2] + self.txtInitVal = self.txtInitVal[0:-2] + self.txtInitName += ']\n' + self.txtInitVal += ']\n' + + if obj.nom in( 'initiation','propagation','termination','stabilization') : + for o in obj : + for mc in o.mcListe : + nom=mc.nom.replace (' ','').replace ('+','_').replace ('-','_').replace ('>','_').replace('(','').replace(')','').replace('*','').replace('[','').replace(']','') + nom=obj.nom+'_'+nom + self.listeEquations.append(nom ) + return s + + def generMCSIMP(self,obj) : + """ + Convertit un objet MCSIMP en texte python + Remplit le dictionnaire des MCSIMP + """ + s=PythonGenerator.generMCSIMP(self,obj) + if obj.nom=='Consigne' : return s + + if obj.getGenealogie()[0][-6:-1]=="_PARA": + self.dictParam[obj.nom]=obj.valeur + else : + self.dictValeur[obj.nom]=obj.valeur + return s diff --git a/generator/oldCodes/generator_vers3DSalome.py b/generator/oldCodes/generator_vers3DSalome.py new file mode 100644 index 00000000..05b2dc14 --- /dev/null +++ b/generator/oldCodes/generator_vers3DSalome.py @@ -0,0 +1,243 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module contient le plugin generateur de fichier au format + python pour EFICAS. + PN + +""" +from __future__ import absolute_import +from __future__ import print_function +from __future__ import division +try : + from builtins import range +except : + pass +import traceback +import types,re +import math + +from Noyau import N_CR +from Noyau.N_utils import repr_float +import Accas +import Extensions +from Extensions.parametre import ITEM_PARAMETRE +from .Formatage import Formatage +from .generator_python import PythonGenerator +from six.moves import range +#from Editeur.widgets import showerror + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'vers3DSalome', + # La factory pour creer une instance du plugin + 'factory' : vers3DSalomeGenerator, + } + + +class vers3DSalomeGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet AFFE-CARA_ELEM + et produit un fichier au format texte contenant + les instructions idl pour PAL + """ + + def __init__(self,cr=None): + self.list_commandes=[]; + self.jdc=None + self.node=None + self.clefs=None + self.liste_motetat = ("AFFE_CARA_ELEM", "ORIG_AXE", "AXE" , + "BARRE", "CABLE", "CARA", "COQUE", "EPAIS", + "EXCENTREMENT", "GROUP_MA", "ORIENTATION", + "POUTRE", "SECTION", "VALE", "VARI_SECT", + "GRILLE", "ANGL_REP", "VECTEUR", + "b_constant", "b_homothetique", + "b_rectangle", "b_affine", "b_cercle", "b_generale" ) + self.dict_deb_com={"POUTRE":"VisuPoutre", "CABLE" : "VisuCable", + "COQUE" : "VisuCoque", "GRILLE" : "VisuGrille", + "ORIENTATION" : "Orientation", "BARRE" : "VisuBarre"} + + self.dict_suite_com={"RECTANGLE":"Rectangle","GENERALE":"Generale", + "CERCLE":"Cercle"} + + self.dict_traduit={"VARI_SECT":"extrusion","EXCENTREMENT":"Excentre","EPAIS":"Epais","VECTEUR":"Vecteur"} + + self.initLigne () + + def initJdc(self,jdc) : + self.jdc=jdc + + def initLigne (self) : + self.boolGpMa = 0 + self.commande = "" + self.dict_attributs = {} + + def gener(self,node,config=None,appliEficas=None): + """ + """ + self.node=node + self.list_commandes=[]; + self.generator(self.node.object) + return self.list_commandes + + def generator(self,obj): + if (obj.nom in self.liste_motetat) and (self.calculeOuiNon(obj)): + PythonGenerator.generator(self,obj) + """ + f1=PythonGenerator.generator(self,obj) + else : + return "" + """ + + def calculeOuiNon(self,obj): + ouinon=1 + for l in obj.getGenealogie() : + if not l in self.liste_motetat : + ouinon=0 + break + return ouinon + + + def generETAPE(self,obj): + """ + """ + if obj.isValid() == 0 : + #showerror("Element non valide","Salome ne sait pas traiter les elements non valides") + return + for v in obj.mcListe: + liste=self.generator(v) + + def generMACRO_ETAPE(self,obj): + """ + """ + if obj.isValid() == 0 : + #showerror("Element non valide","Salome ne sait pas traiter les elements non valides") + return + for v in obj.mcListe: + liste=self.generator(v) + + + def generMCSIMP(self,obj) : + """ + """ + if obj.nom in dir(self) : + suite = self.__class__.__dict__[obj.nom](self,obj) + else : + clef=self.dict_traduit[obj.nom] + # traitement des parametres + try : + self.dict_attributs[clef]=obj.val.eval() + except : + self.dict_attributs[clef]=obj.val + + + def generMCFACT(self,obj): + """ + Convertit un objet MCFACT en une liste de chaines de caracteres a la + syntaxe python + """ + self.initLigne () + self.commande=self.dict_deb_com[obj.nom] + for v in obj.mcListe: + self.generator(v) + if self.boolGpMa == 1: + self.list_commandes.append((self.commande,self.dict_attributs)) + else : + #showerror("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element") + print(("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element")) + pass + + def generMCList(self,obj): + """ + """ + for mcfact in obj.data: + self.generator(mcfact) + + def generMCBLOC(self,obj): + """ + """ + for v in obj.mcListe: + self.generator(v) + + def GROUP_MA(self,obj): + self.boolGpMa = 1 + self.dict_attributs["Group_Maille"]=obj.val + + def SECTION(self,obj): + assert (self.commande != "" ) + if self.commande == "VisuCable" : + self.dict_attributs["R"]= math.sqrt(obj.val/math.pi).eval() + elif (self.commande !="VisuGrille") : + self.commande=self.commande+self.dict_suite_com[obj.valeur] + + def CARA(self,obj) : + self.clefs=obj.val + if type(self.clefs) == bytes or type(self.clefs) == str: + self.clefs=(obj.val,) + + def VALE(self,obj) : + atraiter=obj.val + if len(self.clefs) > 1 : + assert (len(atraiter) == len(self.clefs)) + else : + atraiter=(atraiter,) + for k in range(len(atraiter)) : + clef=self.clefs[k] + val =atraiter[k] + if isinstance(val, (tuple, list)) and len(val) == 1: + val = val[0] + if isinstance (val, Extensions.parametre.PARAMETRE): + val=val.valeur + print(( val.__class)) + context={} + if type(val) == type("aaa") : + for p in self.jdc.params: + context[p.nom]=eval(p.val,self.jdc.const_context, context) + print((context[p.nom])) + res=eval(val,self.jdc.const_context, context) + val=res + self.dict_attributs[clef]=val + + def ANGL_REP(self,obj) : + assert (len(obj.val) == 2) + alpha,beta=obj.val + self.dict_attributs["angleAlpha"]=alpha + self.dict_attributs["angleBeta"]=beta + + def ORIG_AXE(self,obj) : + assert (len(obj.val) == 3) + alpha,beta,gamma=obj.val + self.dict_attributs["origAxeX"]=alpha + self.dict_attributs["origAxeY"]=beta + self.dict_attributs["origAxeZ"]=gamma + + def AXE(self,obj) : + assert (len(obj.val) == 3) + alpha,beta,gamma=obj.val + self.dict_attributs["axeX"]=alpha + self.dict_attributs["axeY"]=beta + self.dict_attributs["axeZ"]=gamma