1 #@ MODIF reca_message Macro DATE 31/10/2006 AUTEUR ASSIRE A.ASSIRE
2 # -*- coding: iso-8859-1 -*-
3 # RESPONSABLE ASSIRE A.ASSIRE
4 # CONFIGURATION MANAGEMENT OF EDF VERSION
5 # ======================================================================
6 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
7 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
8 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
9 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
10 # (AT YOUR OPTION) ANY LATER VERSION.
12 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
13 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
14 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
15 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
17 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
18 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
19 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
25 from Utilitai.Utmess import UTMESS
27 def UTMESS(code,sprg,texte):
28 fmt='\n <%s> <%s> %s\n\n'
29 print fmt % (code,sprg,texte)
30 if code=='F': sys.exit()
32 #===========================================================================================
35 # AFFICHAGE DES MESSAGES
38 """classe gérant l'affichage des messages concernant le déroulement de l'optmisation """
39 #Constructeur de la classe
41 # ------------------------------------------------------------------------------
43 def __init__(self,para,val_init,resu_exp,ul_out):
45 self.resu_exp = resu_exp
46 self.val_init = val_init
47 self.resu_exp = resu_exp
50 # ------------------------------------------------------------------------------
53 res=open(os.getcwd()+'/fort.'+str(self.ul_out),'w')
56 txt = ' <INFO> MACR_RECAL\n\n'
59 # ------------------------------------------------------------------------------
62 res=open(os.getcwd()+'/fort.'+str(self.ul_out),'a')
68 # ------------------------------------------------------------------------------
70 def affiche_valeurs(self,val):
72 txt = '\n=> Paramètres = '
73 for i in range(len(val)):
74 txt += '\n '+ self.nom_para[i]+' = '+str(val[i])
77 # ------------------------------------------------------------------------------
79 def affiche_fonctionnelle(self,J):
81 txt = '\n=> Fonctionnelle = '+str(J)
84 # ------------------------------------------------------------------------------
86 def affiche_result_iter(self,iter,J,val,residu,Act=[],):
88 txt = '\n=======================================================\n'
89 txt += 'Iteration '+str(iter)+' :\n'
90 txt += '\n=> Fonctionnelle = '+str(J)
91 txt += '\n=> Résidu = '+str(residu)
96 self.affiche_valeurs(val)
100 txt += '\n\n Le paramètre '
102 txt += '\n\n Les paramètres '
104 txt += self.nom_para[i]+' '
106 txt += '\n est en butée sur un bord de leur domaine admissible.'
108 txt += '\n sont en butée sur un bord de leur domaine admissible.'
109 txt += '\n=======================================================\n\n'
113 # ------------------------------------------------------------------------------
115 def affiche_etat_final_convergence(self,iter,max_iter,iter_fonc,max_iter_fonc,prec,residu,Act=[]):
118 if ((iter <= max_iter) or (residu <= prec) or (iter_fonc <= max_iter_fonc) ):
119 txt += '\n=======================================================\n'
120 txt += ' CONVERGENCE ATTEINTE '
122 txt += "\n\n ATTENTION : L'OPTIMUM EST ATTEINT AVEC "
123 txt += "\n DES PARAMETRES EN BUTEE SUR LE BORD "
124 txt += "\n DU DOMAINE ADMISSIBLE "
125 txt += '\n=======================================================\n'
127 txt += "\n=======================================================\n"
128 txt += ' CONVERGENCE NON ATTEINTE '
129 if (iter > max_iter):
130 txt += "\n Le nombre maximal d'itération ("+str(max_iter)+") a été dépassé"
131 if (iter_fonc > max_iter_fonc):
132 txt += "\n Le nombre maximal d'evaluation de la fonction ("+str(max_iter_fonc)+") a été dépassé"
133 txt += '\n=======================================================\n'
137 # ------------------------------------------------------------------------------
139 def affiche_calcul_etat_final(self,para,Hessien,valeurs_propres,vecteurs_propres,sensible,insensible):
141 txt = '\n\nValeurs propres du Hessien:\n'
142 txt += str( valeurs_propres)
143 txt += '\n\nVecteurs propres associés:\n'
144 txt += str( vecteurs_propres)
145 txt += '\n\n --------'
146 txt += '\n\nOn peut en déduire que :'
147 # Paramètres sensibles
148 if (len(sensible)!=0):
149 txt += '\n\nLes combinaisons suivantes de paramètres sont prépondérantes pour votre calcul :\n'
153 colonne=vecteurs_propres[:,i]
154 numero=Numeric.nonzero(Numeric.greater(abs(colonne/max(abs(colonne))),1.E-1))
155 txt += '\n '+str(k)+') '
157 txt += '%+3.1E ' %colonne[j]+'* '+para[j]+' '
158 txt += '\n associée à la valeur propre %3.1E \n' %valeurs_propres[i]
159 # Paramètres insensibles
160 if (len(insensible)!=0):
161 txt += '\n\nLes combinaisons suivantes de paramètres sont insensibles pour votre calcul :\n'
165 colonne=vecteurs_propres[:,i]
166 numero=Numeric.nonzero(Numeric.greater(abs(colonne/max(abs(colonne))),1.E-1))
167 txt += '\n '+str(k)+') '
169 txt += '%+3.1E ' %colonne[j]+'* '+para[j]+' '
170 txt += '\n associée à la valeur propre %3.1E \n' %valeurs_propres[i]