From 32ceab9cca4d0d427b476c5aa5e9dffcfd4c11e1 Mon Sep 17 00:00:00 2001 From: Pascale Noyret Date: Wed, 13 May 2009 08:36:55 +0000 Subject: [PATCH] *** empty log message *** --- Sous_epaisseur/sdistSEP.py | 8 +- convert/convert_SEP.py | 39 ++++++++++ generator/generator_SEP.py | 100 +++++++++++++++++++++++++ generator/generator_openturns_study.py | 14 ---- {Sous_epaisseur => generator}/tube.py | 2 - 5 files changed, 142 insertions(+), 21 deletions(-) create mode 100644 convert/convert_SEP.py create mode 100644 generator/generator_SEP.py rename {Sous_epaisseur => generator}/tube.py (99%) diff --git a/Sous_epaisseur/sdistSEP.py b/Sous_epaisseur/sdistSEP.py index 9dec6f1b..abd21f2d 100644 --- a/Sous_epaisseur/sdistSEP.py +++ b/Sous_epaisseur/sdistSEP.py @@ -30,15 +30,13 @@ def main(): copyfiles('.',path_distrib,['LICENSE.TERMS','INSTALL','NEWS']) copyfiles('../Editeur',os.path.join(path_distrib,'Editeur'),['*.py','faqs.txt']) - copyfiles('../InterfaceQT4',os.path.join(path_distrib,'InterfaceQT'),['*.py','faqs.txt']) - copyfiles('../UiQT4',os.path.join(path_distrib,'Ui'),['*.ui','makefile']) - copyfiles('../SEP',os.path.join(path_distrib,'Openturns'),['*.py','*.ini']) + copyfiles('../InterfaceQT4',os.path.join(path_distrib,'InterfaceQT4'),['*.py','faqs.txt']) + copyfiles('../UiQT4',os.path.join(path_distrib,'UiQT4'),['*.ui','makefile']) + copyfiles('../Sous_epaisseur',os.path.join(path_distrib,'Sous_epaisseur'),['*.py','*.ini']) copyfiles('../Ihm',os.path.join(path_distrib,'Ihm'),['*.py']) copyfiles('../Extensions',os.path.join(path_distrib,'Extensions'),['*.py']) copyfiles('../Misc',os.path.join(path_distrib,'Misc'),['*.py']) copyfiles('../Accas',os.path.join(path_distrib,'Accas'),['*.py']) - copyfiles('../Accas',os.path.join(path_distrib,'Noyau'),['*.py']) - copyfiles('../Accas',os.path.join(path_distrib,'Validation'),['*.py']) # AIDE copyfiles('../AIDE',os.path.join(path_distrib,'AIDE'),['*.py']) copyfiles('../AIDE/fichiers',os.path.join(path_distrib,'AIDE','fichiers'),['*']) diff --git a/convert/convert_SEP.py b/convert/convert_SEP.py new file mode 100644 index 00000000..b318cea5 --- /dev/null +++ b/convert/convert_SEP.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# CONFIGURATION MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== +""" +""" + +import parseur_python +from convert_python import * + +def entryPoint(): + """ + Retourne les informations nécessaires pour le chargeur de plugins + Ces informations sont retournées dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'SEP', + # La factory pour créer une instance du plugin + 'factory' : PythonParser, + } + + diff --git a/generator/generator_SEP.py b/generator/generator_SEP.py new file mode 100644 index 00000000..7439809a --- /dev/null +++ b/generator/generator_SEP.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +# CONFIGURATION MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== +""" + Ce module contient le plugin generateur de fichier au format + SEP pour EFICAS. + +""" +import traceback +import types,string,re,os + +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' : 'SEP', + # La factory pour creer une instance du plugin + 'factory' : SEPGenerator, + } + + +class SEPGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format py + + """ + # Les extensions de fichier permis? + extensions=('.comm',) + + def gener(self,obj,format='brut'): + self.initDico() + self.text=PythonGenerator.gener(self,obj,format) + self.genereSEP() + return self.text + + def getTubePy(self) : + return self.texteTubePy + + def genereSEP(self) : + self.texteTubePy="# Parametres generes par Eficas \n" + for MC in self.dictMCVal.keys(): + ligne = MC +"="+ repr(self.dictMCVal[MC])+'\n' + self.texteTubePy=self.texteTubePy+ligne + print self.texteTubePy + + fichier=os.path.join(os.path.dirname(__file__),"tube.py") + f=open(fichier,'r') + for ligne in f.readlines(): + self.texteTubePy=self.texteTubePy+ligne + f.close + + def initDico(self) : + self.tube=0 + self.coude=0 + self.dictMCVal={} + self.texteTubePy="" + + def generMCSIMP(self,obj) : + """ + Convertit un objet MCSIMP en texte python + Remplit le dictionnaire des MCSIMP si nous ne sommes ni dans une loi, ni dans une variable + """ + s=PythonGenerator.generMCSIMP(self,obj) + self.dictMCVal[obj.nom]=obj.valeur + return s + + def generMACRO_ETAPE(self,obj): + print obj.nom + if obj.nom == "M_TUBE" : + self.tube=1 + if obj.nom == "M_COUDE" : + self.coude=1 + s=PythonGenerator.generMACRO_ETAPE(self,obj) + return s + diff --git a/generator/generator_openturns_study.py b/generator/generator_openturns_study.py index 8a76087b..1023eb90 100644 --- a/generator/generator_openturns_study.py +++ b/generator/generator_openturns_study.py @@ -87,20 +87,6 @@ class OpenturnsGenerator(PythonGenerator): self.dictTempo[obj.nom]=obj.valeur return s -# def generMCFACT(self,obj): -# # Il n est pas possible d utiliser obj.valeur qui n est pas -# # a jour pour les nouvelles variables ou les modifications -# if obj.nom in ( "Variables", "Files", ) : -# self.TraiteMCSIMP=0 -# self.dictTempo={} -# s=PythonGenerator.generMCFACT(self,obj) -# if obj.nom in ( "Variables", ) : -# self.listeVariables.append(self.dictTempo) -# self.dictTempo={} -# else : -# self.listeFichiers.append(self.dictTempo) -# self.TraiteMCSIMP=1 -# return s def generETAPE(self,obj): print "IDM: generETAPE dans generator_openturns_study.py" diff --git a/Sous_epaisseur/tube.py b/generator/tube.py similarity index 99% rename from Sous_epaisseur/tube.py rename to generator/tube.py index 39f118d9..b353d8ff 100644 --- a/Sous_epaisseur/tube.py +++ b/generator/tube.py @@ -1,11 +1,9 @@ - # ========== # PARAMETRES # ========== # methode de filling: par les generatrices ou par des ecailles de tortue -methode = "tortue" # "generatrices" ou "tortue" # Longueur longueur_tube = 6363.655 -- 2.39.2