# -*- 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.
+# Copyright (C) 2007-2013 EDF R&D
#
-# 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.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# 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.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# ======================================================================
"""
Ce module contient le plugin generateur de fichier au format
homard pour EFICAS.
def entryPoint():
"""
- Retourne les informations nécessaires pour le chargeur de plugins
+ Retourne les informations necessaires pour le chargeur de plugins
- Ces informations sont retournées dans un dictionnaire
+ Ces informations sont retournees dans un dictionnaire
"""
return {
# Le nom du plugin
'name' : 'homard',
- # La factory pour créer une instance du plugin
+ # La factory pour creer une instance du plugin
'factory' : HomardGenerator,
}
un texte au format homard
"""
- # Les extensions de fichier préconisées
+ # Les extensions de fichier preconis�es
extensions=('.comm',)
def __init__(self,cr=None):
else:
self.cr=N_CR.CR(debut='CR generateur format homard pour homard',
fin='fin CR format homard pour homard')
- # Le texte au format homard est stocké dans l'attribut text
+ # Le texte au format homard est stock� dans l'attribut text
self.dico_mot_clef={}
self.assoc={}
self.init_assoc()
self.textehomard=[]
def init_assoc(self):
- self.lmots_clef_calcules = ('SuivFron','TypeBila','ModeHOMA','CCAssoci', 'CCNoChaI','HOMaiN__','HOMaiNP1')
+ self.lmots_clef_calcules = ('SuivFron','TypeBila','ModeHOMA','CCAssoci', 'CCNoChaI','HOMaiN__','HOMaiNP1','CCNumOrI', 'CCNumPTI')
self.lmot_clef = ('CCMaiN__', 'CCNoMN__', 'CCIndica', 'CCSolN__', 'CCFronti', 'CCNoMFro', 'CCMaiNP1',
'CCNoMNP1', 'CCSolNP1', 'TypeRaff', 'TypeDera', 'NiveauMa', 'SeuilHau', 'SeuilHRe',
- 'SeuilHPE', 'NiveauMi', 'SeuilBas', 'SeuilBRe', 'SeuilBPE', 'ListeStd', 'NumeIter',
- 'Langue ', 'CCGroFro', 'CCNoChaI', 'CCNumOrI', 'CCNumPTI', 'SuivFron', 'TypeBila',
- 'ModeHOMA', 'HOMaiN__', 'HOMaiNP1')
+ 'SeuilHPE', 'NiveauMi', 'SeuilBas', 'SeuilBRe', 'SeuilBPE', 'ListeStd', 'NumeIter',
+ 'Langue ', 'CCGroFro', 'CCNoChaI', 'CCNumOrI', 'CCNumPTI', 'SuivFron', 'TypeBila',
+ 'ModeHOMA', 'HOMaiN__', 'HOMaiNP1','CCCoChaI')
# Bizarre demander a Gerald :
-# CVSolNP1
+# CVSolNP1
self.assoc['CCMaiN__']='FICHIER_MED_MAILLAGE_N'
self.assoc['CCNoMN__']='NOM_MED_MAILLAGE_N'
self.assoc['CCIndica']='FICHIER_MED_MAILLAGE_N'
self.assoc['CCGroFro']='GROUP_MA'
# self.assoc['CCNoChaI']='NOM_MED' (on doit aussi ajouter 'COMPOSANTE')
self.assoc['CCNumOrI']='NUME_ORDRE'
- self.assoc['CCNumPTI']='NUME_ORDRE'
+ self.assoc['CCNumPTI']='NUME_PAS_TEMPS'
+ self.assoc['CCCoChaI']='COMPOSANTE'
self.dico_mot_depend={}
self.dico_mot_depend['CCSolN__'] ='self.dico_mot_clef.has_key("NITER")'
self.dico_mot_depend['CCSolNP1'] ='self.dico_mot_clef.has_key("NITER")'
- def gener(self,obj,format='brut'):
+ def gener(self,obj,format='brut',config=None):
self.text=PythonGenerator.gener(self,obj,format)
self.genereConfiguration()
return self.text
def generMCSIMP(self,obj) :
"""
- Convertit un objet MCSIMP en une liste de chaines de caractères à la
+ Convertit un objet MCSIMP en une liste de chaines de caract�res � la
syntaxe homard
"""
s=PythonGenerator.generMCSIMP(self,obj)
return s
def cherche_dependance(self,mot):
- print mot
b_eval = 0
a_eval=self.dico_mot_depend[mot]
try :
- b_eval=eval(self.dico_mot_depend[mot])
+ b_eval=eval(self.dico_mot_depend[mot])
except :
- for l in a_eval.split(" or "):
+ for l in a_eval.split(" or "):
try:
- b_eval=eval(l)
- if not (b_eval == 0 ):
- break
+ b_eval=eval(l)
+ if not (b_eval == 0 ):
+ break
except :
- pass
+ pass
return b_eval
self.textehomard=[]
for mot in self.lmot_clef:
-# on verifie d'abord que le mot clef doit bien être calculé
+# on verifie d'abord que le mot clef doit bien etre calcule
if self.dico_mot_depend.has_key(mot) :
if self.cherche_dependance(mot) == 0 :
- continue
+ continue
if mot not in self.lmots_clef_calcules :
- clef_eficas=self.assoc[mot]
+ clef_eficas=self.assoc[mot]
if self.dico_mot_clef.has_key(clef_eficas):
- val=self.dico_mot_clef[clef_eficas]
+ val=self.dico_mot_clef[clef_eficas]
if val != None:
- try :
- ligne=mot+' '+val
- except:
- ligne=mot+' '+repr(val)
- ligne.rjust(32)
+ try :
+ ligne=mot+' '+val
+ except:
+ ligne=mot+' '+repr(val)
+ ligne.rjust(32)
self.textehomard.append(ligne)
else:
val=apply(HomardGenerator.__dict__[mot],(self,))
if val != None:
mot.rjust(8)
- ligne=mot+' '+val
- ligne.rjust(32)
+ ligne=mot+' '+val
+ ligne.rjust(32)
self.textehomard.append(ligne)
def get_homard(self):
def SuivFron(self):
val="non"
- if self.dico_mot_clef.has_key('NOM_MED_MAILLAGE_FRONTIERE'):
- if self.dico_mot_clef['NOM_MED_MAILLAGE_FRONTIERE'] != None:
- val="oui"
+ if self.dico_mot_clef.has_key('NOM_MED_MAILLAGE_FRONTIERE'):
+ if self.dico_mot_clef['NOM_MED_MAILLAGE_FRONTIERE'] != None:
+ val="oui"
return val
def TypeBila(self):
retour=None
dict_val={'NOMBRE':7,'INTERPENETRATION':3,'QUALITE':5,'CONNEXITE':11,'TAILLE':13}
for mot in ('NOMBRE','QUALITE','INTERPENETRATION','CONNEXITE','TAILLE'):
- if self.dico_mot_clef.has_key(mot):
- if (self.dico_mot_clef[mot] == "OUI"):
- inttypeBilan=inttypeBilan*dict_val[mot]
+ if self.dico_mot_clef.has_key(mot):
+ if (self.dico_mot_clef[mot] == "OUI"):
+ inttypeBilan=inttypeBilan*dict_val[mot]
retour = repr(inttypeBilan)
- return retour
+ return retour
def ModeHOMA(self):
intModeHOMA=1
- if self.dico_mot_clef.has_key('INFORMATION'):
- if self.dico_mot_clef['INFORMATION'] == "OUI":
- intModeHOMA=2
+ if self.dico_mot_clef.has_key('INFORMATION'):
+ if self.dico_mot_clef['INFORMATION'] == "OUI":
+ intModeHOMA=2
return repr(intModeHOMA)
-
+
def CCAssoci(self):
return 'MED'
def CCNoChaI(self):
- if not (self.dico_mot_clef.has_key('NOM_MED')):
- return None
- if (self.dico_mot_clef['NOM_MED']== None):
- return None
- if not (self.dico_mot_clef.has_key('COMPOSANTE')):
- return None
+ if not (self.dico_mot_clef.has_key('NOM_MED')):
+ return None
+ if (self.dico_mot_clef['NOM_MED']== None):
+ return None
+ if not (self.dico_mot_clef.has_key('COMPOSANTE')):
+ return None
if (self.dico_mot_clef['COMPOSANTE']== None):
return None
- chaine=self.dico_mot_clef['NOM_MED']+' '+self.dico_mot_clef['COMPOSANTE']
+ chaine=self.dico_mot_clef['COMPOSANTE']+' '+self.dico_mot_clef['NOM_MED']
return chaine
def HOMaiN__(self):
chaine=None
if self.dico_mot_clef.has_key('NITER'):
- if self.dico_mot_clef['NITER'] != None :
+ if self.dico_mot_clef['NITER'] != None :
num="M"+repr(self.dico_mot_clef['NITER'])
- chaine=num+" "+num+".hom"
+ chaine=num+" "+num+".hom"
return chaine
def HOMaiNP1(self):
chaine=None
if self.dico_mot_clef.has_key('NITER'):
- if self.dico_mot_clef['NITER'] != None :
+ if self.dico_mot_clef['NITER'] != None :
num="M"+repr(self.dico_mot_clef['NITER']+1)
- chaine=num+" "+num+".hom"
+ chaine=num+" "+num+".hom"
return chaine
+ def CCNumOrI(self):
+ chaine=repr(1)
+ if self.dico_mot_clef.has_key('NUME_ORDRE'):
+ if self.dico_mot_clef['NUME_ORDRE'] != None :
+ chaine=repr(self.dico_mot_clef['NUME_ORDRE'])
+ return chaine
+
+ def CCNumPTI(self):
+ chaine=repr(1)
+ if self.dico_mot_clef.has_key('NUME_PAS_TEMPS'):
+ if self.dico_mot_clef['NUME_PAS_TEMPS'] != None :
+ chaine=repr(self.dico_mot_clef['NUME_PAS_TEMPS'])
+ return chaine