1 #@ MODIF reca_message Macro DATE 16/10/2007 AUTEUR REZETTE C.REZETTE
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 # ======================================================================
23 from externe_mess import UTMESS
25 #===========================================================================================
28 # AFFICHAGE DES MESSAGES
31 """classe gérant l'affichage des messages concernant le déroulement de l'optmisation """
32 #Constructeur de la classe
34 # ------------------------------------------------------------------------------
36 def __init__(self,para,val_init,resu_exp,ul_out):
38 self.resu_exp = resu_exp
39 self.val_init = val_init
40 self.resu_exp = resu_exp
43 # ------------------------------------------------------------------------------
46 res=open(os.getcwd()+'/fort.'+str(self.ul_out),'w')
49 txt = ' <INFO> MACR_RECAL\n\n'
52 # ------------------------------------------------------------------------------
55 res=open(os.getcwd()+'/fort.'+str(self.ul_out),'a')
61 # ------------------------------------------------------------------------------
63 def affiche_valeurs(self,val):
65 txt = '\n=> Paramètres = '
66 for i in range(len(val)):
67 txt += '\n '+ self.nom_para[i]+' = '+str(val[i])
70 # ------------------------------------------------------------------------------
72 def affiche_fonctionnelle(self,J):
74 txt = '\n=> Fonctionnelle = '+str(J)
77 # ------------------------------------------------------------------------------
79 def affiche_result_iter(self,iter,J,val,residu,Act=[],):
81 txt = '\n=======================================================\n'
82 txt += 'Iteration '+str(iter)+' :\n'
83 txt += '\n=> Fonctionnelle = '+str(J)
84 txt += '\n=> Résidu = '+str(residu)
89 self.affiche_valeurs(val)
93 txt += '\n\n Le paramètre '
95 txt += '\n\n Les paramètres '
97 txt += self.nom_para[i]+' '
99 txt += '\n est en butée sur un bord de leur domaine admissible.'
101 txt += '\n sont en butée sur un bord de leur domaine admissible.'
102 txt += '\n=======================================================\n\n'
106 # ------------------------------------------------------------------------------
108 def affiche_etat_final_convergence(self,iter,max_iter,iter_fonc,max_iter_fonc,prec,residu,Act=[]):
111 if ((iter <= max_iter) or (residu <= prec) or (iter_fonc <= max_iter_fonc) ):
112 txt += '\n=======================================================\n'
113 txt += ' CONVERGENCE ATTEINTE '
115 txt += "\n\n ATTENTION : L'OPTIMUM EST ATTEINT AVEC "
116 txt += "\n DES PARAMETRES EN BUTEE SUR LE BORD "
117 txt += "\n DU DOMAINE ADMISSIBLE "
118 txt += '\n=======================================================\n'
120 txt += "\n=======================================================\n"
121 txt += ' CONVERGENCE NON ATTEINTE '
122 if (iter > max_iter):
123 txt += "\n Le nombre maximal d'itération ("+str(max_iter)+") a été dépassé"
124 if (iter_fonc > max_iter_fonc):
125 txt += "\n Le nombre maximal d'evaluation de la fonction ("+str(max_iter_fonc)+") a été dépassé"
126 txt += '\n=======================================================\n'
130 # ------------------------------------------------------------------------------
132 def affiche_calcul_etat_final(self,para,Hessien,valeurs_propres,vecteurs_propres,sensible,insensible):
134 txt = '\n\nValeurs propres du Hessien:\n'
135 txt += str( valeurs_propres)
136 txt += '\n\nVecteurs propres associés:\n'
137 txt += str( vecteurs_propres)
138 txt += '\n\n --------'
139 txt += '\n\nOn peut en déduire que :'
140 # Paramètres sensibles
141 if (len(sensible)!=0):
142 txt += '\n\nLes combinaisons suivantes de paramètres sont prépondérantes pour votre calcul :\n'
146 colonne=vecteurs_propres[:,i]
147 numero=Numeric.nonzero(Numeric.greater(abs(colonne/max(abs(colonne))),1.E-1))
148 txt += '\n '+str(k)+') '
150 txt += '%+3.1E ' %colonne[j]+'* '+para[j]+' '
151 txt += '\n associée à la valeur propre %3.1E \n' %valeurs_propres[i]
152 # Paramètres insensibles
153 if (len(insensible)!=0):
154 txt += '\n\nLes combinaisons suivantes de paramètres sont insensibles pour votre calcul :\n'
158 colonne=vecteurs_propres[:,i]
159 numero=Numeric.nonzero(Numeric.greater(abs(colonne/max(abs(colonne))),1.E-1))
160 txt += '\n '+str(k)+') '
162 txt += '%+3.1E ' %colonne[j]+'* '+para[j]+' '
163 txt += '\n associée à la valeur propre %3.1E \n' %valeurs_propres[i]