From: Pascale Noyret Date: Tue, 18 Nov 2008 15:53:12 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V0_a1_SEPQT4~70 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8644284a5187dac1da5e3dd49c874be95aa54512;p=modules%2Feficas.git *** empty log message *** --- diff --git a/Aster/configuration.py b/Aster/configuration.py index 476be419..6ff5ceff 100644 --- a/Aster/configuration.py +++ b/Aster/configuration.py @@ -44,6 +44,7 @@ class CONFIGbase: self.dRepMat={} if self.appli: self.parent=appli.top + self.appli.format_fichier="python" else: self.parent=None self.rep_user = utils.get_rep_user() diff --git a/Aster/qtEficas_aster.py b/Aster/qtEficas_aster.py index e3736bd6..dd0072a7 100755 --- a/Aster/qtEficas_aster.py +++ b/Aster/qtEficas_aster.py @@ -27,6 +27,6 @@ # Modules Eficas import prefs -from InterfaceQT import eficas_go +from InterfaceQT4 import eficas_go eficas_go.lance_eficas(code=prefs.code) diff --git a/Editeur/Patrons/OPENTURNS/Anne.comm b/Editeur/Patrons/OPENTURNS/Anne.comm deleted file mode 100644 index ebb124cc..00000000 --- a/Editeur/Patrons/OPENTURNS/Anne.comm +++ /dev/null @@ -1,38 +0,0 @@ - -L_E=DISTRIBUTION(Kind='Normal', - Mu=12, - Sigma=0.5,); - -L_L=DISTRIBUTION(Kind='LogNormal', - Settings='MuSigmaOverMu', - Gamma=0.0,); - -STUDY(Analysis='Reliability', - Algorithm='SORM', - Method='Cobyla', - Threshold=5.0, - ComparisonOperator='Less', - SeedToBeSet='no', - Variables=(_F(Name='E', - Type='in', - MarginalDistribution=L_E,), - _F(Name='L', - Type='in', - MarginalDistribution=L_L,), - _F(Name='O', - Type='out',),), - Solver='aaa', - WrapperPath='aster.so', - FunctionName='aster', - WrapCouplingMode='fork', - Command='/usr/bin/runaster', - InDataTransfer='files', - OutDataTransfer='files', - Files=(_F(Id='fich1', - Type='in', - Path='../fich_entree', - Subst='E,L',), - _F(Id='fich2', - Type='out', - Path='fich_sortie', - Subst='O',),),); diff --git a/Editeur/basestyle.py b/Editeur/basestyle.py new file mode 100644 index 00000000..e4287b75 --- /dev/null +++ b/Editeur/basestyle.py @@ -0,0 +1,27 @@ +class STYLE: + 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/comploader.py b/Editeur/comploader.py index b20bfa9f..e75d492e 100644 --- a/Editeur/comploader.py +++ b/Editeur/comploader.py @@ -49,8 +49,8 @@ def charger_composants(Ihm="TK"): repertoire=reper+"/../InterfaceTK" package="InterfaceTK" else : - repertoire=reper+"/../InterfaceQT" - package="InterfaceQT" + repertoire=reper+"/../InterfaceQT4" + package="InterfaceQT4" listfich=glob.glob(os.path.join(repertoire, "compo*.py")) for fichier in listfich: m= os.path.basename(fichier)[:-3] diff --git a/Editeur/comploaderqt4.py b/Editeur/comploaderqt4.py new file mode 100644 index 00000000..e75d492e --- /dev/null +++ b/Editeur/comploaderqt4.py @@ -0,0 +1,99 @@ +# -*- 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. +# +# +# ====================================================================== +""" + Module de chargement des composants et de mapping des objets du noyau + Accas vers les items d'EFICAS + + - composants : dictionnaire de stockage des relations entre types + d'objet du noyau et types d'item + - charger_composants() : fonction de chargement des composants. Retourne + le dictionnaire composants. + - gettreeitem(object) -> type d'item : fonction qui retourne un type + d'item correspondant au type de l'objet noyau fourni. + - make_objecttreeitem(appli,labeltext, object, setfunction=None) -> item : fonction qui retourne un item + correspondant à l'objet noyau fourni. +""" +# import généraux +import os,glob,types + +# Dictionnaire {object : item} permettant d'associer un item à un object +# Ce dictionnaire est renseigné par la méthode charger_composants +composants = {} + +def charger_composants(Ihm="TK"): + """ + Cette fonction a pour but de charger tous les modules composants graphiques + (fichiers compo*.py dans le même répertoire que ce module ) + et de remplir le dictionnaire composants utilisé par make_objecttreeitem + """ + reper=os.path.dirname(__file__) + if Ihm == "TK" : + repertoire=reper+"/../InterfaceTK" + package="InterfaceTK" + else : + repertoire=reper+"/../InterfaceQT4" + package="InterfaceQT4" + listfich=glob.glob(os.path.join(repertoire, "compo*.py")) + for fichier in listfich: + m= os.path.basename(fichier)[:-3] + module=__import__(package,globals(),locals(),[m]) + module = getattr(module, m) + composants[module.objet]=module.treeitem + return composants + +def gettreeitem(object): + """ + Cette fonction retourne la classe item associée à l'objet object. + Cette classe item dépend bien sûr de la nature de object, d'où + l'interrogation du dictionnaire composants + """ + # Si la definition de l'objet a un attribut itemeditor, il indique + # la classe a utiliser pour l'item + try: + return object.definition.itemeditor + except: + pass + + # On cherche ensuite dans les composants (plugins) + try: + itemtype= composants[object.__class__] + return itemtype + except: + pass + + # Puis une eventuelle classe heritee (aleatoire car sans ordre) + for e in composants.keys(): + if e and isinstance(object,e): + itemtype= composants[e] + return itemtype + + # Si on n'a rien trouve dans les composants on utilise l'objet par defaut + itemtype=composants[None] + return itemtype + +def make_objecttreeitem(appli,labeltext, object, setfunction=None): + """ + Cette fonction permet de construire et de retourner un objet + de type item associé à l'object passé en argument. + """ + c = gettreeitem(object) + return c(appli,labeltext, object, setfunction) + diff --git a/Editeur/fontes.py b/Editeur/fontes.py new file mode 100644 index 00000000..8e158927 --- /dev/null +++ b/Editeur/fontes.py @@ -0,0 +1,36 @@ +# -*- 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. +# +# +# ====================================================================== +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 index 9dec4a20..004d3456 100644 --- a/Editeur/import_code.py +++ b/Editeur/import_code.py @@ -23,15 +23,29 @@ les imports de modules Python """ import sys +import os + import prefs +INSTALLDIR=prefs.INSTALLDIR +sys.path.append(INSTALLDIR) +sys.path.append(INSTALLDIR+"/UiQT4") +sys.path.append(INSTALLDIR+"/InterfaceQT4") +sys.path.append(INSTALLDIR+"/Editeur") + # Ce chemin permet d'importer les modules Noyau et Validation # représentant le code utilisé (si fourni) -if prefs.CODE_PATH: - sys.path[:0]=[prefs.CODE_PATH] - import Noyau,Validation - del sys.path[0] - # Ensuite on utilise les packages de l'intallation +if hasattr(prefs,'CODE_PATH'): + if prefs.CODE_PATH: + sys.path[:0]=[prefs.CODE_PATH] + import Noyau,Validation + del sys.path[0] sys.path[:0]=[prefs.INSTALLDIR] + +# Ensuite on surcharge eventuellement +#if hasattr(prefs,'CODE_PATH_SURCHARGE'): +# if prefs.CODE_PATH_SURCHARGE: +# sys.path.insert(0,prefs.CODE_PATH_SURCHARGE) + import Accas diff --git a/Editeur/listePatrons.py b/Editeur/listePatrons.py index eeccfb2f..d6dbe89b 100644 --- a/Editeur/listePatrons.py +++ b/Editeur/listePatrons.py @@ -17,6 +17,7 @@ class listePatrons : self.traite_liste() def traite_liste(self): + if not (os.path.exists(self.rep_patrons)) : return for file in os.listdir(self.rep_patrons): for i in range(len(self.sous_menu)): clef=self.sous_menu[i].keys()[0] diff --git a/Editeur/styles.py b/Editeur/styles.py new file mode 100644 index 00000000..2d5fc4a2 --- /dev/null +++ b/Editeur/styles.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +import os +import prefs +import basestyle +from basestyle import STYLE,style + +inistylefile=os.path.join(prefs.REPINI,"style.py") +if os.path.isfile(inistylefile): + execfile(inistylefile) + +userstylefile=os.path.expanduser("~/Eficas_install/style.py") +if os.path.isfile(userstylefile): + execfile(userstylefile) + +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/Openturns/Open_Cata_IDM_V5.py b/Openturns/Open_Cata_IDM_V5.py deleted file mode 100644 index 38940769..00000000 --- a/Openturns/Open_Cata_IDM_V5.py +++ /dev/null @@ -1,1266 +0,0 @@ -# -*- coding: utf-8 -*- - -# -------------------------------------------------- -# debut entete -# -------------------------------------------------- - -import Accas -from Accas import * - -class loi ( ASSD ) : pass - - -#CONTEXT.debug = 1 -JdC = JDC_CATA ( code = 'OPENTURNS', - execmodul = None, - regles = ( AU_MOINS_UN ( 'STUDY' ), ), - ) # Fin JDC_CATA - -# -------------------------------------------------- -# fin entete -# -------------------------------------------------- - -# 3. Version d OPENTURNS ? - -#=========================================================== - - -#================================ -# 1. Definition des LOIS -#================================ - -# Nota : les variables de type OPER doivent etre en majuscules ! -DISTRIBUTION = OPER ( nom = "DISTRIBUTION", - sd_prod = loi, - op = 68, - fr = "Definitions des lois marginales utilisees par les variables d'entree", - - -#==== -# 2. Type de la loi de distribution -#==== - - Kind = SIMP ( statut = "o", typ = "TXM", - into = ( "Beta", - "Exponential", - "Gamma", - "Geometric", - "Gumbel", - "Histogram", - "Logistic", - "LogNormal", - "MultiNomial", - "Normal", - "TruncatedNormal", - "Poisson", - "Student", - "Triangular", - "Uniform", - "UserDefined", - "Weibull", - ), - fr = "Choix du type de la loi marginale", - ang = "1D marginal distribution." ), - -#==== -# 3. Definition des parametres selon le type de la loi -#==== - -# 3.1. ==> Loi beta - - BETA = BLOC ( condition = " Kind in ( 'Beta', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "RT", "MuSigma" ), - defaut = "RT", - fr = "Parametrage de la loi beta", - ang = "Beta distribution parameter set" - ), - - RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ", - - R = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre R de la loi", - ang = "R parameter" - ), - - # T > R - T = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre T de la loi | T > R", - ang = "T parameter | T > R" - ), - - ), # Fin BLOC RT_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre A de la loi", - ang = "A parameter" - ), - - # B > A - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre B de la loi | B > A", - ang = "B parameter | B > A" - ), - - ), # Fin BLOC BETA - -# 3.2. ==> Loi exponentielle - - EXPONENTIAL = BLOC ( condition = " Kind in ( 'Exponential', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC EXPONENTIAL - -# 3.3. ==> Loi gamma - - GAMMA = BLOC ( condition = " Kind in ( 'Gamma', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "KLambda", "MuSigma" ), - defaut = "KLambda", - fr = "Parametrage de la loi gamma", - ang = "Gamma distribution parameter set" - ), - - KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ", - - K = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre K de la loi | K > 0", - ang = "K parameter | K > 0" - ), - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - ), # Fin BLOC KLambda_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 0.0, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 1.0, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - - ), # Fin BLOC GAMMA - -# 3.5. ==> Loi geometrique - - GEOMETRIC = BLOC ( condition = " Kind in ( 'Geometric', ) ", - - P = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - val_max = 1., - fr = "Parametre P | 0 < P < 1", - ang = "P parameter | 0 < P < 1" - ), - - ), # Fin BLOC GEOMETRIC - -# 3.6. ==> Loi gumbel - - GUMBEL = BLOC ( condition = " Kind in ( 'Gumbel', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi gumbel", - ang = "Gumbel distribution parameter set" - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Beta de la loi", - ang = "Beta parameter" - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - ), # Fin BLOC GUMBEL - -# 3.7. ==> Loi histogramme - - HISTOGRAM = BLOC ( condition = " Kind in ( 'Histogram', ) ", - - Sup = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la distribution", - ang = "Upper bound" - ), - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC HISTOGRAM - -# 3.8. ==> Loi lognormale - - LOGNORMAL = BLOC ( condition = " Kind in ( 'LogNormal', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ), - defaut = "MuSigmaLog", - fr = "Parametrage de la loi lognormale", - ang = "Lognormal distribution parameter set" - ), - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', 'MuSigmaOverMu' ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi | Mu > Gamma", - ang = "Mu parameter | Mu > Gamma" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ", - - MuLog = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu log de la loi", - ang = "Mu log parameter" - ), - - SigmaLog = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma log de la loi | SigmaLog > 0", - ang = "Sigma log parameter | SigmaLog > 0" - ), - - ), # Fin BLOC MuSigmaLog_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC LOGNORMAL - -# 3.9. ==> Loi logistique - - LOGISTIC = BLOC ( condition = " Kind in ( 'Logistic', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Alpha de la loi", - ang = "Alpha parameter" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > = 0", - ang = "Beta parameter | Beta > = 0" - ), - - ), # Fin BLOC LOGISTIC - -# 3.10. ==> Loi multinomiale - - MULTINOMIAL = BLOC ( condition = " Kind in ( 'MultiNomial', ) ", - - N = SIMP ( statut = "o", - typ = "E", - max = 1, - fr = "Dimension de la loi", - ang = "DISTRIBUTION dimension" - ), - - # Il faut un vecteur P de taille N - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC MULTINOMIAL - -# 3.11. ==> Loi normale - - NORMAL = BLOC ( condition = " Kind in ( 'Normal', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC NORMAL - -# 3.12. ==> Loi Poisson - - POISSON = BLOC ( condition = " Kind in ( 'Poisson', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - ), # Fin BLOC POISSON - -# 3.13. ==> Loi student - - STUDENT = BLOC ( condition = " Kind in ( 'Student', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Nu = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 2., - fr = "Parametre Nu de la loi | V > = 2", - ang = "Nu parameter | V > = 2" - ), - - ), # Fin BLOC STUDENT - -# 3.14. ==> Loi triangulaire - - TRIANGULAR = BLOC ( condition = " Kind in ( 'Triangular', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = M < = B", - ang = "Lower bound | A < = M < = B" - ), - - M = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Mode de la loi | A < = M < = B", - ang = "Mode | A < = M < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = M < = B", - ang = "Upper bound | A < = M < = B" - ), - - ), # Fin BLOC TRIANGULAR - -# 3.15. ==> Loi normale tronquee - - TRUNCATEDNORMAL = BLOC ( condition = " Kind in ( 'TruncatedNormal', ) ", - - MuN = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - SigmaN = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre SigmaN de la loi | SigmaN > 0", - ang = "SigmaN parameter | SigmaN> 0" - ), - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B" - ), - - ), # Fin BLOC TRUNCATEDNORMAL - -# 3.16. ==> uniforme - - UNIFORM = BLOC ( condition = " Kind in ( 'Uniform', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B" - ), - - ), # Fin BLOC UNIFORM - -# 3.17. ==> Loi definie par l'utilisateur - - USERDEFINED = BLOC ( condition = " Kind in ( 'UserDefined', ) ", - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC USERDEFINED - -# 3.18. ==> Weibull - - WEIBULL = BLOC ( condition = " Kind in ( 'Weibull', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi weibull", - ang = "Weibull distribution parameter set" - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > 0", - ang = "Beta parameter | Beta > 0" - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC WEIBULL - -); # Fin OPER DISTRIBUTION - -#================================ -# 2. Definition du cas d'etude -#================================ -# Nota : les variables de type PROC doivent etre en majuscules ! -STUDY = PROC ( nom = "STUDY", - op = None, - docu = "", - fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", - ang = "Writes the configuration file for OPENTURNS.", - - -#===== -# 1. Le Type d'Analyse -#===== - - Analysis = SIMP ( statut = "o", - typ = "TXM", - into = ( "Reliability", "Simulation", "QuadraticCumul" ), - fr = "Type d'Analyse", - ang = "Analysis", - ), - -#===== -# 2. Pour la probabilite -# algorithme et mode choisis -#===== - - Reliability = BLOC ( condition = " Analysis in ( 'Reliability', ) ", - -# 2.1. ==> L'algorithme - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "FORM", "SORM" ), - fr = "Algorithme de fiabilite", - ang = "Reliability algorithm" - ), - -# 2.2. ==> La methode -# 2.2.1. ==> La methode - - Method = SIMP ( statut = "o", - typ = "TXM", - into = ( "Cobyla", "AbdoRackwitz" ), - fr = "Methode d'optimisation.", - ang = "Optimisation method." - ), - -# 2.2.1. ==> Tirage d'importance - - ImportanceSampling = SIMP ( statut = "o", - typ = "TXM", - into = ( "yes", "no" ), - defaut = "no", - fr = "Tirage d'importance autour du point de conception", - ang = "Importance sampling around design point" - ), - -### -### Il faut definir ces 3 elements pour ImportanceSampling sans collisioner ceux de Simulation -### - ImportanceSamplingSettings = BLOC ( condition = "ImportanceSampling in ( 'yes', )", -# 3.1.2. ==> Nombre d... - - ImportanceSampling_BlockSize = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - defaut = 1, - fr = "Nombre maximum ...", - ang = "Maximum number of ..." - ), - -# 3.2.3. ==> ... maximum ... - - ImportanceSampling_MaximumCoefficientOfVariation = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " maximum ...", - ang = "Absolute maximum ...." - ), - -# 3.2.4. ==> Maximum d'iterations - - ImportanceSampling_MaximumOuterSampling = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = "Maximum d iterations externes.", - ang = "Maximum outer Sampling value." - ), - - ), # Fin BLOC ImportanceSamplingSettings - - -# 2.2.2. ==> Regles - - regles = ( EXCLUS ( "MaximumAbsoluteError", "RelativeAbsoluteError" ), ), - -# 2.2.3. ==> Nombre d'iterations - - MaximumIterationsNumber = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = "Nombre maximum d iterations.", - ang = "Maximum number of iterations." - ), - -# 2.2.4. ==> Erreur maximum absolue - - MaximumAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Distance maximum absolue entre 2 iterations successifs.", - ang = "Absolute maximum distance between 2 successive iterates." - ), - -# 2.2.5. ==> Erreur maximum relative - - RelativeAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Distance maximum relative entre 2 iterations successifs.", - ang = "Relative maximum distance between 2 successive iterates." - ), - -# 2.2.6. ==> Ecart de contrainte absolu - - MaximumConstraintError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Valeur maximum absolue de la fonction \ - moins la valeur du niveau.", - ang = "Maximum absolute value of the constraint function \ - minus the level value." - ), - -# 2.2.7. ==> Ecart de residu absolu - - MaximumResidualError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Maximum orthogonality error.", - ang = "Maximum orthogonality error." - ), - - ), # Fin BLOC Reliability - -#===== -# 3. Pour la probabilite -# seuil par simulation : -# algorithme choisi -#===== - - Simulation = BLOC ( condition = " Analysis in ( 'Simulation', ) ", - -# 3.1. ==> L'algorithme - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "MonteCarlo", "LHS", "DirectionalSampling" ), - fr = "Algorithme de simulation", - ang = "Simulation algorithm" - ), - -# 3.1.2. ==> Nombre d... - - BlockSize = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - defaut = 1, - fr = "Nombre maximum ...", - ang = "Maximum number of ..." - ), - -# 3.2.3. ==> ... maximum ... - - MaximumCoefficientOfVariation = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " maximum ...", - ang = "Absolute maximum ...." - ), - -# 3.2.4. ==> Maximum d'iterations - - MaximumOuterSamplingType = SIMP ( statut = "o", - typ = "TXM", - max = 1, - defaut = "UserDefined", - into = ( "Wilks", "UserDefined" ), - fr = "Mode definition du maximum d iterations", - ang = "Definition for the maximum iterations number" - ), - - MaximumOuterSamplingType_Wilks = BLOC ( condition = " MaximumOuterSamplingType in ( 'Wilks', ) ", - - Wilks_Alpha = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - val_max = 1.0, - defaut = 0.95, - fr = "Ordre du quantile.", - ang = "Order of the quantile." - ), - - Wilks_Beta = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - val_max = 1.0, - defaut = 0.90, - fr = "Confiance ...", - ang = "Confidence ..." - ), - - Wilks_I = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 0, - defaut = 0, - fr = " ...", - ang = "Rank ..." - ), - - ), # Fin BLOC Wilks - - MaximumOuterSamplingType_UserDefined = BLOC ( condition = " MaximumOuterSamplingType in ( 'UserDefined', ) ", - - MaximumOuterSampling = SIMP ( statut = "o", - typ = "I", - max = 1, - val_min = 1, - defaut = 250, - fr = "Maximum d iterations externes.", - ang = "Maximum outer Sampling value." - ), - - ), # Fin BLOC UserDefined - -# 3.2.6. ==> Root strategy - - DirectionalSampling = BLOC ( condition = " Algorithm in ( 'DirectionalSampling', ) ", - - RootStrategy = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "SafeAndSlow", - into = ( "RiskyAndFast", "MediumSafe", "SafeAndSlow" ), - fr = "La strategie de recherche des racines", - ang = "Root strategy." - ), - - SamplingStrategy = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "SafeAndSlow", - into = ( "OrthogonalDirection", "RandomDirection" ), - fr = "La strategie d'echantillonage", - ang = "Sampling strategy." - ), - - Solver = SIMP ( statut = "o", - typ = "TXM", - max = 1, - defaut = "Brent", - into = ( "Bisection", "Brent", "Secant" ), - fr = "Solver.", - ang = "Solver." - ), - - SolverSettings = BLOC ( condition = " Solver in ( 'Bisection', 'Brent', 'Secant' ) ", - - regles = ( ENSEMBLE ( 'AbsoluteError', 'RelativeError', 'maximumFunctionEvaluation' ), ), - - AbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " Absolute error ...", - ang = "Absolute error ..." - ), - - RelativeError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " Relative error ...", - ang = "Relative error ..." - ), - - MaximumFunctionEvaluation = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = " maximum Function Evaluation ...", - ang = "maximum Function Evaluation ..." - ), - - ), # Fin BLOC SolverSettings - - ), # Fin BLOC DirectionalSampling - -# 3.2.7. ==> Impression des intervalles de confiance - - ConfidenceIntervalProbability = SIMP ( statut = "f", - typ = 'R', - max = '**', - val_min = 0., - val_max = 1., - fr = "Liste des intervalles de confiance voulus", - ang = "Confidence intervals" - ), - - ), # Fin BLOC Simulation - -# QuadraticCumul = BLOC ( condition = " Analysis in ( 'QuadraticCumul', ) ", - -# ), # Fin BLOC QuadraticCumul - -#===== -# 4. Pour la probabilite evenement -#===== - - Event = BLOC ( condition = " Analysis in ( 'Reliability', 'Simulation' ) ", - - Threshold = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Le seuil de defaillance.", - ang = "Failure threshold." - ), - - ComparisonOperator = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "Less", "LessOrEqual", "Equal", "GreaterOrEqual", "Greater" ), - fr = "Que faut-il ne pas depasser : un maximum ou un minimum.", - ang = "What is the failure threshold : maximum or minimum." - ), - - ), # Fin BLOC Event - - - RandomGenerator = BLOC ( condition = " Analysis in ( 'Reliability', 'Simulation' ) ", - - SeedToBeSet = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "La racine du generateur aleatoire doit-elle etre positionnee ?", - ang = "Does the random generator seed need to be set ?" - ), - - SeedSettings = BLOC ( condition = " SeedToBeSet in ( 'yes', ) ", - - RandomGeneratorSeed = SIMP ( statut = "o", - typ = "I", - max = 1, - fr = "Racine du generateur aleatoire", - ang = "Random generator seed" - ), - - ), # Fin BLOC SeedSettings - - ), # Fin BLOC RandomGenerator - - -#==== -# 5. Definition des parametres -#==== - - Variables = FACT ( statut = "o", - min = 1, - max = "**", - -# 5.1. ==> Nom de la variable - - Name = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Nom de la variable, identique au nom dans le solver.", - ang = "Name of the variable, identical to the name in solver." - ), - - Type = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "in", "out", ), - defaut = "in", - fr = "variable d'entree ou de sortie du solver", - ang = "Input or Output variable", - ), - - Unit = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Unite", - ang = "Unit", - ), - - Comment = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Commentaire", - ang = "Comment", - ), - - Regexp = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Expression reguliere", - ang = "Regular expression", - ), - - Format = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Format d'ecriture", - ang = "Format", - ), - -# 5.2. ==> Variable d'entree -# 5.2.1. ==> Loi de distribution - - InputVariable = BLOC ( condition = " Type in ( 'in', ) ", - - MarginalDistribution = SIMP ( statut = "o", - typ = ( loi, ), - max = 1, - fr = "Choix de la loi marginale", - ang = "1D marginal distribution." - ), - -# 5.2.2. ==> Parametres de calcul - -# 5.2.2.1. ==> Quand on cherche le point de conception, on peut preferer le depart de l'algorithme. -# Si on ne le fait pas, le programme prendra la valeur mediane. - - PhysicalStartingPoint = SIMP ( statut = "f", - typ = "R", - max = 1, - fr = "Point de demarrage de l'algorithme iteratif", - ang = "Initial point for iterative process." - ), - -# 5.2.2.2. ==> Mode d'obtention du gradient par rapport au parametre - - Gradient = SIMP ( statut = "f", - typ = "TXM", - max = 1, - into = ( "OUI", "NON" ), - defaut = "NON", - fr = "ASTER calcule directement le gradient.", - ang = "ASTER computes the gradient for this parameter." - ), - - GradientProvided = BLOC ( condition = " GRADIENT in ( 'NON', ) ", - - Increment = SIMP ( statut = "f", - typ = "R", - max = 1, - fr = "Increment dans la direction.", - ang = "Direction increment." - ), - ), # Fin BLOC GradientProvided - - ), # Fin BLOC InputVariable - - ), # Fin FACT Variables - -#==== -# 6. La fonction -#==== - - - PhysicalSolver = SIMP ( statut = "o", - typ = "TXM", - max = 1, - #into = ( "Code_Aster", "Code_Saturne", "User_defined" ), - fr = "Nom du solveur de calcul", - ang = "Solver name" - ), - - WrapperPath = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "chemin d acces au wrapper", - ang = "wrapper library path" - ), - - FunctionName = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Nom de la fonction dans le wrapper", - ang = "Function's name in wrapper" - ), - - GradientName = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du gradient dans le wrapper", - ang = "gradient's name in wrapper" - ), - - HessianName = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du hessian dans le wrapper", - ang = "hessian's name in wrapper" - ), - - WrapCouplingMode = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "static-link", "dynamic-link", "fork", ), - fr = "mode de couplage du solver", - ang = "Solver coupling mode" - ), - - DTDDirectory = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "repertoire de la DTD", - ang = "DTD directory" - ), - - Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", - - Command = SIMP ( statut = "o", - max = 1, - typ = "TXM", - fr = "Chemin du solver", - ang = "solver path" - ), - ), # Fin BLOC Fork - - State = SIMP ( statut = "f", - typ = "TXM", - max = 1, - into = ( "shared", "specific" ), - fr = "partage de l etat interne entre les fonctions", - ang = "internal state sharing" - ), - - InDataTransfer = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "files", "pipe", "arguments", "socket", "CORBA", ), - fr = "mode de transfert des donnees d entree", - ang = "input transfering mode" - ), - - OutDataTransfer = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "files", "pipe", "arguments", "socket", "CORBA", ), - fr = "mode de transfert des donnees de sortie", - ang = "output transfering mode" - ), - - - -#==== -# 7. Informations sur les fichiers d'echange -#==== - - Files = FACT ( statut = "f", - min = 1, - max = "**", - - Id = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Identificateur du fichier", - ang = "File id" - ), - - Type = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "in", "out", ), - fr = "Fichier d entree ou de sortie du solveur ?", - ang = "Input or Output file ?" - ), - - Name = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du fichier", - ang = "file name" - ), - - Path = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "chemin du fichier", - ang = "path file " - ), - - Subst = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "liste de variables", - ang = "list" - ), - - ), # Fin FACT Files - -); # Fin PROC STUDY - -RESULT = PROC ( nom = "RESULT", - op = None, - docu = "", - fr = "Liste des resultats a produire", - ang = "List of results to write out", - - GeneralizedReliabilityIndex = SIMP ( statut = "o", - typ = "TXM", - into = ( "yes", "no" ), - defaut = "no", - max = 1, - fr = "Index de fiabilite generalise", - ang = "Generalized reliability index" - ), - -); # Fin PROC Result - diff --git a/Openturns/Open_Cata_IDM_V6.py b/Openturns/Open_Cata_IDM_V6.py deleted file mode 100644 index fde985de..00000000 --- a/Openturns/Open_Cata_IDM_V6.py +++ /dev/null @@ -1,1202 +0,0 @@ -# -*- coding: utf-8 -*- - -# -------------------------------------------------- -# debut entete -# -------------------------------------------------- - -import Accas -from Accas import * - -class loi ( ASSD ) : pass - - -#CONTEXT.debug = 1 -JdC = JDC_CATA ( code = 'OPENTURNS', - execmodul = None, - regles = ( AU_MOINS_UN ( 'STUDY' ), ), - ) # Fin JDC_CATA - -# -------------------------------------------------- -# fin entete -# -------------------------------------------------- - -# 3. Version d OPENTURNS ? - -#=========================================================== - - -#================================ -# 1. Definition des LOIS -#================================ - -# Nota : les variables de type OPER doivent etre en majuscules ! -DISTRIBUTION = OPER ( nom = "DISTRIBUTION", - sd_prod = loi, - op = 68, - fr = "Definitions des lois marginales utilisees par les variables d'entree", - - -#==== -# 2. Type de la loi de distribution -#==== - - Kind = SIMP ( statut = "o", typ = "TXM", - into = ( "Beta", - "Exponential", - "Gamma", - "Geometric", - "Gumbel", - "Histogram", - "Logistic", - "LogNormal", - "MultiNomial", - "Normal", - "TruncatedNormal", - "Poisson", - "Student", - "Triangular", - "Uniform", - "UserDefined", - "Weibull", - ), - fr = "Choix du type de la loi marginale", - ang = "1D marginal distribution." ), - -#==== -# 3. Definition des parametres selon le type de la loi -#==== - -# 3.1. ==> Loi beta - - BETA = BLOC ( condition = " Kind in ( 'Beta', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "RT", "MuSigma" ), - defaut = "RT", - fr = "Parametrage de la loi beta", - ang = "Beta distribution parameter set" - ), - - RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ", - - R = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre R de la loi", - ang = "R parameter" - ), - - # T > R - T = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre T de la loi | T > R", - ang = "T parameter | T > R" - ), - - ), # Fin BLOC RT_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre A de la loi", - ang = "A parameter" - ), - - # B > A - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre B de la loi | B > A", - ang = "B parameter | B > A" - ), - - ), # Fin BLOC BETA - -# 3.2. ==> Loi exponentielle - - EXPONENTIAL = BLOC ( condition = " Kind in ( 'Exponential', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC EXPONENTIAL - -# 3.3. ==> Loi gamma - - GAMMA = BLOC ( condition = " Kind in ( 'Gamma', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "KLambda", "MuSigma" ), - defaut = "KLambda", - fr = "Parametrage de la loi gamma", - ang = "Gamma distribution parameter set" - ), - - KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ", - - K = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre K de la loi | K > 0", - ang = "K parameter | K > 0" - ), - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - ), # Fin BLOC KLambda_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 0.0, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 1.0, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - - ), # Fin BLOC GAMMA - -# 3.5. ==> Loi geometrique - - GEOMETRIC = BLOC ( condition = " Kind in ( 'Geometric', ) ", - - P = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - val_max = 1., - fr = "Parametre P | 0 < P < 1", - ang = "P parameter | 0 < P < 1" - ), - - ), # Fin BLOC GEOMETRIC - -# 3.6. ==> Loi gumbel - - GUMBEL = BLOC ( condition = " Kind in ( 'Gumbel', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi gumbel", - ang = "Gumbel distribution parameter set" - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Beta de la loi", - ang = "Beta parameter" - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - ), # Fin BLOC GUMBEL - -# 3.7. ==> Loi histogramme - - HISTOGRAM = BLOC ( condition = " Kind in ( 'Histogram', ) ", - - Sup = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la distribution", - ang = "Upper bound" - ), - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC HISTOGRAM - -# 3.8. ==> Loi lognormale - - LOGNORMAL = BLOC ( condition = " Kind in ( 'LogNormal', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ), - defaut = "MuSigmaLog", - fr = "Parametrage de la loi lognormale", - ang = "Lognormal distribution parameter set" - ), - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', 'MuSigmaOverMu' ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi | Mu > Gamma", - ang = "Mu parameter | Mu > Gamma" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ", - - MuLog = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu log de la loi", - ang = "Mu log parameter" - ), - - SigmaLog = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma log de la loi | SigmaLog > 0", - ang = "Sigma log parameter | SigmaLog > 0" - ), - - ), # Fin BLOC MuSigmaLog_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC LOGNORMAL - -# 3.9. ==> Loi logistique - - LOGISTIC = BLOC ( condition = " Kind in ( 'Logistic', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Alpha de la loi", - ang = "Alpha parameter" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > = 0", - ang = "Beta parameter | Beta > = 0" - ), - - ), # Fin BLOC LOGISTIC - -# 3.10. ==> Loi multinomiale - - MULTINOMIAL = BLOC ( condition = " Kind in ( 'MultiNomial', ) ", - - N = SIMP ( statut = "o", - typ = "E", - max = 1, - fr = "Dimension de la loi", - ang = "DISTRIBUTION dimension" - ), - - # Il faut un vecteur P de taille N - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC MULTINOMIAL - -# 3.11. ==> Loi normale - - NORMAL = BLOC ( condition = " Kind in ( 'Normal', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC NORMAL - -# 3.12. ==> Loi Poisson - - POISSON = BLOC ( condition = " Kind in ( 'Poisson', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - ), # Fin BLOC POISSON - -# 3.13. ==> Loi student - - STUDENT = BLOC ( condition = " Kind in ( 'Student', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Nu = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 2., - fr = "Parametre Nu de la loi | V > = 2", - ang = "Nu parameter | V > = 2" - ), - - ), # Fin BLOC STUDENT - -# 3.14. ==> Loi triangulaire - - TRIANGULAR = BLOC ( condition = " Kind in ( 'Triangular', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = M < = B", - ang = "Lower bound | A < = M < = B" - ), - - M = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Mode de la loi | A < = M < = B", - ang = "Mode | A < = M < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = M < = B", - ang = "Upper bound | A < = M < = B" - ), - - ), # Fin BLOC TRIANGULAR - -# 3.15. ==> Loi normale tronquee - - TRUNCATEDNORMAL = BLOC ( condition = " Kind in ( 'TruncatedNormal', ) ", - - MuN = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - SigmaN = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre SigmaN de la loi | SigmaN > 0", - ang = "SigmaN parameter | SigmaN> 0" - ), - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B" - ), - - ), # Fin BLOC TRUNCATEDNORMAL - -# 3.16. ==> uniforme - - UNIFORM = BLOC ( condition = " Kind in ( 'Uniform', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B" - ), - - ), # Fin BLOC UNIFORM - -# 3.17. ==> Loi definie par l'utilisateur - - USERDEFINED = BLOC ( condition = " Kind in ( 'UserDefined', ) ", - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC USERDEFINED - -# 3.18. ==> Weibull - - WEIBULL = BLOC ( condition = " Kind in ( 'Weibull', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi weibull", - ang = "Weibull distribution parameter set" - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > 0", - ang = "Beta parameter | Beta > 0" - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC WEIBULL - -); # Fin OPER DISTRIBUTION - -#================================ -# 2. Definition du cas d'etude -#================================ -# Nota : les variables de type PROC doivent etre en majuscules ! -STUDY = PROC ( nom = "STUDY", - op = None, - docu = "", - fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", - ang = "Writes the configuration file for OPENTURNS.", - - -#===== -# 1. Le Type d'Analyse -#===== - - Analysis = SIMP ( statut = "o", - typ = "TXM", - into = ( "Reliability", "Simulation", "QuadraticCumul" ), - fr = "Type d'Analyse", - ang = "Analysis", - ), - -#===== -# 2. Pour la probabilite -# algorithme et mode choisis -#===== - - Reliability = BLOC ( condition = " Analysis in ( 'Reliability', ) ", - -# 2.1. ==> L'algorithme - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "FORM", "SORM" ), - fr = "Algorithme de fiabilite", - ang = "Reliability algorithm" - ), - -# 2.2. ==> La methode -# 2.2.1. ==> La methode - - Method = SIMP ( statut = "o", - typ = "TXM", - into = ( "Cobyla", "AbdoRackwitz" ), - fr = "Methode d'optimisation.", - ang = "Optimisation method." - ), - -# 2.2.2. ==> Regles - - regles = ( EXCLUS ( "MaximumAbsoluteError", "RelativeAbsoluteError" ), ), - -# 2.2.3. ==> Nombre d'iterations - - MaximumIterationsNumber = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = "Nombre maximum d iterations.", - ang = "Maximum number of iterations." - ), - -# 2.2.4. ==> Erreur maximum absolue - - MaximumAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Distance maximum absolue entre 2 iterations successifs.", - ang = "Absolute maximum distance between 2 successive iterates." - ), - -# 2.2.5. ==> Erreur maximum relative - - RelativeAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Distance maximum relative entre 2 iterations successifs.", - ang = "Relative maximum distance between 2 successive iterates." - ), - -# 2.2.6. ==> Ecart de contrainte absolu - - MaximumConstraintError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Valeur maximum absolue de la fonction \ - moins la valeur du niveau.", - ang = "Maximum absolute value of the constraint function \ - minus the level value." - ), - -# 2.2.7. ==> Ecart de residu absolu - - MaximumResidualError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Maximum orthogonality error.", - ang = "Maximum orthogonality error." - ), - - ), # Fin BLOC Reliability - -#===== -# 3. Pour la probabilite -# seuil par simulation : -# algorithme choisi -#===== - - Simulation = BLOC ( condition = " Analysis in ( 'Simulation', ) ", - -# 3.1. ==> L'algorithme - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "MonteCarlo", "LHS", "DirectionalSampling" ), - fr = "Algorithme de simulation", - ang = "Simulation algorithm" - ), - -# 3.1.2. ==> Nombre d... - - BlockSize = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - defaut = 1, - fr = "Nombre maximum ...", - ang = "Maximum number of ..." - ), - -# 3.2.3. ==> ... maximum ... - - MaximumCoefficientOfVariation = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " maximum ...", - ang = "Absolute maximum ...." - ), - -# 3.2.4. ==> Maximum d'iterations - - MaximumOuterSamplingType = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "UserDefined", - into = ( "Wilks", "UserDefined" ), - fr = "Mode definition du maximum d iterations", - ang = "Maximum iterations number" - ), - - Wilks = BLOC ( condition = " MaximumOuterSamplingType in ( 'Wilks', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0.0, - val_max = 1.0, - fr = "Ordre du quantile.", - ang = "Order of the quantile." - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0.0, - val_max = 1.0, - fr = "Confiance ...", - ang = "Confidence ..." - ), - - I = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 0, - defaut = 0, - fr = " ...", - ang = "Rank ..." - ), - - ), # Fin BLOC Wilks - - UserDefined = BLOC ( condition = " MaximumOuterSamplingType in ( 'UserDefined', ) ", - - MaximumOuterSampling = SIMP ( statut = "o", - typ = "I", - max = 1, - val_min = 1, - fr = "Maximum d iterations externes.", - ang = "Maximum outer Sampling value." - ), - - ), # Fin BLOC UserDefined - -# 3.2.6. ==> Root strategy - - DirectionalSampling = BLOC ( condition = " Algorithm in ( 'DirectionalSampling', ) ", - - RootStrategyImplementation = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "SafeAndSlow", - into = ( "RiskyAndFast", "MediumSafe", "SafeAndSlow" ), - fr = "RootStrategyImplementation.", - ang = "RootStrategyImplementation." - ), - - SolverImplementation = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "Bisection", - into = ( "Bisection", "Brent", "Secant" ), - fr = "SolverImplementation.", - ang = "SolverImplementation." - ), - - SolverImplementationg = BLOC ( condition = " SolverImplementation in ( 'Bisection', 'Brent', 'Secant' ) ", - - regles = ( ENSEMBLE ( 'AbsoluteError', 'RelativeError', 'maximumFunctionEvaluation' ), ), - - AbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " Absolute error ...", - ang = "Absolute error ..." - ), - - RelativeError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " Relative error ...", - ang = "Relative error ..." - ), - - MaximumFunctionEvaluation = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = " maximum Function Evaluation ...", - ang = "maximum Function Evaluation ..." - ), - - ), # Fin BLOC SolverImplementationg - - ), # Fin BLOC DirectionalSampling - -# 3.2.7. ==> Impression des intervalles de confiance - - ConfidenceIntervalProbability = SIMP ( statut = "f", - typ = 'R', - max = '**', - val_min = 0., - val_max = 1., - fr = "Liste des intervalles de confiance voulus", - ang = "Confidence intervals" - ), - - ), # Fin BLOC Simulation - -#===== -# 4. Pour la probabilite evenement -#===== - - Event = BLOC ( condition = " Analysis in ( 'Reliability', 'Simulation' ) ", - - Threshold = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Le seuil de defaillance.", - ang = "Failure threshold." - ), - - ComparisonOperator = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "Less", "LessOrEqual", "Equal", "GreaterOrEqual", "Greater" ), - fr = "Que faut-il ne pas depasser : un maximum ou un minimum.", - ang = "What is the failure threshold : maximum or minimum." - ), - - ), # Fin BLOC Event - - - RandomGenerator = BLOC ( condition = " Analysis in ( 'Reliability', 'Simulation' ) ", - - SeedToBeSet = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "La racine du generateur aleatoire doit-elle etre positionnee ?", - ang = "Does the random generator seed need to be set ?" - ), - - SeedSettings = BLOC ( condition = " SeedToBeSet in ( 'yes', ) ", - - RandomGeneratorSeed = SIMP ( statut = "o", - typ = "I", - max = 1, - fr = "Racine du generateur aleatoire", - ang = "Random generator seed" - ), - - ), # Fin BLOC SeedSettings - - ), # Fin BLOC RandomGenerator - - -#==== -# 5. Definition des parametres -#==== - - Variables = FACT ( statut = "o", - min = 1, - max = "**", - -# 5.1. ==> Nom de la variable - - Name = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Nom de la variable, identique au nom dans le solver.", - ang = "Name of the variable, identical to the name in solver." - ), - - Type = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "in", "out", ), - defaut = "in", - fr = "variable d'entree ou de sortie du solver", - ang = "Input or Output variable", - ), - - Unit = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Unite", - ang = "Unit", - ), - - Comment = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Commentaire", - ang = "Comment", - ), - - Regexp = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Expression reguliere", - ang = "Regular expression", - ), - - Format = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Format d'ecriture", - ang = "Format", - ), - -# 5.2. ==> Variable d'entree -# 5.2.1. ==> Loi de distribution - - InputVariable = BLOC ( condition = " Type in ( 'in', ) ", - - MarginalDistribution = SIMP ( statut = "o", - typ = ( loi, ), - max = 1, - fr = "Choix de la loi marginale", - ang = "1D marginal distribution." - ), - -# 5.2.2. ==> Parametres de calcul - -# 5.2.2.1. ==> Quand on cherche le point de conception, on peut preferer le depart de l'algorithme. -# Si on ne le fait pas, le programme prendra la valeur mediane. - - PhysicalStartingPoint = SIMP ( statut = "f", - typ = "R", - max = 1, - fr = "Point de demarrage de l'algorithme iteratif", - ang = "Initial point for iterative process." - ), - -# 5.2.2.2. ==> Mode d'obtention du gradient par rapport au parametre - - Gradient = SIMP ( statut = "f", - typ = "TXM", - max = 1, - into = ( "OUI", "NON" ), - defaut = "NON", - fr = "ASTER calcule directement le gradient.", - ang = "ASTER computes the gradient for this parameter." - ), - - GradientProvided = BLOC ( condition = " GRADIENT in ( 'NON', ) ", - - Increment = SIMP ( statut = "f", - typ = "R", - max = 1, - fr = "Increment dans la direction.", - ang = "Direction increment." - ), - ), # Fin BLOC GradientProvided - - ), # Fin BLOC InputVariable - - ), # Fin FACT Variables - -#==== -# 6. La fonction -#==== - - - Solver = SIMP ( statut = "o", - typ = "TXM", - max = 1, - #into = ( "Code_Aster", "Code_Saturne", "User_defined" ), - fr = "Nom du solveur de calcul", - ang = "Solver name" - ), - - WrapperPath = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "chemin d acces au wrapper", - ang = "wrapper library path" - ), - - FunctionName = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Nom de la fonction dans le wrapper", - ang = "Function's name in wrapper" - ), - - GradientName = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du gradient dans le wrapper", - ang = "gradient's name in wrapper" - ), - - HessianName = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du hessian dans le wrapper", - ang = "hessian's name in wrapper" - ), - - WrapCouplingMode = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "static-link", "dynamic-link", "fork", ), - fr = "mode de couplage du solver", - ang = "Solver coupling mode" - ), - - DTDDirectory = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "repertoire de la DTD", - ang = "DTD directory" - ), - - Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", - - Command = SIMP ( statut = "o", - max = 1, - typ = "TXM", - fr = "Chemin du solver", - ang = "solver path" - ), - ), # Fin BLOC Fork - - State = SIMP ( statut = "f", - typ = "TXM", - max = 1, - into = ( "shared", "specific" ), - fr = "partage de l etat interne entre les fonctions", - ang = "internal state sharing" - ), - - InDataTransfer = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "files", "pipe", "arguments", "socket", "CORBA", ), - fr = "mode de transfert des donnees d entree", - ang = "input transfering mode" - ), - - OutDataTransfer = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "files", "pipe", "arguments", "socket", "CORBA", ), - fr = "mode de transfert des donnees de sortie", - ang = "output transfering mode" - ), - - - -#==== -# 7. Informations sur les fichiers d'echange -#==== - - Files = FACT ( statut = "f", - min = 1, - max = "**", - - Id = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Identificateur du fichier", - ang = "File id" - ), - - Type = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "in", "out", ), - fr = "Fichier d entree ou de sortie du solveur ?", - ang = "Input or Output file ?" - ), - - Name = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du fichier", - ang = "file name" - ), - - Path = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "chemin du fichier", - ang = "path file " - ), - - Subst = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "liste de variables", - ang = "list" - ), - - ), # Fin FACT Files - -); # Fin PROC STUDY - -Result = PROC ( nom = "RESULT", - op = None, - docu = "", - fr = "Liste des resultats a produire", - ang = "List of results to write out", - - GeneralizedReliabilityIndex = SIMP ( statut = "o", - typ = "TXM", - into = ( "yes", "no" ), - defaut = "no", - max = 1, - fr = "Index de fiabilite generalise", - ang = "Generalized reliability index" - ), - -); # Fin PROC Result - diff --git a/Openturns/Open_Cata_IDM_V7.py b/Openturns/Open_Cata_IDM_V7.py deleted file mode 100644 index eee33278..00000000 --- a/Openturns/Open_Cata_IDM_V7.py +++ /dev/null @@ -1,1221 +0,0 @@ -# -*- coding: utf-8 -*- - -# -------------------------------------------------- -# debut entete -# -------------------------------------------------- - -import Accas -from Accas import * - -class loi ( ASSD ) : pass - - -#CONTEXT.debug = 1 -JdC = JDC_CATA ( code = 'OPENTURNS', - execmodul = None, - regles = ( AU_MOINS_UN ( 'STUDY' ), ), - ) # Fin JDC_CATA - -# -------------------------------------------------- -# fin entete -# -------------------------------------------------- - -# 3. Version d OPENTURNS ? - -#=========================================================== - - -#================================ -# 1. Definition des LOIS -#================================ - -# Nota : les variables de type OPER doivent etre en majuscules ! -DISTRIBUTION = OPER ( nom = "DISTRIBUTION", - sd_prod = loi, - op = 68, - fr = "Definitions des lois marginales utilisees par les variables d'entree", - - -#==== -# 2. Type de la loi de distribution -#==== - - Kind = SIMP ( statut = "o", typ = "TXM", - into = ( "Beta", - "Exponential", - "Gamma", - "Geometric", - "Gumbel", - "Histogram", - "Logistic", - "LogNormal", - "MultiNomial", - "Normal", - "TruncatedNormal", - "Poisson", - "Student", - "Triangular", - "Uniform", - "UserDefined", - "Weibull", - ), - fr = "Choix du type de la loi marginale", - ang = "1D marginal distribution." ), - -#==== -# 3. Definition des parametres selon le type de la loi -#==== - -# 3.1. ==> Loi beta - - BETA = BLOC ( condition = " Kind in ( 'Beta', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "RT", "MuSigma" ), - defaut = "RT", - fr = "Parametrage de la loi beta", - ang = "Beta distribution parameter set" - ), - - RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ", - - R = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre R de la loi", - ang = "R parameter" - ), - - # T > R - T = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre T de la loi | T > R", - ang = "T parameter | T > R" - ), - - ), # Fin BLOC RT_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre A de la loi", - ang = "A parameter" - ), - - # B > A - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre B de la loi | B > A", - ang = "B parameter | B > A" - ), - - ), # Fin BLOC BETA - -# 3.2. ==> Loi exponentielle - - EXPONENTIAL = BLOC ( condition = " Kind in ( 'Exponential', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC EXPONENTIAL - -# 3.3. ==> Loi gamma - - GAMMA = BLOC ( condition = " Kind in ( 'Gamma', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "KLambda", "MuSigma" ), - defaut = "KLambda", - fr = "Parametrage de la loi gamma", - ang = "Gamma distribution parameter set" - ), - - KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ", - - K = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre K de la loi | K > 0", - ang = "K parameter | K > 0" - ), - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - ), # Fin BLOC KLambda_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 0.0, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 1.0, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - - ), # Fin BLOC GAMMA - -# 3.5. ==> Loi geometrique - - GEOMETRIC = BLOC ( condition = " Kind in ( 'Geometric', ) ", - - P = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - val_max = 1., - fr = "Parametre P | 0 < P < 1", - ang = "P parameter | 0 < P < 1" - ), - - ), # Fin BLOC GEOMETRIC - -# 3.6. ==> Loi gumbel - - GUMBEL = BLOC ( condition = " Kind in ( 'Gumbel', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi gumbel", - ang = "Gumbel distribution parameter set" - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Beta de la loi", - ang = "Beta parameter" - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - ), # Fin BLOC GUMBEL - -# 3.7. ==> Loi histogramme - - HISTOGRAM = BLOC ( condition = " Kind in ( 'Histogram', ) ", - - Sup = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la distribution", - ang = "Upper bound" - ), - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC HISTOGRAM - -# 3.8. ==> Loi lognormale - - LOGNORMAL = BLOC ( condition = " Kind in ( 'LogNormal', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ), - defaut = "MuSigmaLog", - fr = "Parametrage de la loi lognormale", - ang = "Lognormal distribution parameter set" - ), - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi | Mu > Gamma", - ang = "Mu parameter | Mu > Gamma" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - MuSigmaOverMu_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaOverMu,', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi | Mu > Gamma", - ang = "Mu parameter | Mu > Gamma" - ), - - SigmaOverMu = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre SigmaOverMu de la loi | SigmaOverMu > 0", - ang = "SigmaOverMu parameter | SigmaOverMu > 0" - ), - - ), # Fin BLOC MuSigmaOverMu_Parameters - - MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ", - - MuLog = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu log de la loi", - ang = "Mu log parameter" - ), - - SigmaLog = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma log de la loi | SigmaLog > 0", - ang = "Sigma log parameter | SigmaLog > 0" - ), - - ), # Fin BLOC MuSigmaLog_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC LOGNORMAL - -# 3.9. ==> Loi logistique - - LOGISTIC = BLOC ( condition = " Kind in ( 'Logistic', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Alpha de la loi", - ang = "Alpha parameter" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > = 0", - ang = "Beta parameter | Beta > = 0" - ), - - ), # Fin BLOC LOGISTIC - -# 3.10. ==> Loi multinomiale - - MULTINOMIAL = BLOC ( condition = " Kind in ( 'MultiNomial', ) ", - - N = SIMP ( statut = "o", - typ = "E", - max = 1, - fr = "Dimension de la loi", - ang = "DISTRIBUTION dimension" - ), - - # Il faut un vecteur P de taille N - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC MULTINOMIAL - -# 3.11. ==> Loi normale - - NORMAL = BLOC ( condition = " Kind in ( 'Normal', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC NORMAL - -# 3.12. ==> Loi Poisson - - POISSON = BLOC ( condition = " Kind in ( 'Poisson', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0" - ), - - ), # Fin BLOC POISSON - -# 3.13. ==> Loi student - - STUDENT = BLOC ( condition = " Kind in ( 'Student', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Nu = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 2., - fr = "Parametre Nu de la loi | V > = 2", - ang = "Nu parameter | V > = 2" - ), - - ), # Fin BLOC STUDENT - -# 3.14. ==> Loi triangulaire - - TRIANGULAR = BLOC ( condition = " Kind in ( 'Triangular', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = M < = B", - ang = "Lower bound | A < = M < = B" - ), - - M = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Mode de la loi | A < = M < = B", - ang = "Mode | A < = M < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = M < = B", - ang = "Upper bound | A < = M < = B" - ), - - ), # Fin BLOC TRIANGULAR - -# 3.15. ==> Loi normale tronquee - - TRUNCATEDNORMAL = BLOC ( condition = " Kind in ( 'TruncatedNormal', ) ", - - MuN = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - SigmaN = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre SigmaN de la loi | SigmaN > 0", - ang = "SigmaN parameter | SigmaN> 0" - ), - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B" - ), - - ), # Fin BLOC TRUNCATEDNORMAL - -# 3.16. ==> uniforme - - UNIFORM = BLOC ( condition = " Kind in ( 'Uniform', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B" - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B" - ), - - ), # Fin BLOC UNIFORM - -# 3.17. ==> Loi definie par l'utilisateur - - USERDEFINED = BLOC ( condition = " Kind in ( 'UserDefined', ) ", - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**' - ), - - ), # Fin BLOC USERDEFINED - -# 3.18. ==> Weibull - - WEIBULL = BLOC ( condition = " Kind in ( 'Weibull', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi weibull", - ang = "Weibull distribution parameter set" - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0" - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > 0", - ang = "Beta parameter | Beta > 0" - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter" - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0" - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter" - ), - - ), # Fin BLOC WEIBULL - -); # Fin OPER DISTRIBUTION - -#================================ -# 2. Definition du cas d'etude -#================================ -# Nota : les variables de type PROC doivent etre en majuscules ! -STUDY = PROC ( nom = "STUDY", - op = None, - docu = "", - fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", - ang = "Writes the configuration file for OPENTURNS.", - - -#===== -# 1. Le Type d'Analyse -#===== - - Analysis = SIMP ( statut = "o", - typ = "TXM", - into = ( "Reliability", "Simulation", "QuadraticCumul" ), - fr = "Type d'Analyse", - ang = "Analysis", - ), - -#===== -# 2. Pour la probabilite -# algorithme et mode choisis -#===== - - Reliability = BLOC ( condition = " Analysis in ( 'Reliability', ) ", - -# 2.1. ==> L'algorithme - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "FORM", "SORM" ), - fr = "Algorithme de fiabilite", - ang = "Reliability algorithm" - ), - -# 2.2. ==> La methode -# 2.2.1. ==> La methode - - Method = SIMP ( statut = "o", - typ = "TXM", - into = ( "Cobyla", "AbdoRackwitz" ), - fr = "Methode d'optimisation.", - ang = "Optimisation method." - ), - -# 2.2.2. ==> Regles - - regles = ( EXCLUS ( "MaximumAbsoluteError", "RelativeAbsoluteError" ), ), - -# 2.2.3. ==> Nombre d'iterations - - MaximumIterationsNumber = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = "Nombre maximum d iterations.", - ang = "Maximum number of iterations." - ), - -# 2.2.4. ==> Erreur maximum absolue - - MaximumAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Distance maximum absolue entre 2 iterations successifs.", - ang = "Absolute maximum distance between 2 successive iterates." - ), - -# 2.2.5. ==> Erreur maximum relative - - RelativeAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Distance maximum relative entre 2 iterations successifs.", - ang = "Relative maximum distance between 2 successive iterates." - ), - -# 2.2.6. ==> Ecart de contrainte absolu - - MaximumConstraintError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Valeur maximum absolue de la fonction \ - moins la valeur du niveau.", - ang = "Maximum absolute value of the constraint function \ - minus the level value." - ), - -# 2.2.7. ==> Ecart de residu absolu - - MaximumResidualError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Maximum orthogonality error.", - ang = "Maximum orthogonality error." - ), - - ), # Fin BLOC Reliability - -#===== -# 3. Pour la probabilite -# seuil par simulation : -# algorithme choisi -#===== - - Simulation = BLOC ( condition = " Analysis in ( 'Simulation', ) ", - -# 3.1. ==> L'algorithme - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "MonteCarlo", "LHS", "DirectionalSampling" ), - fr = "Algorithme de simulation", - ang = "Simulation algorithm" - ), - -# 3.1.2. ==> Nombre d... - - BlockSize = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - defaut = 1, - fr = "Nombre maximum ...", - ang = "Maximum number of ..." - ), - -# 3.2.3. ==> ... maximum ... - - MaximumCoefficientOfVariation = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " maximum ...", - ang = "Absolute maximum ...." - ), - -# 3.2.4. ==> Maximum d'iterations - - MaximumOuterSamplingType = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "UserDefined", - into = ( "Wilks", "UserDefined" ), - fr = "Mode definition du maximum d iterations", - ang = "Maximum iterations number" - ), - - Wilks = BLOC ( condition = " MaximumOuterSamplingType in ( 'Wilks', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0.0, - val_max = 1.0, - fr = "Ordre du quantile.", - ang = "Order of the quantile." - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0.0, - val_max = 1.0, - fr = "Confiance ...", - ang = "Confidence ..." - ), - - I = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 0, - defaut = 0, - fr = " ...", - ang = "Rank ..." - ), - - ), # Fin BLOC Wilks - - UserDefined = BLOC ( condition = " MaximumOuterSamplingType in ( 'UserDefined', ) ", - - MaximumOuterSampling = SIMP ( statut = "o", - typ = "I", - max = 1, - val_min = 1, - fr = "Maximum d iterations externes.", - ang = "Maximum outer Sampling value." - ), - - ), # Fin BLOC UserDefined - -# 3.2.6. ==> Root strategy - - DirectionalSampling = BLOC ( condition = " Algorithm in ( 'DirectionalSampling', ) ", - - RootStrategyImplementation = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "SafeAndSlow", - into = ( "RiskyAndFast", "MediumSafe", "SafeAndSlow" ), - fr = "RootStrategyImplementation.", - ang = "RootStrategyImplementation." - ), - - SolverImplementation = SIMP ( statut = "f", - typ = "TXM", - max = 1, - defaut = "Bisection", - into = ( "Bisection", "Brent", "Secant" ), - fr = "SolverImplementation.", - ang = "SolverImplementation." - ), - - SolverImplementationg = BLOC ( condition = " SolverImplementation in ( 'Bisection', 'Brent', 'Secant' ) ", - - regles = ( ENSEMBLE ( 'AbsoluteError', 'RelativeError', 'maximumFunctionEvaluation' ), ), - - AbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " Absolute error ...", - ang = "Absolute error ..." - ), - - RelativeError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = " Relative error ...", - ang = "Relative error ..." - ), - - MaximumFunctionEvaluation = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = " maximum Function Evaluation ...", - ang = "maximum Function Evaluation ..." - ), - - ), # Fin BLOC SolverImplementationg - - ), # Fin BLOC DirectionalSampling - -# 3.2.7. ==> Impression des intervalles de confiance - - ConfidenceIntervalProbability = SIMP ( statut = "f", - typ = 'R', - max = '**', - val_min = 0., - val_max = 1., - fr = "Liste des intervalles de confiance voulus", - ang = "Confidence intervals" - ), - - ), # Fin BLOC Simulation - -#===== -# 4. Pour la probabilite evenement -#===== - - Event = BLOC ( condition = " Analysis in ( 'Reliability', 'Simulation' ) ", - - Threshold = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Le seuil de defaillance.", - ang = "Failure threshold." - ), - - ComparisonOperator = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "Less", "LessOrEqual", "Equal", "GreaterOrEqual", "Greater" ), - fr = "Que faut-il ne pas depasser : un maximum ou un minimum.", - ang = "What is the failure threshold : maximum or minimum." - ), - - ), # Fin BLOC Event - - - RandomGenerator = BLOC ( condition = " Analysis in ( 'Reliability', 'Simulation' ) ", - - SeedToBeSet = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "La racine du generateur aleatoire doit-elle etre positionnee ?", - ang = "Does the random generator seed need to be set ?" - ), - - SeedSettings = BLOC ( condition = " SeedToBeSet in ( 'yes', ) ", - - RandomGeneratorSeed = SIMP ( statut = "o", - typ = "I", - max = 1, - fr = "Racine du generateur aleatoire", - ang = "Random generator seed" - ), - - ), # Fin BLOC SeedSettings - - ), # Fin BLOC RandomGenerator - - -#==== -# 5. Definition des parametres -#==== - - Variables = FACT ( statut = "o", - min = 1, - max = "**", - -# 5.1. ==> Nom de la variable - - Name = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Nom de la variable, identique au nom dans le solver.", - ang = "Name of the variable, identical to the name in solver." - ), - - Type = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "in", "out", ), - defaut = "in", - fr = "variable d'entree ou de sortie du solver", - ang = "Input or Output variable", - ), - - Unit = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Unite", - ang = "Unit", - ), - - Comment = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Commentaire", - ang = "Comment", - ), - - Regexp = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Expression reguliere", - ang = "Regular expression", - ), - - Format = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Format d'ecriture", - ang = "Format", - ), - -# 5.2. ==> Variable d'entree -# 5.2.1. ==> Loi de distribution - - InputVariable = BLOC ( condition = " Type in ( 'in', ) ", - - MarginalDistribution = SIMP ( statut = "o", - typ = ( loi, ), - max = 1, - fr = "Choix de la loi marginale", - ang = "1D marginal distribution." - ), - -# 5.2.2. ==> Parametres de calcul - -# 5.2.2.1. ==> Quand on cherche le point de conception, on peut preferer le depart de l'algorithme. -# Si on ne le fait pas, le programme prendra la valeur mediane. - - PhysicalStartingPoint = SIMP ( statut = "f", - typ = "R", - max = 1, - fr = "Point de demarrage de l'algorithme iteratif", - ang = "Initial point for iterative process." - ), - -# 5.2.2.2. ==> Mode d'obtention du gradient par rapport au parametre - - Gradient = SIMP ( statut = "f", - typ = "TXM", - max = 1, - into = ( "OUI", "NON" ), - defaut = "NON", - fr = "ASTER calcule directement le gradient.", - ang = "ASTER computes the gradient for this parameter." - ), - - GradientProvided = BLOC ( condition = " GRADIENT in ( 'NON', ) ", - - Increment = SIMP ( statut = "f", - typ = "R", - max = 1, - fr = "Increment dans la direction.", - ang = "Direction increment." - ), - ), # Fin BLOC GradientProvided - - ), # Fin BLOC InputVariable - - ), # Fin FACT Variables - -#==== -# 6. La fonction -#==== - - - Solver = SIMP ( statut = "o", - typ = "TXM", - max = 1, - #into = ( "Code_Aster", "Code_Saturne", "User_defined" ), - fr = "Nom du solveur de calcul", - ang = "Solver name" - ), - - WrapperPath = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "chemin d acces au wrapper", - ang = "wrapper library path" - ), - - FunctionName = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Nom de la fonction dans le wrapper", - ang = "Function's name in wrapper" - ), - - GradientName = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du gradient dans le wrapper", - ang = "gradient's name in wrapper" - ), - - HessianName = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du hessian dans le wrapper", - ang = "hessian's name in wrapper" - ), - - WrapCouplingMode = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "static-link", "dynamic-link", "fork", ), - fr = "mode de couplage du solver", - ang = "Solver coupling mode" - ), - - DTDDirectory = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "repertoire de la DTD", - ang = "DTD directory" - ), - - Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", - - Command = SIMP ( statut = "o", - max = 1, - typ = "TXM", - fr = "Chemin du solver", - ang = "solver path" - ), - ), # Fin BLOC Fork - - State = SIMP ( statut = "f", - typ = "TXM", - max = 1, - into = ( "shared", "specific" ), - fr = "partage de l etat interne entre les fonctions", - ang = "internal state sharing" - ), - - InDataTransfer = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "files", "pipe", "arguments", "socket", "CORBA", ), - fr = "mode de transfert des donnees d entree", - ang = "input transfering mode" - ), - - OutDataTransfer = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "files", "pipe", "arguments", "socket", "CORBA", ), - fr = "mode de transfert des donnees de sortie", - ang = "output transfering mode" - ), - - - -#==== -# 7. Informations sur les fichiers d'echange -#==== - - Files = FACT ( statut = "f", - min = 1, - max = "**", - - Id = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "Identificateur du fichier", - ang = "File id" - ), - - Type = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "in", "out", ), - fr = "Fichier d entree ou de sortie du solveur ?", - ang = "Input or Output file ?" - ), - - Name = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "Nom du fichier", - ang = "file name" - ), - - Path = SIMP ( statut = "o", - typ = "TXM", - max = 1, - fr = "chemin du fichier", - ang = "path file " - ), - - Subst = SIMP ( statut = "f", - typ = "TXM", - max = 1, - fr = "liste de variables", - ang = "list" - ), - - ), # Fin FACT Files - -); # Fin PROC STUDY - -Result = PROC ( nom = "RESULT", - op = None, - docu = "", - fr = "Liste des resultats a produire", - ang = "List of results to write out", - - GeneralizedReliabilityIndex = SIMP ( statut = "o", - typ = "TXM", - into = ( "yes", "no" ), - defaut = "no", - max = 1, - fr = "Index de fiabilite generalise", - ang = "Generalized reliability index" - ), - -); # Fin PROC Result - diff --git a/Openturns/editeur.ini b/Openturns/editeur.ini deleted file mode 100644 index 65eca18b..00000000 --- a/Openturns/editeur.ini +++ /dev/null @@ -1,32 +0,0 @@ -import os - -import prefs - -rep_cata = prefs.REPINI - -# Acces a la documentation -path_doc = os.path.join(rep_cata,'Doc') -exec_acrobat = "/usr/bin/xpdf" - -# Utilisateur/Developpeur -isdeveloppeur = "NON" -path_cata_dev = "/tmp/cata" - -# Repertoire temporaire -rep_travail = "/tmp" - -# Repertoire initial -initialdir=os.curdir - -DTDDirectory="/local/openturns/Logiciels/OpenTURNS/install/share/openturns/wrappers/" - -# Choix des catalogues -rep_mat=" " - -catalogues = ( -# ('OPENTURNS','v0',os.path.join(rep_cata,'Open_Cata_V0.py'),'openturns'), - ('OPENTURNS','v1',os.path.join(rep_cata,'Open_Cata_V1.py'),'openturns'), - ('OPENTURNS','IDM v7',os.path.join(rep_cata,'Open_Cata_IDM_V7.py'),'openturns'), -# ('OPENTURNS','vg',os.path.join(rep_cata,'Open_Cata_gn.py'),'openturns'), - ) - diff --git a/Openturns/eficas_openturns.py b/Openturns/eficas_openturns.py deleted file mode 100755 index 599ad837..00000000 --- a/Openturns/eficas_openturns.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -# -*- 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 sert a lancer EFICAS configure pour Code_Aster -""" -# Modules Python -import sys - -# Modules Eficas -import prefs -prefs.code="OPENTURNS" - -sys.path[:0]=[prefs.INSTALLDIR] - -import InterfaceTK -from InterfaceTK import eficas_go - -if len(sys.argv) > 1 : - # on veut ouvrir un fichier directement au lancement d'Eficas - eficas_go.lance_eficas(code='OPENTURNS',fichier = sys.argv[1]) -else: - # on veut ouvrir Eficas 'vide' - eficas_go.lance_eficas(code='OPENTURNS') diff --git a/Openturns/prefs.py b/Openturns/prefs.py deleted file mode 100644 index 50b2a5ec..00000000 --- a/Openturns/prefs.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- 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 os, sys - -# REPINI sert à localiser le fichier editeur.ini -# Obligatoire -REPINI=os.path.dirname(os.path.abspath(__file__)) - -# INSTALLDIR sert à localiser l'installation d'Eficas -# Obligatoire -INSTALLDIR=os.path.join(REPINI,'..') - -# CODE_PATH sert à localiser Noyau et Validation éventuellement -# non contenus dans la distribution EFICAS -# Par défaut on utilise les modules de INSTALLDIR -# Peut valoir None (defaut) -CODE_PATH = None -code = "OPENTURNS" - -# lang indique la langue utilisée pour les chaines d'aide : fr ou ang -lang='fr' - -# Codage des strings qui accepte les accents (en remplacement de 'ascii') -encoding='iso-8859-1' - -EditeurDir=INSTALLDIR+"/Editeur" -sys.path[:0]=[INSTALLDIR] - -ICONDIR=os.path.join(INSTALLDIR,'Editeur','icons') - -# Preference -if os.name == 'nt': - userprefs = os.sep.join( [ os.environ['HOMEDRIVE'], os.environ['HOMEPATH'], 'Eficas_install', 'prefs.py' ]) -else : - userprefs=os.path.expanduser("~/Eficas_install/prefs.py") - -if os.path.isfile(userprefs): - try: - execfile(userprefs) - except: - pass - - -#------------------------------------------------------------------- -# Partie pour TK -#------------------------------------------------------------------- - -labels= ('Fichier','Edition','Jeu de commandes',) - -appli_composants=['readercata','bureau', 'options', ] - -menu_defs={ 'bureau': [ - ('Fichier',[ - ('Nouveau','newJDC',''), - ('Ouvrir','openJDC',''), - ('Enregistrer','saveJDC',''), - ('Enregistrer sous','saveasJDC',''), - None, - ('Fermer','closeJDC',''), - ('Quitter','exitEFICAS',''), - ] - ), - ('Edition',[ - ('Copier','copy',''), - ('Couper','cut',''), - ('Coller','paste',''), - ] - ), - ('Jeu de commandes',[ - ('Rapport de validation','visuCRJDC',''), - ('Fichier à plat','visu_a_plat',''), - ] - ), - ] - } - diff --git a/Openturns/properties.py b/Openturns/properties.py deleted file mode 100644 index 8ba0ed7e..00000000 --- a/Openturns/properties.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -#@ MODIF properties Accas DATE 10/10/2002 AUTEUR gcbhhhh M.ADMINISTRATEUR -# CONFIGURATION MANAGEMENT OF EDF VERSION -# RESPONSABLE D6BHHHH J-P.LEFEBVRE -# ====================================================================== -# COPYRIGHT (C) 1991 - 2001 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. -# ====================================================================== -# IDENTIFICATION DU GESTIONNAIRE DE COMMANDE ACCAS A PARTIR -# DE LA VERSION DU CODE_ASTER ASSOCIE -#---------------------------------------------------------------------- -version = "7.1.0" -date = "23/04/2003" diff --git a/Openturns/qtEficas_openturns.py b/Openturns/qtEficas_openturns.py deleted file mode 100755 index ea0782e2..00000000 --- a/Openturns/qtEficas_openturns.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -# -*- 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 sert à lancer EFICAS configuré pour Openturns -""" -# Modules Python - -# Modules Eficas -import prefs -prefs.code="OPENTURNS" -from InterfaceQT import eficas_go - -eficas_go.lance_eficas(code=prefs.code) diff --git a/Openturns/sdistOTqt.py b/Openturns/sdistOTqt.py deleted file mode 100644 index acf75c26..00000000 --- a/Openturns/sdistOTqt.py +++ /dev/null @@ -1,103 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Ce module sert à construire les distributions d'EFICAS pour Openturns - en fonction du tag CVS courant - Les distributions sont : - - un tar.gz pour UNIX ne contenant pas mxTextTools - L'utilisation de ce module est la suivante : - 1- Se mettre dans un répertoire de travail - 2- Configurer son environnement pour utiliser le référentiel CVS EFICAS - 3- Exporter les sources d'EficasV1 par la commande : - cvs export -r TAG -d Eficas_export EficasV1 - ou TAG est le tag CVS de la version que l'on veut distribuer (par exemple V1_1p1) - 5- Aller dans le répertoire Eficas_export - 6- Executer le script sdist.py - python sdist.py - Ce qui a pour effet de creer un repertoire dist contenant la distribution - et de la copier dans le répertoire indiqué par dir_download s'il est accessible - -""" -import os,shutil,glob,sys -import types - -nom_distrib="QTEficasOpenturns_V1_0" -path_distrib=os.path.join("dist",nom_distrib) -path_TextTools="/home/eficas/pkg/mxTools/egenix2.0.2pourWindows/mx/TextTools" -dir_download= "/home/eficas/WWW/telechargement/eficas" - -def main(): - if os.path.isdir('dist'):shutil.rmtree('dist') - - copyfiles('.',path_distrib,['LICENSE.TERMS','INSTALL','NEWS']) - - copyfiles('../Editeur',os.path.join(path_distrib,'Editeur'),['*.py','faqs.txt']) - copyfiles('../InterfaceTK',os.path.join(path_distrib,'InterfaceTK'),['*.py','faqs.txt']) - copyfiles('../InterfaceQT',os.path.join(path_distrib,'InterfaceQT'),['*.py','faqs.txt']) - copyfiles('../Ui',os.path.join(path_distrib,'Ui'),['*.ui','makefile']) - copyfiles('../Openturns',os.path.join(path_distrib,'Openturns'),['*.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'),['*']) - copyfiles('.',os.path.join(path_distrib,'AIDE','fichiers'),['INSTALL','NEWS']) - copyfiles('../Editeur',os.path.join(path_distrib,'AIDE','fichiers'),['faqs.txt']) - # ______________________ - - copyfiles('../convert',os.path.join(path_distrib,'convert'),['*.py']) - copyfiles('../convert/Parserv5',os.path.join(path_distrib,'convert','Parserv5'),['*.py']) - copyfiles('../generator',os.path.join(path_distrib,'generator'),['*.py']) - copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.gif']) - copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.png']) - copyfiles('../Editeur/Patrons/',os.path.join(path_distrib,'Editeur','Patrons'),['*.com*']) - copyfiles('../Editeur/Patrons/OPENTURNS',os.path.join(path_distrib,'Editeur','Patrons','OPENTURNS'),['*.com*']) - - copyfiles('../Noyau',os.path.join(path_distrib,'Noyau'),['*.py']) - copyfiles('../Validation',os.path.join(path_distrib,'Validation'),['*.py']) - - - tarball= maketarball('dist',nom_distrib,nom_distrib) - try: - shutil.copy(tarball,dir_download) - except: - print "Repertoire de download inconnu : ",dir_download - - - -def make_dir(dir_cible): - if type(dir_cible) is not types.StringType: - raise "make_dir : dir_cible doit etre une string (%s)" % `dir_cible` - head,tail=os.path.split(dir_cible) - tails=[tail] - while head and tail and not os.path.isdir(head): - head,tail=os.path.split(head) - tails.insert(0, tail) - - for d in tails: - head = os.path.join(head, d) - if not os.path.isdir(head):os.mkdir(head) - - -def copyfiles(dir_origin,dir_cible,listfiles): - if not os.path.isdir(dir_cible):make_dir(dir_cible) - for glob_files in listfiles: - for file in glob.glob(os.path.join(dir_origin,glob_files)): - shutil.copy(file,dir_cible) - - -def maketarball(dir_trav,dir_cible,nom_tar): - prev=os.getcwd() - print prev - os.chdir(dir_trav) - os.system("tar -cf "+nom_tar+".tar "+dir_cible) - os.system("gzip -f9 "+nom_tar+".tar ") - os.chdir(prev) - return os.path.join(dir_trav,nom_tar+".tar.gz") - - -main() - diff --git a/Openturns/style.py b/Openturns/style.py deleted file mode 100644 index 7da9d534..00000000 --- a/Openturns/style.py +++ /dev/null @@ -1 +0,0 @@ -# Necessaire pour compatibilite avec Aster diff --git a/Openturns_Study/OpenTURNS_Cata_Wrapper_V1.py b/Openturns_Study/OpenTURNS_Cata_Wrapper_V1.py new file mode 100644 index 00000000..7bad7c17 --- /dev/null +++ b/Openturns_Study/OpenTURNS_Cata_Wrapper_V1.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +# -------------------------------------------------- +# debut entete +# -------------------------------------------------- + +import Accas +from Accas import * + + +#CONTEXT.debug = 1 +JdC = JDC_CATA ( code = 'OPENTURNS_WRAPPER', + execmodul = None, + regles = ( AU_MOINS_UN ( 'WRAPPER' ), ), + ) # Fin JDC_CATA + +# -------------------------------------------------- +# fin entete +# -------------------------------------------------- + + +#================================ +# 2. Definition des variables +#================================ + +VARIABLEPOOL = PROC ( nom = "VARIABLEPOOL", + op = None, + docu = "", + fr = "L'ensemble des variables probabilistes", + ang = "The pool of probabilistic variables", + + + Variables = FACT ( statut = "o", + min = 1, + max = "**", + + + + Name = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la variable, identique au nom dans le solver.", + ang = "Name of the variable, identical to the name in solver." + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + defaut = "in", + fr = "variable d'entree ou de sortie du solver", + ang = "Input or Output variable", + ), + + Unit = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Unite", + ang = "Unit", + ), + + Comment = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Commentaire", + ang = "Comment", + ), + + Regexp = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Expression reguliere", + ang = "Regular expression", + ), + + Format = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Format d'ecriture", + ang = "Format", + ), + + + ), # Fin FACT Variables + +) # Fin PROC VARIABLEPOOL + + +#================================ +# Definition des parametres du wrapper +#================================ + +# Nota : les variables de type PROC doivent etre en majuscules ! +WRAPPER = PROC ( nom = "WRAPPER", + op = None, + docu = "", + fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", + ang = "Writes the configuration file for OPENTURNS.", + + + WrapperPath = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin d acces au wrapper", + ang = "Wrapper library path", + ), + + FunctionName = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la fonction dans le wrapper", + ang = "Function's name in wrapper", + ), + + GradientName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du gradient dans le wrapper", + ang = "Gradient's name in wrapper", + ), + + HessianName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du hessian dans le wrapper", + ang = "Hessian's name in wrapper", + ), + + WrapCouplingMode = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "static-link", "dynamic-link", "fork", ), + fr = "Mode de couplage du solver", + ang = "Solver coupling mode", + ), + + Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", + + Command = SIMP ( statut = "o", + max = 1, + typ = "TXM", + fr = "Chemin du solver", + ang = "solver path", + ), + ), # Fin BLOC Fork + + State = SIMP ( statut = "f", + typ = "TXM", + max = 1, + into = ( "shared", "specific" ), + fr = "Partage de l'etat interne entre les fonctions", + ang = "Internal state sharing", + ), + + InDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees d'entree", + ang = "Input transfering mode", + ), + + OutDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees de sortie", + ang = "Output transfering mode", + ), + + + + + Files = FACT ( statut = "f", + min = 1, + max = "**", + + Id = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Identificateur du fichier", + ang = "File id", + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + fr = "Fichier d entree ou de sortie du solveur ?", + ang = "Input or Output file ?", + ), + + Name = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du fichier", + ang = "File name", + ), + + Path = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin du fichier", + ang = "Path file ", + ), + + Subst = SIMP ( statut = "f", + typ = "TXM", + max = "**", + fr = "Liste de variables", + ang = "List", + ), + + ), # Fin FACT Files + +) # Fin PROC WRAPPER diff --git a/Openturns_Study/OpenTURNS_Cata_Wrapper_V2.py b/Openturns_Study/OpenTURNS_Cata_Wrapper_V2.py new file mode 100644 index 00000000..69bff829 --- /dev/null +++ b/Openturns_Study/OpenTURNS_Cata_Wrapper_V2.py @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- + +# -------------------------------------------------- +# debut entete +# -------------------------------------------------- + +import Accas +from Accas import * + + +#CONTEXT.debug = 1 +JdC = JDC_CATA ( code = 'OPENTURNS_WRAPPER', + execmodul = None, + regles = ( AU_MOINS_UN ( 'WRAPPER' ), ), + ) # Fin JDC_CATA + +# -------------------------------------------------- +# fin entete +# -------------------------------------------------- + + +#================================ +# 2. Definition des variables +#================================ + +VARIABLEPOOL = PROC ( nom = "VARIABLEPOOL", + op = None, + docu = "", + fr = "L'ensemble des variables probabilistes", + ang = "The pool of probabilistic variables", + + + Variables = FACT ( statut = "o", + min = 1, + max = "**", + + + + Name = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la variable, identique au nom dans le solver.", + ang = "Name of the variable, identical to the name in solver." + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + defaut = "in", + fr = "variable d'entree ou de sortie du solver", + ang = "Input or Output variable", + ), + + Unit = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Unite", + ang = "Unit", + ), + + Comment = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Commentaire", + ang = "Comment", + ), + + Regexp = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Expression reguliere", + ang = "Regular expression", + ), + + Format = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Format d'ecriture", + ang = "Format", + ), + + + ), # Fin FACT Variables + +) # Fin PROC VARIABLEPOOL + + +#================================ +# Definition des parametres du wrapper +#================================ + +# Nota : les variables de type PROC doivent etre en majuscules ! +WRAPPER = PROC ( nom = "WRAPPER", + op = None, + docu = "", + fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", + ang = "Writes the configuration file for OPENTURNS.", + + + WrapperPath = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin d acces au wrapper", + ang = "Wrapper library path", + ), + + FunctionName = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la fonction dans le wrapper", + ang = "Function's name in wrapper", + ), + + GradientName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du gradient dans le wrapper", + ang = "Gradient's name in wrapper", + ), + + HessianName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du hessian dans le wrapper", + ang = "Hessian's name in wrapper", + ), + + WrapCouplingMode = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "static-link", "dynamic-link", "fork", ), + defaut = "fork", + fr = "Mode de couplage du solver", + ang = "Solver coupling mode", + ), + + Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", + + Command = SIMP ( statut = "o", + max = 1, + typ = "TXM", + fr = "Chemin du solver", + ang = "solver path", + ), + ), # Fin BLOC Fork + + State = SIMP ( statut = "f", + typ = "TXM", + max = 1, + into = ( "shared", "specific" ), + fr = "Partage de l'etat interne entre les fonctions", + ang = "Internal state sharing", + ), + + InDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees d'entree", + ang = "Input transfering mode", + ), + + OutDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees de sortie", + ang = "Output transfering mode", + ), + + + + + Files = FACT ( statut = "f", + min = 1, + max = "**", + + Id = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Identificateur du fichier", + ang = "File id", + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + fr = "Fichier d entree ou de sortie du solveur ?", + ang = "Input or Output file ?", + ), + + Name = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du fichier", + ang = "File name", + ), + + Path = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin du fichier", + ang = "Path file ", + ), + + Subst = SIMP ( statut = "f", + typ = "TXM", + max = "**", + fr = "Liste de variables", + ang = "List", + ), + + ), # Fin FACT Files + +) # Fin PROC WRAPPER diff --git a/Openturns_Study/catalogues_openturns.ini b/Openturns_Study/catalogues_openturns.ini new file mode 100644 index 00000000..86f2de10 --- /dev/null +++ b/Openturns_Study/catalogues_openturns.ini @@ -0,0 +1,12 @@ +# Choix des catalogues +import os +#rep_cata=os.path.dirname(os.path.abspath(__file__)) +rep_cata=os.getcwd() + +catalogues = ( +# (code,version,catalogue,formatIn,formatOut) + #('OPENTURNS_WRAPPER','V1',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V1.py'),'openturns_wrapper','wrapper'), + ('OPENTURNS_WRAPPER','V2',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V2.py'),'openturns','wrapper'), + #('OPENTURNS','Wrapper',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V1.py'),'openturns'), +) + diff --git a/Openturns_Study/configuration.py b/Openturns_Study/configuration.py new file mode 100644 index 00000000..4333f42a --- /dev/null +++ b/Openturns_Study/configuration.py @@ -0,0 +1,191 @@ +# -*- 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 sert pour charger les paramètres de configuration d'EFICAS +""" +# Modules Python +print "passage dans la surcharge de configuration pour OTW" +import os, sys, string, types, re +import traceback +from PyQt4.QtGui import * + +# Modules Eficas +from Editeur import utils + +class CONFIG: + + #----------------------------------- + def __init__(self,appli,repIni): + #----------------------------------- + + # Classe de base permettant de lire, afficher + # et sauvegarder les fichiers utilisateurs + # On a deux directories : la directory generale (Repertoire d instal + Nom du code + # Par exemple : ~/Install_Eficas/EficasV1_14/Openturns_Wrapper + # et la directorie de l utilisateur + # HOME/.Eficas_Openturns + # Le fichier prefs.py va etre lu dans la directory generale puis surcharge eventuellement + # par celui de l utilisateur + # le fichier de catalogue va etre lu dans la directory de l utilisateur s il exite + # dans le fichier general sinon + self.appli = appli + self.code = appli.code + self.salome = appli.salome + self.repIni = repIni + self.fic_prefs ="prefs.py" + + if self.appli: self.parent=appli.top + else: self.parent=None + + + self.labels=("DTDDirectory","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata","initialdir") + + # Valeurs par defaut + self.rep_user = os.path.join(os.environ['HOME'],'.Eficas_Openturns') + self.initialdir = self.rep_user + self.path_doc = self.rep_user + self.exec_acrobat = self.rep_user + + #Lecture des fichiers utilisateurs + self.lecture_fichier_ini_standard() + self.lecture_fichier_ini_utilisateur() + self.lecture_catalogues() + print self.initialdir + + #-------------------------------------- + def lecture_fichier_ini_standard(self): + #-------------------------------------- + # Verifie l'existence du fichier "standard" + # appelle la lecture de ce fichier + self.fic_ini = os.path.join(self.repIni,self.fic_prefs) + if not os.path.isfile(self.fic_ini): + QMessageBox.critical( None, "Import du fichier de Configuration", + "Erreur à la lecture du fichier de configuration "+self.fic_ini+".py" ) + sys.exit(0) + import prefs + for k in self.labels : + try : + valeur=getattr(objet,k) + setattr(self,k,valeur) + except : + pass + + + #-------------------------------------- + def lecture_fichier_ini_utilisateur(self): + #-------------------------------------- + # Surcharge les paramètres standards par les paramètres utilisateur s'ils existent + self.fic_ini_utilisateur = os.path.join(self.rep_user,self.fic_prefs) + #if not os.path.isfile(self.fic_ini_utilisateur+".py"): + if not os.path.isfile(self.fic_ini_utilisateur): + return + from utils import read_file + txt = utils.read_file(self.fic_ini_utilisateur) + from styles import style + d=locals() + try: + exec txt in d + except : + l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) + QMessageBox.critical( None, "Import du fichier de Configuration", + "Erreur à la lecture du fichier de configuration " + self.fic_ini_utilisateur ) + sys.exit(0) + for k in self.labels : + try : + setattr(self,k,d[k]) + except : + pass + + + + #-------------------------------------- + def lecture_catalogues(self): + #-------------------------------------- + rep_mat=" " # Compatbilite Aster + fic_cata ="catalogues_openturns.ini" + fic_ini = os.path.join(self.repIni,fic_cata) + fic_user= os.path.join(self.rep_user,fic_cata) + if os.path.isfile(fic_user): + fichier = fic_user + else : + fichier = fic_ini + if not os.path.isfile(fic_ini) : + QMessageBox.critical( None, "Erreur a l'import du fichier des Catalogues", + "Le fichier de configuration des catalogues "+fic_ini+" n a pas été trouvé" ) + sys.exit(0) + + from utils import read_file + txt = utils.read_file(fichier) + d=locals() + try: + exec txt in d + self.catalogues=d["catalogues"] + except : + l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) + QMessageBox.critical( None, "Import du fichier de Configuration", + "Erreur à la lecture du fichier de configuration " + fichier ) + sys.exit(0) + + + + #-------------------------------------- + def save_params(self): + #-------------------------------------- + # sauvegarde + # les nouveaux paramètres dans le fichier de configuration utilisateur + # + print "a ecrire PNPNPN" +# l_param=('exec_acrobat', 'repIni','catalogues','rep_travail','rep_mat','path_doc') +# texte="" +# for clef in l_param : +# if hasattr(self,clef): +# valeur=getattr(self,clef) +# texte= texte + clef+" = " + repr(valeur) +"\n" +# +# +# # recuperation des repertoires materiaux +# try : +# for item in self.catalogues : +# try : +# (code,version,cata,format,defaut)=item +# except : +# (code,version,cata,format)=item +# codeSansPoint=re.sub("\.","",version) +# chaine="rep_mat_"+codeSansPoint +# if hasattr(self,chaine): +# valeur=getattr(self,chaine) +# texte= texte + chaine+" = '" + str(valeur) +"'\n" +# except : +# pass +# +# f=open(self.fic_ini_utilisateur,'w+') +# f.write(texte) +# f.close() +# + + +def make_config(appli,rep): + return CONFIG(appli,rep) + +def make_config_style(appli,rep): + return None + + diff --git a/Openturns_Study/prefs.py b/Openturns_Study/prefs.py new file mode 100644 index 00000000..06ec83b8 --- /dev/null +++ b/Openturns_Study/prefs.py @@ -0,0 +1,54 @@ +# -*- 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 os, sys +# Les variables pouvant positionnees sont : +# "CODE_PATH_SURCHARGE","DTDDirectory","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata" +print "import des prefs de OPENTURNS_WRAPPER" + +code = "OPENTURNS_WRAPPER" + +# REPINI sert à localiser le fichier +# initialdir sert comme directory initial des QFileDialog +# positionnee a repin au debut mise a jour dans configuration +REPINI=os.path.dirname(os.path.abspath(__file__)) +initialdir=REPINI + +# INSTALLDIR sert à localiser l'installation d'Eficas +INSTALLDIR=os.path.join(REPINI,'..') + + +# Codage des strings qui accepte les accents (en remplacement de 'ascii') +# lang indique la langue utilisée pour les chaines d'aide : fr ou ang +lang='fr' +encoding='iso-8859-1' + +# Acces a la documentation +rep_cata = INSTALLDIR +path_doc = os.path.join(rep_cata,'Doc') +exec_acrobat = "/usr/bin/xpdf" + +# Repertoire initial +DTDDirectory="/local00/home/dutka/OpenTURNS/dutka/devel/build/install/share/openturns/wrappers/" + +# Choix des catalogues +sys.path[:0]=[INSTALLDIR] + diff --git a/Openturns_Study/properties.py b/Openturns_Study/properties.py new file mode 100644 index 00000000..8ba0ed7e --- /dev/null +++ b/Openturns_Study/properties.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +#@ MODIF properties Accas DATE 10/10/2002 AUTEUR gcbhhhh M.ADMINISTRATEUR +# CONFIGURATION MANAGEMENT OF EDF VERSION +# RESPONSABLE D6BHHHH J-P.LEFEBVRE +# ====================================================================== +# COPYRIGHT (C) 1991 - 2001 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. +# ====================================================================== +# IDENTIFICATION DU GESTIONNAIRE DE COMMANDE ACCAS A PARTIR +# DE LA VERSION DU CODE_ASTER ASSOCIE +#---------------------------------------------------------------------- +version = "7.1.0" +date = "23/04/2003" diff --git a/Openturns_Study/qtEficas_openturns_wrapper.py b/Openturns_Study/qtEficas_openturns_wrapper.py new file mode 100755 index 00000000..8da18067 --- /dev/null +++ b/Openturns_Study/qtEficas_openturns_wrapper.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- 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 sert à lancer EFICAS configuré pour Openturns +""" +# Modules Python + +# Modules Eficas +import prefs +prefs.code="OPENTURNS_WRAPPER" +from InterfaceQT4 import eficas_go + +eficas_go.lance_eficas(code=prefs.code) diff --git a/Openturns_Study/sdistOTqt.py b/Openturns_Study/sdistOTqt.py new file mode 100644 index 00000000..acf75c26 --- /dev/null +++ b/Openturns_Study/sdistOTqt.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" + Ce module sert à construire les distributions d'EFICAS pour Openturns + en fonction du tag CVS courant + Les distributions sont : + - un tar.gz pour UNIX ne contenant pas mxTextTools + L'utilisation de ce module est la suivante : + 1- Se mettre dans un répertoire de travail + 2- Configurer son environnement pour utiliser le référentiel CVS EFICAS + 3- Exporter les sources d'EficasV1 par la commande : + cvs export -r TAG -d Eficas_export EficasV1 + ou TAG est le tag CVS de la version que l'on veut distribuer (par exemple V1_1p1) + 5- Aller dans le répertoire Eficas_export + 6- Executer le script sdist.py + python sdist.py + Ce qui a pour effet de creer un repertoire dist contenant la distribution + et de la copier dans le répertoire indiqué par dir_download s'il est accessible + +""" +import os,shutil,glob,sys +import types + +nom_distrib="QTEficasOpenturns_V1_0" +path_distrib=os.path.join("dist",nom_distrib) +path_TextTools="/home/eficas/pkg/mxTools/egenix2.0.2pourWindows/mx/TextTools" +dir_download= "/home/eficas/WWW/telechargement/eficas" + +def main(): + if os.path.isdir('dist'):shutil.rmtree('dist') + + copyfiles('.',path_distrib,['LICENSE.TERMS','INSTALL','NEWS']) + + copyfiles('../Editeur',os.path.join(path_distrib,'Editeur'),['*.py','faqs.txt']) + copyfiles('../InterfaceTK',os.path.join(path_distrib,'InterfaceTK'),['*.py','faqs.txt']) + copyfiles('../InterfaceQT',os.path.join(path_distrib,'InterfaceQT'),['*.py','faqs.txt']) + copyfiles('../Ui',os.path.join(path_distrib,'Ui'),['*.ui','makefile']) + copyfiles('../Openturns',os.path.join(path_distrib,'Openturns'),['*.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'),['*']) + copyfiles('.',os.path.join(path_distrib,'AIDE','fichiers'),['INSTALL','NEWS']) + copyfiles('../Editeur',os.path.join(path_distrib,'AIDE','fichiers'),['faqs.txt']) + # ______________________ + + copyfiles('../convert',os.path.join(path_distrib,'convert'),['*.py']) + copyfiles('../convert/Parserv5',os.path.join(path_distrib,'convert','Parserv5'),['*.py']) + copyfiles('../generator',os.path.join(path_distrib,'generator'),['*.py']) + copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.gif']) + copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.png']) + copyfiles('../Editeur/Patrons/',os.path.join(path_distrib,'Editeur','Patrons'),['*.com*']) + copyfiles('../Editeur/Patrons/OPENTURNS',os.path.join(path_distrib,'Editeur','Patrons','OPENTURNS'),['*.com*']) + + copyfiles('../Noyau',os.path.join(path_distrib,'Noyau'),['*.py']) + copyfiles('../Validation',os.path.join(path_distrib,'Validation'),['*.py']) + + + tarball= maketarball('dist',nom_distrib,nom_distrib) + try: + shutil.copy(tarball,dir_download) + except: + print "Repertoire de download inconnu : ",dir_download + + + +def make_dir(dir_cible): + if type(dir_cible) is not types.StringType: + raise "make_dir : dir_cible doit etre une string (%s)" % `dir_cible` + head,tail=os.path.split(dir_cible) + tails=[tail] + while head and tail and not os.path.isdir(head): + head,tail=os.path.split(head) + tails.insert(0, tail) + + for d in tails: + head = os.path.join(head, d) + if not os.path.isdir(head):os.mkdir(head) + + +def copyfiles(dir_origin,dir_cible,listfiles): + if not os.path.isdir(dir_cible):make_dir(dir_cible) + for glob_files in listfiles: + for file in glob.glob(os.path.join(dir_origin,glob_files)): + shutil.copy(file,dir_cible) + + +def maketarball(dir_trav,dir_cible,nom_tar): + prev=os.getcwd() + print prev + os.chdir(dir_trav) + os.system("tar -cf "+nom_tar+".tar "+dir_cible) + os.system("gzip -f9 "+nom_tar+".tar ") + os.chdir(prev) + return os.path.join(dir_trav,nom_tar+".tar.gz") + + +main() + diff --git a/Openturns_Study/style.py b/Openturns_Study/style.py new file mode 100644 index 00000000..7da9d534 --- /dev/null +++ b/Openturns_Study/style.py @@ -0,0 +1 @@ +# Necessaire pour compatibilite avec Aster diff --git a/Openturns_Wrapper/OpenTURNS_Cata_Wrapper_V1.py b/Openturns_Wrapper/OpenTURNS_Cata_Wrapper_V1.py new file mode 100644 index 00000000..7bad7c17 --- /dev/null +++ b/Openturns_Wrapper/OpenTURNS_Cata_Wrapper_V1.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +# -------------------------------------------------- +# debut entete +# -------------------------------------------------- + +import Accas +from Accas import * + + +#CONTEXT.debug = 1 +JdC = JDC_CATA ( code = 'OPENTURNS_WRAPPER', + execmodul = None, + regles = ( AU_MOINS_UN ( 'WRAPPER' ), ), + ) # Fin JDC_CATA + +# -------------------------------------------------- +# fin entete +# -------------------------------------------------- + + +#================================ +# 2. Definition des variables +#================================ + +VARIABLEPOOL = PROC ( nom = "VARIABLEPOOL", + op = None, + docu = "", + fr = "L'ensemble des variables probabilistes", + ang = "The pool of probabilistic variables", + + + Variables = FACT ( statut = "o", + min = 1, + max = "**", + + + + Name = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la variable, identique au nom dans le solver.", + ang = "Name of the variable, identical to the name in solver." + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + defaut = "in", + fr = "variable d'entree ou de sortie du solver", + ang = "Input or Output variable", + ), + + Unit = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Unite", + ang = "Unit", + ), + + Comment = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Commentaire", + ang = "Comment", + ), + + Regexp = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Expression reguliere", + ang = "Regular expression", + ), + + Format = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Format d'ecriture", + ang = "Format", + ), + + + ), # Fin FACT Variables + +) # Fin PROC VARIABLEPOOL + + +#================================ +# Definition des parametres du wrapper +#================================ + +# Nota : les variables de type PROC doivent etre en majuscules ! +WRAPPER = PROC ( nom = "WRAPPER", + op = None, + docu = "", + fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", + ang = "Writes the configuration file for OPENTURNS.", + + + WrapperPath = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin d acces au wrapper", + ang = "Wrapper library path", + ), + + FunctionName = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la fonction dans le wrapper", + ang = "Function's name in wrapper", + ), + + GradientName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du gradient dans le wrapper", + ang = "Gradient's name in wrapper", + ), + + HessianName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du hessian dans le wrapper", + ang = "Hessian's name in wrapper", + ), + + WrapCouplingMode = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "static-link", "dynamic-link", "fork", ), + fr = "Mode de couplage du solver", + ang = "Solver coupling mode", + ), + + Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", + + Command = SIMP ( statut = "o", + max = 1, + typ = "TXM", + fr = "Chemin du solver", + ang = "solver path", + ), + ), # Fin BLOC Fork + + State = SIMP ( statut = "f", + typ = "TXM", + max = 1, + into = ( "shared", "specific" ), + fr = "Partage de l'etat interne entre les fonctions", + ang = "Internal state sharing", + ), + + InDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees d'entree", + ang = "Input transfering mode", + ), + + OutDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees de sortie", + ang = "Output transfering mode", + ), + + + + + Files = FACT ( statut = "f", + min = 1, + max = "**", + + Id = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Identificateur du fichier", + ang = "File id", + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + fr = "Fichier d entree ou de sortie du solveur ?", + ang = "Input or Output file ?", + ), + + Name = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du fichier", + ang = "File name", + ), + + Path = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin du fichier", + ang = "Path file ", + ), + + Subst = SIMP ( statut = "f", + typ = "TXM", + max = "**", + fr = "Liste de variables", + ang = "List", + ), + + ), # Fin FACT Files + +) # Fin PROC WRAPPER diff --git a/Openturns_Wrapper/OpenTURNS_Cata_Wrapper_V2.py b/Openturns_Wrapper/OpenTURNS_Cata_Wrapper_V2.py new file mode 100644 index 00000000..69bff829 --- /dev/null +++ b/Openturns_Wrapper/OpenTURNS_Cata_Wrapper_V2.py @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- + +# -------------------------------------------------- +# debut entete +# -------------------------------------------------- + +import Accas +from Accas import * + + +#CONTEXT.debug = 1 +JdC = JDC_CATA ( code = 'OPENTURNS_WRAPPER', + execmodul = None, + regles = ( AU_MOINS_UN ( 'WRAPPER' ), ), + ) # Fin JDC_CATA + +# -------------------------------------------------- +# fin entete +# -------------------------------------------------- + + +#================================ +# 2. Definition des variables +#================================ + +VARIABLEPOOL = PROC ( nom = "VARIABLEPOOL", + op = None, + docu = "", + fr = "L'ensemble des variables probabilistes", + ang = "The pool of probabilistic variables", + + + Variables = FACT ( statut = "o", + min = 1, + max = "**", + + + + Name = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la variable, identique au nom dans le solver.", + ang = "Name of the variable, identical to the name in solver." + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + defaut = "in", + fr = "variable d'entree ou de sortie du solver", + ang = "Input or Output variable", + ), + + Unit = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Unite", + ang = "Unit", + ), + + Comment = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Commentaire", + ang = "Comment", + ), + + Regexp = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Expression reguliere", + ang = "Regular expression", + ), + + Format = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Format d'ecriture", + ang = "Format", + ), + + + ), # Fin FACT Variables + +) # Fin PROC VARIABLEPOOL + + +#================================ +# Definition des parametres du wrapper +#================================ + +# Nota : les variables de type PROC doivent etre en majuscules ! +WRAPPER = PROC ( nom = "WRAPPER", + op = None, + docu = "", + fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", + ang = "Writes the configuration file for OPENTURNS.", + + + WrapperPath = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin d acces au wrapper", + ang = "Wrapper library path", + ), + + FunctionName = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Nom de la fonction dans le wrapper", + ang = "Function's name in wrapper", + ), + + GradientName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du gradient dans le wrapper", + ang = "Gradient's name in wrapper", + ), + + HessianName = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du hessian dans le wrapper", + ang = "Hessian's name in wrapper", + ), + + WrapCouplingMode = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "static-link", "dynamic-link", "fork", ), + defaut = "fork", + fr = "Mode de couplage du solver", + ang = "Solver coupling mode", + ), + + Fork = BLOC ( condition = " WrapCouplingMode in ( 'fork', ) ", + + Command = SIMP ( statut = "o", + max = 1, + typ = "TXM", + fr = "Chemin du solver", + ang = "solver path", + ), + ), # Fin BLOC Fork + + State = SIMP ( statut = "f", + typ = "TXM", + max = 1, + into = ( "shared", "specific" ), + fr = "Partage de l'etat interne entre les fonctions", + ang = "Internal state sharing", + ), + + InDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees d'entree", + ang = "Input transfering mode", + ), + + OutDataTransfer = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "files", "arguments", ), + fr = "Mode de transfert des donnees de sortie", + ang = "Output transfering mode", + ), + + + + + Files = FACT ( statut = "f", + min = 1, + max = "**", + + Id = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Identificateur du fichier", + ang = "File id", + ), + + Type = SIMP ( statut = "o", + typ = "TXM", + max = 1, + into = ( "in", "out", ), + fr = "Fichier d entree ou de sortie du solveur ?", + ang = "Input or Output file ?", + ), + + Name = SIMP ( statut = "f", + typ = "TXM", + max = 1, + fr = "Nom du fichier", + ang = "File name", + ), + + Path = SIMP ( statut = "o", + typ = "TXM", + max = 1, + fr = "Chemin du fichier", + ang = "Path file ", + ), + + Subst = SIMP ( statut = "f", + typ = "TXM", + max = "**", + fr = "Liste de variables", + ang = "List", + ), + + ), # Fin FACT Files + +) # Fin PROC WRAPPER diff --git a/Openturns_Wrapper/catalogues_openturns.ini b/Openturns_Wrapper/catalogues_openturns.ini new file mode 100644 index 00000000..9593c04d --- /dev/null +++ b/Openturns_Wrapper/catalogues_openturns.ini @@ -0,0 +1,12 @@ +# Choix des catalogues +import os +#rep_cata=os.path.dirname(os.path.abspath(__file__)) +rep_cata=os.getcwd() + +catalogues = ( +# (code,version,catalogue,formatIn,formatOut) + #('OPENTURNS_WRAPPER','V1',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V1.py'),'openturns_wrapper','wrapper'), + ('OPENTURNS_WRAPPER','V2',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V2.py'),'openturns_wrapper','wrapper'), + #('OPENTURNS','Wrapper',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V1.py'),'openturns'), +) + diff --git a/Openturns_Wrapper/configuration.py b/Openturns_Wrapper/configuration.py new file mode 100644 index 00000000..f97ef869 --- /dev/null +++ b/Openturns_Wrapper/configuration.py @@ -0,0 +1,193 @@ +# -*- 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 sert pour charger les paramètres de configuration d'EFICAS +""" +# Modules Python +print "passage dans la surcharge de configuration pour OTW" +import os, sys, string, types, re +import traceback +from PyQt4.QtGui import * + +# Modules Eficas +from Editeur import utils + +class CONFIG: + + #----------------------------------- + def __init__(self,appli,repIni): + #----------------------------------- + + # Classe de base permettant de lire, afficher + # et sauvegarder les fichiers utilisateurs + # On a deux directories : la directory generale (Repertoire d instal + Nom du code + # Par exemple : ~/Install_Eficas/EficasV1_14/Openturns_Wrapper + # et la directorie de l utilisateur + # HOME/.Eficas_Openturns + # Le fichier prefs.py va etre lu dans la directory generale puis surcharge eventuellement + # par celui de l utilisateur + # le fichier de catalogue va etre lu dans la directory de l utilisateur s il exite + # dans le fichier general sinon + self.appli = appli + self.code = appli.code + self.salome = appli.salome + self.repIni = repIni + self.fic_prefs ="prefs.py" + + if self.appli: + self.parent=appli.top + self.appli.format_fichier="openturns_wrapper" + else: self.parent=None + + + self.labels=("OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata","initialdir") + + # Valeurs par defaut + self.rep_user = os.path.join(os.environ['HOME'],'.Eficas_Openturns') + self.initialdir = self.rep_user + self.path_doc = self.rep_user + self.exec_acrobat = self.rep_user + + #Lecture des fichiers utilisateurs + self.lecture_fichier_ini_standard() + self.lecture_fichier_ini_utilisateur() + self.lecture_catalogues() + print self.initialdir + + #-------------------------------------- + def lecture_fichier_ini_standard(self): + #-------------------------------------- + # Verifie l'existence du fichier "standard" + # appelle la lecture de ce fichier + self.fic_ini = os.path.join(self.repIni,self.fic_prefs) + if not os.path.isfile(self.fic_ini): + QMessageBox.critical( None, "Import du fichier de Configuration", + "Erreur à la lecture du fichier de configuration "+self.fic_ini+".py" ) + sys.exit(0) + import prefs + for k in self.labels : + try : + valeur=getattr(objet,k) + setattr(self,k,valeur) + except : + pass + + + #-------------------------------------- + def lecture_fichier_ini_utilisateur(self): + #-------------------------------------- + # Surcharge les paramètres standards par les paramètres utilisateur s'ils existent + self.fic_ini_utilisateur = os.path.join(self.rep_user,self.fic_prefs) + #if not os.path.isfile(self.fic_ini_utilisateur+".py"): + if not os.path.isfile(self.fic_ini_utilisateur): + return + from utils import read_file + txt = utils.read_file(self.fic_ini_utilisateur) + from styles import style + d=locals() + try: + exec txt in d + except : + l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) + QMessageBox.critical( None, "Import du fichier de Configuration", + "Erreur à la lecture du fichier de configuration " + self.fic_ini_utilisateur ) + sys.exit(0) + for k in self.labels : + try : + setattr(self,k,d[k]) + except : + pass + + + + #-------------------------------------- + def lecture_catalogues(self): + #-------------------------------------- + rep_mat=" " # Compatbilite Aster + fic_cata ="catalogues_openturns.ini" + fic_ini = os.path.join(self.repIni,fic_cata) + fic_user= os.path.join(self.rep_user,fic_cata) + if os.path.isfile(fic_user): + fichier = fic_user + else : + fichier = fic_ini + if not os.path.isfile(fic_ini) : + QMessageBox.critical( None, "Erreur a l'import du fichier des Catalogues", + "Le fichier de configuration des catalogues "+fic_ini+" n a pas été trouvé" ) + sys.exit(0) + + from utils import read_file + txt = utils.read_file(fichier) + d=locals() + try: + exec txt in d + self.catalogues=d["catalogues"] + except : + l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) + QMessageBox.critical( None, "Import du fichier de Configuration", + "Erreur à la lecture du fichier de configuration " + fichier ) + sys.exit(0) + + + + #-------------------------------------- + def save_params(self): + #-------------------------------------- + # sauvegarde + # les nouveaux paramètres dans le fichier de configuration utilisateur + # + print "a ecrire PNPNPN" +# l_param=('exec_acrobat', 'repIni','catalogues','rep_travail','rep_mat','path_doc') +# texte="" +# for clef in l_param : +# if hasattr(self,clef): +# valeur=getattr(self,clef) +# texte= texte + clef+" = " + repr(valeur) +"\n" +# +# +# # recuperation des repertoires materiaux +# try : +# for item in self.catalogues : +# try : +# (code,version,cata,format,defaut)=item +# except : +# (code,version,cata,format)=item +# codeSansPoint=re.sub("\.","",version) +# chaine="rep_mat_"+codeSansPoint +# if hasattr(self,chaine): +# valeur=getattr(self,chaine) +# texte= texte + chaine+" = '" + str(valeur) +"'\n" +# except : +# pass +# +# f=open(self.fic_ini_utilisateur,'w+') +# f.write(texte) +# f.close() +# + + +def make_config(appli,rep): + return CONFIG(appli,rep) + +def make_config_style(appli,rep): + return None + + diff --git a/Openturns_Wrapper/prefs.py b/Openturns_Wrapper/prefs.py new file mode 100644 index 00000000..e3141852 --- /dev/null +++ b/Openturns_Wrapper/prefs.py @@ -0,0 +1,56 @@ +# -*- 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 os, sys +# Les variables pouvant positionnees sont : +# "CODE_PATH_SURCHARGE","OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata" +print "import des prefs de OPENTURNS_WRAPPER" + +code = "OPENTURNS_WRAPPER" + +# REPINI sert à localiser le fichier +# initialdir sert comme directory initial des QFileDialog +# positionnee a repin au debut mise a jour dans configuration +REPINI=os.path.dirname(os.path.abspath(__file__)) +initialdir=REPINI + +# INSTALLDIR sert à localiser l'installation d'Eficas +INSTALLDIR=os.path.join(REPINI,'..') + + +# Codage des strings qui accepte les accents (en remplacement de 'ascii') +# lang indique la langue utilisée pour les chaines d'aide : fr ou ang +lang='fr' +encoding='iso-8859-1' + +# Acces a la documentation +rep_cata = INSTALLDIR +path_doc = os.path.join(rep_cata,'Doc') +exec_acrobat = "/usr/bin/xpdf" + +# OpenTURNS Python module +OpenTURNS_path="/opt/OpenTURNS/install/lib/python2.4/site-packages" + +# Choix des catalogues +sys.path[:0]=[INSTALLDIR] +sys.path.append( OpenTURNS_path ) + + diff --git a/Openturns_Wrapper/properties.py b/Openturns_Wrapper/properties.py new file mode 100644 index 00000000..8ba0ed7e --- /dev/null +++ b/Openturns_Wrapper/properties.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +#@ MODIF properties Accas DATE 10/10/2002 AUTEUR gcbhhhh M.ADMINISTRATEUR +# CONFIGURATION MANAGEMENT OF EDF VERSION +# RESPONSABLE D6BHHHH J-P.LEFEBVRE +# ====================================================================== +# COPYRIGHT (C) 1991 - 2001 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. +# ====================================================================== +# IDENTIFICATION DU GESTIONNAIRE DE COMMANDE ACCAS A PARTIR +# DE LA VERSION DU CODE_ASTER ASSOCIE +#---------------------------------------------------------------------- +version = "7.1.0" +date = "23/04/2003" diff --git a/Openturns_Wrapper/qtEficas_openturns_wrapper.py b/Openturns_Wrapper/qtEficas_openturns_wrapper.py new file mode 100755 index 00000000..8da18067 --- /dev/null +++ b/Openturns_Wrapper/qtEficas_openturns_wrapper.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- 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 sert à lancer EFICAS configuré pour Openturns +""" +# Modules Python + +# Modules Eficas +import prefs +prefs.code="OPENTURNS_WRAPPER" +from InterfaceQT4 import eficas_go + +eficas_go.lance_eficas(code=prefs.code) diff --git a/Openturns_Wrapper/sdistOTqt.py b/Openturns_Wrapper/sdistOTqt.py new file mode 100644 index 00000000..acf75c26 --- /dev/null +++ b/Openturns_Wrapper/sdistOTqt.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" + Ce module sert à construire les distributions d'EFICAS pour Openturns + en fonction du tag CVS courant + Les distributions sont : + - un tar.gz pour UNIX ne contenant pas mxTextTools + L'utilisation de ce module est la suivante : + 1- Se mettre dans un répertoire de travail + 2- Configurer son environnement pour utiliser le référentiel CVS EFICAS + 3- Exporter les sources d'EficasV1 par la commande : + cvs export -r TAG -d Eficas_export EficasV1 + ou TAG est le tag CVS de la version que l'on veut distribuer (par exemple V1_1p1) + 5- Aller dans le répertoire Eficas_export + 6- Executer le script sdist.py + python sdist.py + Ce qui a pour effet de creer un repertoire dist contenant la distribution + et de la copier dans le répertoire indiqué par dir_download s'il est accessible + +""" +import os,shutil,glob,sys +import types + +nom_distrib="QTEficasOpenturns_V1_0" +path_distrib=os.path.join("dist",nom_distrib) +path_TextTools="/home/eficas/pkg/mxTools/egenix2.0.2pourWindows/mx/TextTools" +dir_download= "/home/eficas/WWW/telechargement/eficas" + +def main(): + if os.path.isdir('dist'):shutil.rmtree('dist') + + copyfiles('.',path_distrib,['LICENSE.TERMS','INSTALL','NEWS']) + + copyfiles('../Editeur',os.path.join(path_distrib,'Editeur'),['*.py','faqs.txt']) + copyfiles('../InterfaceTK',os.path.join(path_distrib,'InterfaceTK'),['*.py','faqs.txt']) + copyfiles('../InterfaceQT',os.path.join(path_distrib,'InterfaceQT'),['*.py','faqs.txt']) + copyfiles('../Ui',os.path.join(path_distrib,'Ui'),['*.ui','makefile']) + copyfiles('../Openturns',os.path.join(path_distrib,'Openturns'),['*.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'),['*']) + copyfiles('.',os.path.join(path_distrib,'AIDE','fichiers'),['INSTALL','NEWS']) + copyfiles('../Editeur',os.path.join(path_distrib,'AIDE','fichiers'),['faqs.txt']) + # ______________________ + + copyfiles('../convert',os.path.join(path_distrib,'convert'),['*.py']) + copyfiles('../convert/Parserv5',os.path.join(path_distrib,'convert','Parserv5'),['*.py']) + copyfiles('../generator',os.path.join(path_distrib,'generator'),['*.py']) + copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.gif']) + copyfiles('../Editeur/icons',os.path.join(path_distrib,'Editeur','icons'),['*.png']) + copyfiles('../Editeur/Patrons/',os.path.join(path_distrib,'Editeur','Patrons'),['*.com*']) + copyfiles('../Editeur/Patrons/OPENTURNS',os.path.join(path_distrib,'Editeur','Patrons','OPENTURNS'),['*.com*']) + + copyfiles('../Noyau',os.path.join(path_distrib,'Noyau'),['*.py']) + copyfiles('../Validation',os.path.join(path_distrib,'Validation'),['*.py']) + + + tarball= maketarball('dist',nom_distrib,nom_distrib) + try: + shutil.copy(tarball,dir_download) + except: + print "Repertoire de download inconnu : ",dir_download + + + +def make_dir(dir_cible): + if type(dir_cible) is not types.StringType: + raise "make_dir : dir_cible doit etre une string (%s)" % `dir_cible` + head,tail=os.path.split(dir_cible) + tails=[tail] + while head and tail and not os.path.isdir(head): + head,tail=os.path.split(head) + tails.insert(0, tail) + + for d in tails: + head = os.path.join(head, d) + if not os.path.isdir(head):os.mkdir(head) + + +def copyfiles(dir_origin,dir_cible,listfiles): + if not os.path.isdir(dir_cible):make_dir(dir_cible) + for glob_files in listfiles: + for file in glob.glob(os.path.join(dir_origin,glob_files)): + shutil.copy(file,dir_cible) + + +def maketarball(dir_trav,dir_cible,nom_tar): + prev=os.getcwd() + print prev + os.chdir(dir_trav) + os.system("tar -cf "+nom_tar+".tar "+dir_cible) + os.system("gzip -f9 "+nom_tar+".tar ") + os.chdir(prev) + return os.path.join(dir_trav,nom_tar+".tar.gz") + + +main() + diff --git a/Openturns_Wrapper/style.py b/Openturns_Wrapper/style.py new file mode 100644 index 00000000..7da9d534 --- /dev/null +++ b/Openturns_Wrapper/style.py @@ -0,0 +1 @@ +# Necessaire pour compatibilite avec Aster diff --git a/convert/convert_openturns.py b/convert/convert_openturns.py deleted file mode 100644 index 527e6f65..00000000 --- a/convert/convert_openturns.py +++ /dev/null @@ -1,128 +0,0 @@ -# -*- 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 convertisseur de fichier - au format python pour EFICAS. - - Un plugin convertisseur doit fournir deux attributs de classe : - extensions et formats et deux méthodes : readfile,convert. - - L'attribut de classe extensions est une liste d'extensions - de fichiers préconisées pour ce type de format. Cette information - est seulement indicative. - - L'attribut de classe formats est une liste de formats de sortie - supportés par le convertisseur. Les formats possibles sont : - eval, dict ou exec. - Le format eval est un texte source Python qui peut etre evalué. Le - résultat de l'évaluation est un objet Python quelconque. - Le format dict est un dictionnaire Python. - Le format exec est un texte source Python qui peut etre executé. - - La méthode readfile a pour fonction de lire un fichier dont le - nom est passé en argument de la fonction. - - convertisseur.readfile(nom_fichier) - - La méthode convert a pour fonction de convertir le fichier - préalablement lu dans un objet du format passé en argument. - - objet=convertisseur.convert(outformat) - - Ce convertisseur supporte le format de sortie exec - -""" -import sys,string,traceback - -import parseur_python -from Noyau import N_CR - -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' : 'openturns', - # La factory pour créer une instance du plugin - 'factory' : PythonParser, - } - - -class PythonParser: - """ - Ce convertisseur lit un fichier au format python avec la - methode readfile : convertisseur.readfile(nom_fichier) - et retourne le texte au format outformat avec la - methode convertisseur.convert(outformat) - - Ses caractéristiques principales sont exposées dans 2 attributs - de classe : - - extensions : qui donne une liste d'extensions de fichier préconisées - - formats : qui donne une liste de formats de sortie supportés - """ - # Les extensions de fichier préconisées - extensions=('.py',) - # Les formats de sortie supportés (eval dict ou exec) - # Le format exec est du python executable (commande exec) converti avec PARSEUR_PYTHON - # Le format execnoparseur est du python executable (commande exec) non converti - formats=('exec','execnoparseur') - - def __init__(self,cr=None): - # Si l'objet compte-rendu n'est pas fourni, on utilise le - # compte-rendu standard - self.text='' - if cr : - self.cr=cr - else: - self.cr=N_CR.CR(debut='CR convertisseur format python', - fin='fin CR format python') - - def readfile(self,filename): - self.filename=filename - try: - self.text=open(filename).read() - except: - self.cr.fatal("Impossible ouvrir fichier %s" % filename) - return - - def convert(self,outformat,appli=None): - if outformat == 'exec': - try: - #txt=parseur_python.PARSEUR_PYTHON(self.text).get_texte(appli) - #print txt - #return txt - return parseur_python.PARSEUR_PYTHON(self.text).get_texte(appli) - except: - # Erreur lors de la conversion - l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1], - sys.exc_info()[2]) - self.cr.exception("Impossible de convertir le fichier python \ - qui doit contenir des erreurs.\n \ - On retourne le fichier non converti \n \ - Prévenir la maintenance. \n" + string.join(l)) - # On retourne néanmoins le source initial non converti (au cas où) - return self.text - elif outformat == 'execnoparseur': - return self.text - else: - raise "Format de sortie : %s, non supporté" - return None - diff --git a/convert/convert_openturns_wrapper.py b/convert/convert_openturns_wrapper.py new file mode 100644 index 00000000..0cc2ea11 --- /dev/null +++ b/convert/convert_openturns_wrapper.py @@ -0,0 +1,128 @@ +# -*- 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 convertisseur de fichier + au format python pour EFICAS. + + Un plugin convertisseur doit fournir deux attributs de classe : + extensions et formats et deux méthodes : readfile,convert. + + L'attribut de classe extensions est une liste d'extensions + de fichiers préconisées pour ce type de format. Cette information + est seulement indicative. + + L'attribut de classe formats est une liste de formats de sortie + supportés par le convertisseur. Les formats possibles sont : + eval, dict ou exec. + Le format eval est un texte source Python qui peut etre evalué. Le + résultat de l'évaluation est un objet Python quelconque. + Le format dict est un dictionnaire Python. + Le format exec est un texte source Python qui peut etre executé. + + La méthode readfile a pour fonction de lire un fichier dont le + nom est passé en argument de la fonction. + - convertisseur.readfile(nom_fichier) + + La méthode convert a pour fonction de convertir le fichier + préalablement lu dans un objet du format passé en argument. + - objet=convertisseur.convert(outformat) + + Ce convertisseur supporte le format de sortie exec + +""" +import sys,string,traceback + +import parseur_python +from Noyau import N_CR + +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' : 'openturns_wrapper', + # La factory pour créer une instance du plugin + 'factory' : PythonParser, + } + + +class PythonParser: + """ + Ce convertisseur lit un fichier au format python avec la + methode readfile : convertisseur.readfile(nom_fichier) + et retourne le texte au format outformat avec la + methode convertisseur.convert(outformat) + + Ses caractéristiques principales sont exposées dans 2 attributs + de classe : + - extensions : qui donne une liste d'extensions de fichier préconisées + - formats : qui donne une liste de formats de sortie supportés + """ + # Les extensions de fichier préconisées + extensions=('.py',) + # Les formats de sortie supportés (eval dict ou exec) + # Le format exec est du python executable (commande exec) converti avec PARSEUR_PYTHON + # Le format execnoparseur est du python executable (commande exec) non converti + formats=('exec','execnoparseur') + + def __init__(self,cr=None): + # Si l'objet compte-rendu n'est pas fourni, on utilise le + # compte-rendu standard + self.text='' + if cr : + self.cr=cr + else: + self.cr=N_CR.CR(debut='CR convertisseur format python', + fin='fin CR format python') + + def readfile(self,filename): + self.filename=filename + try: + self.text=open(filename).read() + except: + self.cr.fatal("Impossible ouvrir fichier %s" % filename) + return + + def convert(self,outformat,appli=None): + if outformat == 'exec': + try: + #txt=parseur_python.PARSEUR_PYTHON(self.text).get_texte(appli) + #print txt + #return txt + return parseur_python.PARSEUR_PYTHON(self.text).get_texte(appli) + except: + # Erreur lors de la conversion + l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1], + sys.exc_info()[2]) + self.cr.exception("Impossible de convertir le fichier python \ + qui doit contenir des erreurs.\n \ + On retourne le fichier non converti \n \ + Prévenir la maintenance. \n" + string.join(l)) + # On retourne néanmoins le source initial non converti (au cas où) + return self.text + elif outformat == 'execnoparseur': + return self.text + else: + raise "Format de sortie : %s, non supporté" + return None + diff --git a/generator/OpenturnsSTD.py b/generator/OpenturnsSTD.py index 9fb4b234..3c54b130 100644 --- a/generator/OpenturnsSTD.py +++ b/generator/OpenturnsSTD.py @@ -86,23 +86,175 @@ class STDGenerateur : def CreeSTD (self) : - #------------------ ''' Pilotage de la creation du fichier python ''' - self.texte = self.CreeEntete() - self.texte += self.CreeRandomGenerator() - self.texte += self.CreeFunction() - self.texte += self.CreeLois() - self.texte += self.CreeCopula() - self.texte += self.CreeDistribution() - self.texte += self.CreeRandomVector() - self.texte += self.CreeAnalyse() - self.texte += self.CreeResu() - self.texte += self.CreeTexteFin() + self.texte = self.Entete() + #self.texte += self.CreeRandomGenerator() + #self.texte += self.CreeFunction() + #self.texte += self.CreeLois() + #self.texte += self.CreeCopula() + #self.texte += self.CreeDistribution() + #self.texte += self.CreeRandomVector() + #self.texte += self.CreeAnalyse() + #self.texte += self.CreeResu() + #self.texte += self.CreeTexteFin() + self.texte += self.PiedDePage() return self.texte # ______________________________________ + + def Entete (self) : + ''' + Entete pour charger les bibliotheques Python + ''' + texte = """\ +#!/usr/bin/env python +## -*- Python -*- + +## Library loading +import sys +import os +from openturns import * + +""" + return texte + + def PiedDePage (self) : + ''' + Ferme le fichier proprement + ''' + return 'print "OK"\n' + +# ______________________________________ + + def CreeRandomGenerator (self) : + #------------------------------- + ''' + Positionnement du generateur aleatoire pour rejouer des etudes avec les memes valeurs + ''' + texte = "\n" + texte += "# RandomGenerator" + texte += "\n" + if self.DictMCVal.has_key("RandomGeneratorSeed") : + texte += "# We set the RandomGenerator seed in order to replay the study\n" + texte += "RandomGenerator().SetSeed(%d)\n" % self.DictMCVal["RandomGeneratorSeed"] + return texte + +# _____________________________________ + + def CreeFunction (self) : + #------------------------ + ''' + La fonction : + Remarque : la chaine 'XXXXXX' est remplacee par le nom du solver au moment de l enregistrement + ''' + texte = "\n" + texte += "# La fonction\n" + texte += "\n" + texte += "myFunction = NumericalMathFunction('XXXXXX')\n" + texte += "dim = myFunction.getInputNumericalPointDimension()\n" + return texte + +# ______________________________________ + + def CreeLois (self) : + #------------------ + ''' + La definition des distributions marginales pour la propagation des incertitudes + ''' + code_erreur = 0 + texte = "\n" + texte += "# Les lois\n" + texte += "\n" + if self.DictMCVal.has_key("Analysis") and self.DictMCVal["Analysis"] == "Reliability" : + texte += "myPhysicalStartingPoint = NumericalPoint(dim, 0.0)\n" + texte += "myCollection = DistributionCollection(dim)\n\n" + + numVar = 0 + for DictVariable in self.ListeVariables : + + boolLoiDef = True + if DictVariable.has_key("MarginalDistribution") and DictVariable.has_key("Name"): + ConceptLoi = DictVariable["MarginalDistribution"] + NomLoi = DictVariable["Name"]+"_Dist" + else : + boolLoiDef = False + + if boolLoiDef and self.DictLois.has_key(ConceptLoi): + loi = self.DictLois[ConceptLoi] + else : + boolLoiDef = False + + if boolLoiDef and loi.has_key("Kind") : + TypeLoi = loi["Kind"] + else : + boolLoiDef = False + + if not boolLoiDef or TypeLoi not in self.listeParamLoi.keys() : + texte += " Loi " + TypeLoi +" non programmee \n" + numVar += 1 + continue + + ListeParametres = [] + TexteParametres = "" + for Param in self.listeParamLoi[TypeLoi]: + if loi.has_key(Param) : + texte += " " + NomLoi + "_" + Param + " = " + str(loi[Param]) + "\n" + ListeParametres.append(NomLoi + "_" + Param) + TexteParametres += NomLoi + "_" + Param + "," + + texte += " " + NomLoi + " = " + TypeLoi + "( " + + if loi.has_key("Settings" ) and self.listeParamLoiSettings.has_key(TypeLoi) \ + and self.listeParamLoiSettings[TypeLoi].has_key(loi["Settings"]): + NumParam = self.listeParamLoiSettings[TypeLoi][loi["Settings"]] + texte += TexteParametres + NumParam +" )\n" + else : + texte += TexteParametres[:-1] + " )\n" + + texte += " " + NomLoi + '.setName( "'+DictVariable["Name"] +'" )\n' + texte += " myCollection["+str(numVar)+"] = Distribution( "+NomLoi+" )\n" + + if self.DictMCVal["Analysis"] == "Reliability" : + texte += " myPhysicalStartingPoint["+str(numVar)+"] = " + if DictVariable.has_key("PhysicalStartingPoint") : + texte += str(DictVariable["PhysicalStartingPoint"]) +"\n\n" + else : + texte += NomLoi+".computeQuantile( 0.5 )[0]\n\n" + + numVar += 1 + return texte + +# ______________________________________ + + def CreeCopula (self) : + #------------------ + # Appelee par CreeSTD + texte = "\n# La copule\n\n" + texte += " myCopula = IndependentCopula(dim)\n" + return texte +# ______________________________________ + + def CreeDistribution (self) : + #---------------------------- + # Appelee par CreeSTD + texte = "\n# La distribution\n\n" + texte += " myDistribution = ComposedDistribution(myCollection, Copula(myCopula))\n" + return texte + +# ______________________________________ + + def CreeRandomVector (self) : + #---------------------------- + # Appelee par CreeSTD + texte = "\n# Le Random Vector\n\n" + texte += " myRandomVector_in = RandomVector(Distribution(myDistribution))\n" + texte += " myRandomVector_out = RandomVector(myFunction, myRandomVector_in)\n" + return texte + +# ______________________________________ + # # Methodes liees a la creation de la partie Analayse # Si le mot clef Analyse existe la methode portant le meme nom va etre appele @@ -116,6 +268,39 @@ class STDGenerateur : texte += apply( STDGenerateur.__dict__[self.DictMCVal["Analysis"]], (self,) ) return texte +# ______________________________________ + + def CreeResu (self) : + #------------------ + ''' + ''' + texte = "\n# Le resultat\n\n" + texte += " myResu = " + self.NomAlgo + ".getResult() \n" + texte += " probability = myResu.getEventProbability()" + + return texte + +# ______________________________________ + + def CreeTexteFin(self) : + #------------------------------------ + texte ='\n\nexcept : \n' + texte += ' error_message = sys.exc_type\n' + texte += ' if error_message is not None :\n' + texte += ' texte = "================================================= \\n"\n' + texte += ' texte += " Message d\'erreur : \" + str(error_message) + "\\n"\n' + texte += ' texte += "=================================================\\n"\n' + texte += ' print texte"\n' + texte += "sys.exit(error_message)\n" + return texte + +# ______________________________________ +# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ +# ______________________________________ + + + + def Reliability (self) : #------------------------ # Appelee eventuellement par CreeAnalyse @@ -230,54 +415,7 @@ class STDGenerateur : if self.DictMCVal.has_key(MC) and self.DictMCVal[MC] != None : texte += " myMethod.set"+ MC +"(" + str(self.DictMCVal[MC]) + ")\n\n " -# _____________________________________ - def CreeRandomGenerator (self) : - #------------------------------- - # Appelee par CreeSTD - texte = "" - if self.DictMCVal.has_key("RandomGeneratorSeed") : - texte += "# We set the RandomGenerator seed in order to replay the study\n" - texte += " RandomGenerator().SetSeed(%d)\n" % self.DictMCVal["RandomGeneratorSeed"] - return texte - - def CreeFunction (self) : - #------------------------- - # Appelee par CreeSTD - ''' - La fonction : - Remarque : le nom 'solver' est en dur ici. Il doit imperativement correspondre - au nom du fichier xml : 'solver.xml' - ''' - texte = "\n# La fonction\n\n" - texte += ' myFunction = NumericalMathFunction(\"XXXXXX\")\n' - texte += ' dim = myFunction.getInputNumericalPointDimension()\n' - return texte - - - def CreeCopula (self) : - #------------------ - # Appelee par CreeSTD - texte = "\n# La copule\n\n" - texte += " myCopula = IndependentCopula(dim)\n" - return texte - - - def CreeDistribution (self) : - #---------------------------- - # Appelee par CreeSTD - texte = "\n# La distribution\n\n" - texte += " myDistribution = ComposedDistribution(myCollection, Copula(myCopula))\n" - return texte - - - def CreeRandomVector (self) : - #---------------------------- - # Appelee par CreeSTD - texte = "\n# Le Random Vector\n\n" - texte += " myRandomVector_in = RandomVector(Distribution(myDistribution))\n" - texte += " myRandomVector_out = RandomVector(myFunction, myRandomVector_in)\n" - return texte # _______________________________ @@ -304,116 +442,3 @@ class STDGenerateur : texte += "\n importanceSamplingAlgo.run()\n\n" self.NomAlgo = "importanceSamplingAlgo" return texte - - - def CreeResu (self) : - #------------------ - ''' - ''' - texte = "\n# Le resultat\n\n" - texte += " myResu = " + self.NomAlgo + ".getResult() \n" - texte += " probability = myResu.getEventProbability()" - - return texte - - - - def CreeLois (self) : - #------------------ - ''' - ''' - code_erreur = 0 - texte = "\n# Les lois\n\n" - if self.DictMCVal.has_key("Analysis") and self.DictMCVal["Analysis"] == "Reliability" : - texte += " myPhysicalStartingPoint = NumericalPoint(dim, 0.0)\n" - texte += " myCollection = DistributionCollection(dim)\n\n" - - numVar = 0 - for DictVariable in self.ListeVariables : - - boolLoiDef = True - if DictVariable.has_key("MarginalDistribution") and DictVariable.has_key("Name"): - ConceptLoi = DictVariable["MarginalDistribution"] - NomLoi = DictVariable["Name"]+"_Dist" - else : - boolLoiDef = False - - if boolLoiDef and self.DictLois.has_key(ConceptLoi): - loi = self.DictLois[ConceptLoi] - else : - boolLoiDef = False - - if boolLoiDef and loi.has_key("Kind") : - TypeLoi = loi["Kind"] - else : - boolLoiDef = False - - if not boolLoiDef or TypeLoi not in self.listeParamLoi.keys() : - texte += " Loi " + TypeLoi +" non programmee \n" - numVar += 1 - continue - - ListeParametres = [] - TexteParametres = "" - for Param in self.listeParamLoi[TypeLoi]: - if loi.has_key(Param) : - texte += " " + NomLoi + "_" + Param + " = " + str(loi[Param]) + "\n" - ListeParametres.append(NomLoi + "_" + Param) - TexteParametres += NomLoi + "_" + Param + "," - - texte += " " + NomLoi + " = " + TypeLoi + "( " - - if loi.has_key("Settings" ) and self.listeParamLoiSettings.has_key(TypeLoi) \ - and self.listeParamLoiSettings[TypeLoi].has_key(loi["Settings"]): - NumParam = self.listeParamLoiSettings[TypeLoi][loi["Settings"]] - texte += TexteParametres + NumParam +" )\n" - else : - texte += TexteParametres[:-1] + " )\n" - - texte += " " + NomLoi + '.setName( "'+DictVariable["Name"] +'" )\n' - texte += " myCollection["+str(numVar)+"] = Distribution( "+NomLoi+" )\n" - - if self.DictMCVal["Analysis"] == "Reliability" : - texte += " myPhysicalStartingPoint["+str(numVar)+"] = " - if DictVariable.has_key("PhysicalStartingPoint") : - texte += str(DictVariable["PhysicalStartingPoint"]) +"\n\n" - else : - texte += NomLoi+".computeQuantile( 0.5 )[0]\n\n" - - numVar += 1 - return texte - - -# _____________________________________________________ - - def CreeEntete (self) : - #------------------ - ''' - Entete : - ''' - - texte = "#!/usr/bin/env python\n" - texte += "# -*- coding: iso-8859-1 -*-\n" - texte += "import sys\n" - texte += "import os\n" - if self.DictLois.has_key("dir_openturns_python") : - texte += "sys.path.append(\"" + self.DictLois["dir_openturns_python"] + "\")\n" - if self.DictLois.has_key("DTDDirectory") : - texte += "os.environ[\"OPENTURNS_WRAPPER_PATH\"] = \".:" + self.DictLois["DTDDirectory"] + "\"\n" - texte += "from openturns import *\n" - texte += "error_message = None\n" - texte += "try : \n" - return texte - - def CreeTexteFin(self) : - #------------------------------------ - texte ='\n\nexcept : \n' - texte += ' error_message = sys.exc_type\n' - texte += ' if error_message is not None :\n' - texte += ' texte = "================================================= \\n"\n' - texte += ' texte += " Message d\'erreur : \" + str(error_message) + "\\n"\n' - texte += ' texte += "=================================================\\n"\n' - texte += ' print texte"\n' - texte += "sys.exit(error_message)\n" - return texte - diff --git a/generator/OpenturnsXML.py b/generator/OpenturnsXML.py index 7452d1fa..ea6a23ee 100644 --- a/generator/OpenturnsXML.py +++ b/generator/OpenturnsXML.py @@ -5,92 +5,53 @@ """ Ce module contient le generateur XML pour Openturns """ - -# Les variables -#--------------------- - -# OrdreVariable contient l'ordre des MC pour definir une variable en XML -# dictMCXML a pour cle le nom du MC dans la commande, -# Il contient aussi une liste donnant les informations suivantes -# 0 : debut de ligne -# 1 : fin de ligne -# 2 : code : 0 : facultatif, 1 : obligatoire -# Type est sur la meme ligne que Name - -OrdreVariable = ( 'Name', 'Type', 'Comment', 'Unit', 'Regexp', 'Format' ) -dictMCXML = { "Name" : ( ' \n', 1 ), - "Comment" : ( ' ' , '\n', 0 ), - "Unit" : ( ' ' , '\n', 0 ), - "Regexp" : ( ' ' , '\n', 0 ), - "Format" : ( ' ' , '\n', 0 ), - } - - -# Les fonctions du wrapper -#-------------------------------- -# OrdreLibrary contient l'ordre des MC pour definir la partie library en XML -# dictLibXML a pour cle le nom du MC dans la commande, -# Il contient aussi une liste donnant les informations suivantes : -# 0 : debut de ligne -# 1 : milieu de ligne si le MC est present -# 2 : milieu de ligne si le MC n est pas present -# 3 : fin de ligne -# 4 : code : 0 : facultatif, 1 : obligatoire sans defaut - -OrdreLibrary = ( 'FunctionName', 'GradientName', 'HessianName' ) -dictLibXML = { "FunctionName" : ( '\n\n ', - '\n ', - '\n ', - '', - 1, - ), - "GradientName" : ( '\n\n ', - '\n ', - '\n ', - '', - 0, - ), - "HessianName" : ( '\n\n ', - '\n ', - '\n ' , - '\n\n', - 0, - ), - } - -# Les communications du wrapper -#-------------------------------- -# OrdreWrapMode contient l'ordre des MC pour definir la partie WrapMode en XML -# dictWrMXML a pour cle le nom du MC dans la commande, -# Il contient aussi une liste donnant les informations suivantes -# 0 : debut de ligne -# 1 : fin de ligne -# 2 : code : 0 : facultatif, 1 : obligatoire sans defaut, 2 : obligatoire avec defaut -# 3 : valeur par defaut eventuelle -OrdreWrapMode = ( 'WrapCouplingMode', 'State', 'InDataTransfer', 'OutDataTransfer' ) -dictWrMXML = { "WrapCouplingMode" : ( '\n \n' , 2, 'shared">\n' ), - "InDataTransfer" : ( ' \n', 0 ), - "OutDataTransfer" : ( ' \n', 0 ), - } - -# Les fichiers d'echange du wrapper -#----------------------------------------- -# OrdreExchangeFile contient l'ordre des MC pour definir la partie OrdreExchangeFile en XML -# dictFilXML a pour cle le nom du MC dans la commande, -# Il contient aussi une liste donnant les informations suivantes -# 0 : debut de ligne -# 1 : fin de ligne -# 2 : code : 0 : facultatif, 1 : obligatoire sans defaut -OrdreExchangeFile = ( 'Id', 'Type', 'Name', 'Path', 'Subst' ) -dictFilXML = { "Id" : ( '\n ' ), - "Type" : ( ' type="' , '">' ), - "Name" : ( '\n ' , '' ), - "Path" : ( '\n ' , '' ), - "Subst" : ( '\n ' , '' ), - } - +import sys +print "sys.path=", sys.path +import openturns + +# Dictionnaires de conversion des valeurs lues dans EFICAS +# en valeurs reconnues par Open TURNS +# Les clefs 'None' sont les valeurs par defaut + +VariableTypeByName = { + "in" : openturns.WrapperDataVariableType.IN, + "out" : openturns.WrapperDataVariableType.OUT, + None : openturns.WrapperDataVariableType.IN, + } + +FileTypeByName = { + "in" : openturns.WrapperDataFileType.IN, + "out" : openturns.WrapperDataFileType.OUT, + None : openturns.WrapperDataFileType.IN, + } + +SymbolProvidedByName = { + "no" : openturns.WrapperSymbolProvided.NO, + "yes" : openturns.WrapperSymbolProvided.YES, + None : openturns.WrapperSymbolProvided.NO, + } + +WrapperStateByName = { + "shared" : openturns.WrapperState.SHARED, + "specific" : openturns.WrapperState.SPECIFIC, + None : openturns.WrapperState.SPECIFIC, + } + +WrapperModeByName = { + "static-link" : openturns.WrapperMode.STATICLINK, + "dynamic-link" : openturns.WrapperMode.DYNAMICLINK, + "fork" : openturns.WrapperMode.FORK, + None : openturns.WrapperMode.FORK, + } + +WrapperDataTransferByName = { + "files" : openturns.WrapperDataTransfer.FILES, + "pipe" : openturns.WrapperDataTransfer.PIPE, + "arguments" : openturns.WrapperDataTransfer.ARGUMENTS, + "socket" : openturns.WrapperDataTransfer.SOCKET, + "CORBA" : openturns.WrapperDataTransfer.CORBA, + None : openturns.WrapperDataTransfer.FILES, + } #========================== # La classe de creation XML @@ -102,163 +63,147 @@ class XMLGenerateur : Generation du fichier XML ''' def __init__ (self, DictMCVal, ListeVariables, DictLois ) : - #---------------------------------------------------------# self.ListeFiles = [] self.DictMCVal = DictMCVal self.ListeVariables = ListeVariables - self.DictLois = DictLois + self.DictLois = DictLois + #print "DictMCVal=", DictMCVal + #print "ListeVariables=", ListeVariables + #print "DictLois=", DictLois def CreeXML (self) : - #------------------# ''' Pilotage general de la creation du fichier XML ''' - self.texte = self.CreeEntete() - self.texte += self.CreeWrapperAndPath() - self.texte += self.CreeVariables() - self.texte += self.CreeLibrary() - self.texte += self.CreeFile() - self.texte += self.CreeWrapMode() - self.texte += self.CreeCommande() - return self.texte - - - def CreeEntete (self) : - #---------------------# + data = openturns.WrapperData() + data.setLibraryPath( self.GetMCVal('WrapperPath','') ) + data.setVariableList( self.VariableList() ) + data.setFunctionDescription( self.FunctionDefinition() ) + data.setGradientDescription( self.GradientDefinition() ) + data.setHessianDescription( self.HessianDefinition() ) + data.setFileList( self.FileList() ) + data.setParameters( self.Parameters() ) + + wrapper=openturns.WrapperFile() + wrapper.setWrapperData( data ) + + return wrapper + + + def VariableList (self) : ''' - La variable DTDDirectory doit etre dans DictMCVal + Ecrit la liste des variables ''' - #PN a faire : recuperer DTDDirectory dans editeur.ini - texte = "\n" - if self.DictMCVal.has_key("DTDDirectory") : - aux = os.path.join(self.DictMCVal["DTDDirectory"], "wrapper.dtd") - texte += "\n" - texte += '\n\n' - texte += '\n \n\n' - return texte - - - def CreeWrapperAndPath (self) : - #-----------------------------# - texte = ' \n' - texte += ' ' - if self.DictMCVal.has_key("WrapperPath") : - texte += self.DictMCVal["WrapperPath"] - else : - print "*********************************************" - print "* ERREUR GENERATION XML *" - print "* champ WrapperPath non rempli *" - print "*********************************************" - texte += '\n\n\n' + varList = openturns.WrapperDataVariableList() + for dictVar in self.ListeVariables : + varList.add( self.Variable( dictVar ) ) + return varList - return texte - - - def CreeVariables (self) : - #------------------------# - texte =' \n' - texte +=' \n\n' - texte +=' \n' - texte +=' \n\n' - texte += ' ' + def Variable (self, dictVar) : + ''' + Ecrit le parametrage d une variable + ''' + variable = openturns.WrapperDataVariable() + variable.id_ = dictVar[ 'Name' ] + if dictVar[ 'Type' ] in VariableTypeByName.keys() : + variable.type_ = VariableTypeByName[ dictVar[ 'Type' ] ] + if dictVar.has_key('Comment') : variable.comment_ = dictVar[ 'Comment' ] + if dictVar.has_key('Unit') : variable.unit_ = dictVar[ 'Unit' ] + if dictVar.has_key('Regexp') : variable.regexp_ = dictVar[ 'Regexp' ] + if dictVar.has_key('Format') : variable.format_ = dictVar[ 'Format' ] + return variable + + def FunctionDefinition (self) : + ''' + Ecrit la description de la Fonction + ''' + func = openturns.WrapperFunctionDescription() + func.name_ = self.GetMCVal( 'FunctionName', '' ) + if (len(func.name_) != 0) : func.provided_ = SymbolProvidedByName[ 'yes' ] + return func + + def GradientDefinition (self) : + ''' + Ecrit la description du Gradient + ''' + grad = openturns.WrapperFunctionDescription() + grad.name_ = self.GetMCVal( 'GradientName', '' ) + if (len(grad.name_) != 0) : grad.provided_ = SymbolProvidedByName[ 'yes' ] + return grad + + def HessianDefinition (self) : + ''' + Ecrit la description de la Hessienne + ''' + hess = openturns.WrapperFunctionDescription() + hess.name_ = self.GetMCVal( 'HessianName', '' ) + if (len(hess.name_) != 0) : hess.provided_ = SymbolProvidedByName[ 'yes' ] + return hess + - numvar = 0 - for DictVariable in self.ListeVariables : - texte += "\n \n" - for MC in OrdreVariable : - if DictVariable.has_key(MC) : - texte += dictMCXML[MC][0] + DictVariable[MC] + dictMCXML[MC][1] - else : - if dictMCXML[MC][2] : - print "**************************************************" - print "* ERREUR GENERATION XML *" - print "* champ obligatoire non rempli pour variable *" - print "**************************************************" - texte += ' \n' - numvar += 1 - texte += '\n \n' - texte += ' \n' - return texte - def CreeLibrary (self) : - #----------------------# + def FileList (self) : ''' - Librairies + Ecrit la liste des fichiers ''' - texte = "" - for MC in OrdreLibrary : - texte += dictLibXML[MC][0] - if self.DictMCVal.has_key(MC) : - texte += dictLibXML[MC][1] + self.DictMCVal[MC] + dictLibXML[MC][3] - else : - texte += dictLibXML[MC][2] + dictLibXML[MC][3] - if dictLibXML[MC][4] : - print "**************************************************" - print "* ERREUR GENERATION XML *" - print "* champ obligatoire non rempli pour wrapper *" - print "**************************************************" - texte += ' \n\n' - texte += ' \n' - return texte + fileList = openturns.WrapperDataFileList() + for dictFile in self.GetMCVal('Files', []) : + fileList.add( self.File( dictFile ) ) + return fileList - def CreeFile (self) : - #-------------------# + def File (self, dictFile ) : ''' - Fichiers + Ecrit le parametrage d un fichier ''' - texte = '\n \n' - texte += '\n \n' - texte += ' \n' - - if self.DictMCVal.has_key("exchange_file") : - for dico in self.DictMCVal["exchange_file"] : - texte += "\n " - for MC in OrdreExchangeFile : - if dico.has_key(MC) : - texte += dictFilXML[MC][0] + dico[MC] + dictFilXML[MC][1] - texte += "\n \n" - texte += '\n \n' - return texte - - def CreeWrapMode (self) : - #-----------------------# + fich = openturns.WrapperDataFile() + fich.id_ = dictFile[ 'Id' ] + if dictFile[ 'Type' ] in FileTypeByName.keys() : + fich.type_ = FileTypeByName[ dictFile[ 'Type' ] ] + if dictFile.has_key('Name') : fich.name_ = dictFile[ 'Name' ] + if dictFile.has_key('Path') : fich.path_ = dictFile[ 'Path' ] + if dictFile.has_key('Subst') : + import string + fich.subst_ = string.join( dictFile[ 'Name' ], ',' ) + return fich + + def Parameters (self) : ''' - WrapMode + Ecrit les parametres de couplage au code externe ''' - texte = '\n ' + parameters = openturns.WrapperParameter() + parameters.mode_ = WrapperModeByName[ self.GetMCVal('WrapCouplingMode') ] + parameters.state_ = WrapperStateByName[ self.GetMCVal('State') ] + parameters.in_ = WrapperDataTransferByName[ self.GetMCVal('InDataTransfer') ] + parameters.out_ = WrapperDataTransferByName[ self.GetMCVal('OutDataTransfer') ] + return parameters + - for MC in OrdreWrapMode : - if self.DictMCVal.has_key(MC) : - texte += dictWrMXML[MC][0] + self.DictMCVal[MC] + dictWrMXML[MC][1] - else : - if dictWrMXML[MC][2] == 2 : - texte += dictWrMXML[MC][0] + dictWrMXML[MC][3] - elif dictWrMXML[MC][2] == 1 : - print "**************************************************" - print "* ERREUR GENERATION XML *" - print "* champ obligatoire non rempli pour external *" - print "**************************************************" - texte += ' \n\n' - return texte - def CreeCommande (self) : - #-----------------------# + + # --------------------------------------------------------------------------------- + + + def GetTag (self, tag) : ''' - La commande - On lui passera en argument les options supplementaires eventuelles + Recupere la chaine associee au tag dans la table dictTagsXML. + Leve une exception si le tag n est pas trouve ''' - texte = ' \n' - texte += ' ' - if self.DictMCVal.has_key("Command") : - texte += self.DictMCVal["Command"] - if self.DictMCVal.has_key("ArguCommande") : - for argument in self.DictMCVal[ArguCommande] : - texte += " " + argument - texte += "\n" + if ( dictTagsXML.has_key(tag) ) : + return dictTagsXML[tag] else : - texte += '# no command' - texte +='\n' - texte +='\n \n' - texte +='\n\n' - return texte - + raise KeyError, "Tag '%s' is undefined. This is an internal bug. Report bug to developers" % tag + pass + + def GetMCVal (self, MC, default = None, mandatory = False) : + ''' + Recupere la chaine associee au MC dans la table DictMCVal. + Leve une exception si le MC n est pas trouve et mandatory vaut True + ''' + if ( self.DictMCVal.has_key(MC) and self.DictMCVal[MC] != None ) : + return self.DictMCVal[MC] + else : + if ( mandatory ) : + raise KeyError, "Keyword '%s' is mandatory" % MC + else : + return default + pass diff --git a/generator/generator_openturns_study.py b/generator/generator_openturns_study.py new file mode 100644 index 00000000..66afef84 --- /dev/null +++ b/generator/generator_openturns_study.py @@ -0,0 +1,146 @@ +# -*- 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 + openturns pour EFICAS. + +""" +import traceback +import types,string,re + +from generator_python import PythonGenerator +from OpenturnsBase import Generateur +#from OpenturnsXML import XMLGenerateur +#from OpenturnsSTD import STDGenerateur + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'openturns_study', + # La factory pour creer une instance du plugin + 'factory' : OpenturnsGenerator, + } + + +class OpenturnsGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format xml + + """ + # Les extensions de fichier permis? + extensions=('.comm',) + + def initDico(self): + self.dictMCVal={} + self.listeVariables=[] + self.listeFichiers=[] + self.dictMCLois={} + self.dictTempo={} + self.TraiteMCSIMP=1 + self.texteSTD="""#!/usr/bin/env python + import sys + print "Invalid file. Check build process." + sys.exit(1) + """ + self.texteXML="\n" + + def gener(self,obj,format='brut'): + #print "IDM: gener dans generator_openturns_study.py" + self.initDico() + self.text=PythonGenerator.gener(self,obj,format) + #self.genereXML() + self.genereSTD() + return self.text + + 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) + if self.TraiteMCSIMP == 1 : + self.dictMCVal[obj.nom]=obj.val + else : + 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): + if obj.nom in ( "DISTRIBUTION", ) : + self.TraiteMCSIMP=0 + self.dictTempo={} + s=PythonGenerator.generETAPE(self,obj) + if obj.nom in ( "DISTRIBUTION", ) : + self.dictMCLois[obj.sd]=self.dictTempo + self.dictTempo={} + self.TraiteMCSIMP=1 + return s + + #def genereXML(self): + # print "IDM: genereXML dans generator_openturns_study.py" + # if self.listeFichiers != [] : + # self.dictMCVal["Files"]=self.listeFichiers + # MonBaseGenerateur=Generateur(self.dictMCVal, self.listeVariables, self.dictMCLois) + # MonGenerateur=MonBaseGenerateur.getXMLGenerateur() + # #try : + # if 1== 1 : + # self.texteXML=MonGenerateur.CreeXML() + # #except : + # else : + # self.texteXML="Il y a un pb a la Creation du XML" + + def genereSTD(self): + print "IDM: genereSTD dans generator_openturns_study.py" + MonBaseGenerateur=Generateur(self.dictMCVal, self.listeVariables, self.dictMCLois) + MonGenerateur=MonBaseGenerateur.getSTDGenerateur() + #try : + if 1== 1 : + self.texteSTD=MonGenerateur.CreeSTD() + #except : + else : + self.texteSTD="Il y a un pb a la Creation du STD" + + #def getOpenturnsXML(self): + # return self.texteXML + + def getOpenturnsSTD(self): + return self.texteSTD diff --git a/generator/generator_openturns_wrapper.py b/generator/generator_openturns_wrapper.py new file mode 100644 index 00000000..6db16932 --- /dev/null +++ b/generator/generator_openturns_wrapper.py @@ -0,0 +1,123 @@ +# -*- 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 + openturns pour EFICAS. + +""" +import traceback +import types,string,re + +from generator_python import PythonGenerator +from OpenturnsBase import Generateur +#from OpenturnsXML import XMLGenerateur +#from OpenturnsSTD import STDGenerateur + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'openturns_wrapper', + # La factory pour creer une instance du plugin + 'factory' : OpenturnsGenerator, + } + + +class OpenturnsGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format xml + + """ + # Les extensions de fichier permis? + extensions=('.comm',) + + def initDico(self): + self.dictMCVal={} + self.listeVariables=[] + self.listeFichiers=[] + self.dictMCLois={} + self.dictTempo={} + self.TraiteMCSIMP=1 + self.texteSTD="""#!/usr/bin/env python + import sys + print "Invalid file. Check build process." + sys.exit(1) + """ + self.wrapperXML=None + + def gener(self,obj,format='brut'): + #print "IDM: gener dans generator_openturns_wrapper.py" + self.initDico() + self.text=PythonGenerator.gener(self,obj,format) + self.genereXML() + #self.genereSTD() + return self.text + + 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) + if self.TraiteMCSIMP == 1 : + self.dictMCVal[obj.nom]=obj.val + else : + 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 genereXML(self): + #print "IDM: genereXML dans generator_openturns_wrapper.py" + #print "appli.CONFIGURATION=",self.appli.CONFIGURATION.__dict__ + if self.listeFichiers != [] : + self.dictMCVal["Files"]=self.listeFichiers + MonBaseGenerateur=Generateur(self.dictMCVal, self.listeVariables, self.dictMCLois) + MonGenerateur=MonBaseGenerateur.getXMLGenerateur() + #try : + if 1== 1 : + self.wrapperXML=MonGenerateur.CreeXML() + #except : + else : + self.wrapperXML=None + + def writeOpenturnsXML(self, filename): + self.wrapperXML.writeFile( str(filename) ) + diff --git a/generator/generator_vers3DSalome.py b/generator/generator_vers3DSalome.py index 5fdc6af6..298dd547 100644 --- a/generator/generator_vers3DSalome.py +++ b/generator/generator_vers3DSalome.py @@ -128,12 +128,16 @@ class vers3DSalomeGenerator(PythonGenerator): def generMCSIMP(self,obj) : """ """ - #print "MCSIMP : ", obj.nom if obj.nom in dir(self) : suite = self.__class__.__dict__[obj.nom](self,obj) else : clef=self.dict_traduit[obj.nom] - self.dict_attributs[clef]=obj.val + # Traitement des parametres + try : + self.dict_attributs[clef]=obj.val.eval() + except : + self.dict_attributs[clef]=obj.val + def generMCFACT(self,obj): """ @@ -142,15 +146,13 @@ class vers3DSalomeGenerator(PythonGenerator): """ self.init_ligne() self.commande=self.dict_deb_com[obj.nom] - print self.commande for v in obj.mc_liste: self.generator(v) - #print self.commande - #print self.dict_attributs 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):