from Noyau import N_FONCTION
from Noyau import N_CO
from Noyau import N_UserASSD
+from Noyau import N_UserASSDMultiple
# On ajoute la classe ASSD dans l'heritage multiple pour recreer
# une hierarchie d'heritage identique a celle de Noyau
#class LASSD(I_LASSD.LASSD,N_LASSD.LASSD):pass
class LASSD(I_LASSD.LASSD):pass
class UserASSD(N_UserASSD.UserASSD,ASSD): pass
+class UserASSDMultiple(N_UserASSDMultiple.UserASSDMultiple,UserASSD): pass
class assd(N_ASSD.assd,I_ASSD.assd,ASSD):pass
from .A_A_CLASSER import A_CLASSER
from .A_AVANT import AVANT
-from .A_ASSD import ASSD,assd, UserASSD
+from .A_ASSD import ASSD,assd, UserASSD, UserASSDMultiple
from .A_ASSD import GEOM,geom
# Pour le moment on laisse fonction (ceinture et bretelles)
from .A_ASSD import FONCTION, fonction
etapeTraitee.isValid()
def recalculeValiditeApresChangementGlobalJdc(self, motClef):
- print ("je passe dans recalculeValiditeApresChangementGlobalJdc")
+ #print ("je passe dans recalculeValiditeApresChangementGlobalJdc")
try :
liste=self.getJdcRoot().cata.dict_condition[motClef.nom]
except :
liste=()
for etapeTraitee in self.etapes :
if etapeTraitee.nom not in liste: continue
- #self.forceRecalculBloc(etapeTraitee)
etapeTraitee.state='arecalculer'
etapeTraitee.deepUpdateConditionBloc()
etapeTraitee.isValid()
+ #print (etapeTraitee.nom ,etapeTraitee.isValid())
def activeBlocsGlobaux(self):
for nomMotClef in self.mc_globaux :
if sd:return sd
sd=self.getSdApresEtape(nom_sd,etape,avec)
if sd:return sd
- # Pour tenir compte des UserASSD
+ # Pour tenir compte des UserASSD # et des UserASSDMultiple a affiner
if nom_sd in self.sdsDict.keys() :
sd=self.sdsDict[nom_sd]
return sd
return 1
return 0
- def waitUserAssdEnCreation(self):
+ def waitUserAssdMultiple(self):
+ for typ in self.definition.type:
+ if type(typ) == type or isinstance(typ,type):
+ if issubclass(typ,UserASSDMultiple) :
+ return 1
+ return 0
+
+ def waitUserAssdOrAssdMultipleEnCreation(self):
for typ in self.definition.type:
if typ == 'createObject' :
return 1
self.etape.deepUpdateConditionBloc()
elif self.definition.position == 'global_jdc' :
self.jdc.deepUpdateConditionBloc(self)
+ elif self.definition.position == 'inGetAttribut' :
+ print ('je suis ici')
+ self.jdc.deepUpdateConditionBloc(self)
else:
self.parent.updateConditionBloc()
self.initModif()
self.valeur = new_valeur
self.val = new_valeur
- if self.valeur and self.waitUserAssd() and not(self.waitUserAssdEnCreation()) :
+ if self.valeur and self.waitUserAssd() and not(self.waitUserAssdOrAssdMultipleEnCreation()) :
if type(self.valeur) in (list,tuple):
for v in self.valeur : v.ajoutUtilisePar(self)
else : self.valeur.ajoutUtilisePar(self)
"""
if self.definition.position == 'global' :
etape = self.getEtape()
- if etape :
+ # on est oblige de verifier si le nom est dans etape
+ # car parfois l ordre des creations/destruction n est pas clair
+ # quand on a des blocs freres qui contiennent le meme mc global
+ # cas de NumericalMethod dans VIMMP
+ # if etape :
+ if etape and self.nom in etape.mc_globaux:
del etape.mc_globaux[self.nom]
elif self.definition.position == 'global_jdc' :
# PNPNPN a debuger
- print (self.nom)
try :
del self.jdc.mc_globaux[self.nom]
except : pass
from .editorSsIhm import JDCEditorSsIhm
monEditeur=JDCEditorSsIhm(monEficasSsIhm,fichier)
fichierXML=fichier[:fichier.rfind(".")]+'.xml'
+ print (monEditeur.jdc.isValid())
+ if not(monEditeur.jdc.isValid()):
+ print ('Fichier comm non valide')
+ return
monEditeur.XMLgenerator.gener(monEditeur.jdc)
monEditeur.XMLgenerator.writeDefault(fichierXML)
if debug : print('Appel {} avec args={} et kwargs={}'.format( laFonction.__name__, args, kwargs))
laDefDeLaFonctionDansAccas = getattr(monEditor.readercata.cata,laFonctionName)
objConstruit = laDefDeLaFonctionDansAccas.makeObjetPourVerifSignature(*args,**kwargs)
- if (objConstruit.isValid(cr='oui')) :
+ if (objConstruit.isValid()) :
ret = laFonction(*args, **kwargs)
return ret
else :
return
- if len(self.listeAAfficher)*20 > 400 : self.setMinimumHeight(400)
- else : self.setMinimumHeight(len(self.listeAAfficher)*30)
+ if len(self.listeAAfficher)*30 > 400 : self.resize(self.width(),200)
+ else : self.resize(self.width(),len(self.listeAAfficher)*30)
self.politique=PolitiquePlusieurs(self.node,self.editor)
for i in range(1,len(self.listeAAfficher)+1): self.ajoutLE(i)
for i in range(len(self.listeAAfficher)):
self.selectionneNext()
def selectionneNext(self):
- print ('a programmer')
+ print ('selectionne Next a programmer')
def leaveEventScrollArea(self,event):
pass
self.filtreListe()
if len(self.listeAAfficher)*20 > 400 : self.setMinimumHeight(400)
else :
- if self.monSimpDef.min > len(self.listeAAfficher) : self.setMinimumHeight(self.monSimpDef.min*30+30)
- elif self.monSimpDef.max > len(self.listeAAfficher) : self.setMinimumHeight(400)
- else self.setMinimumHeight(len(self.listeAAfficher)*30+30)
+ if self.monSimpDef.min > len(self.listeAAfficher) : self.setMinimumHeight(self.monSimpDef.min*30+300)
+ elif self.monSimpDef.max > len(self.listeAAfficher) : self.setMinimumHeight(400)
+ else : self.setMinimumHeight(len(self.listeAAfficher)*30+30)
self.adjustSize()
self.politique=PolitiquePlusieurs(self.node,self.editor)
def checkPosition(self):
"""Vérifie l'attribut position."""
- if self.position not in ('local', 'global', 'global_jdc'):
+ if self.position not in ('local', 'global', 'global_jdc', 'inGetAttribut'):
self.cr.fatal(_(u"L'attribut 'position' doit valoir 'local', 'global' "
u"ou 'global_jdc' : %r"), self.position)
from copy import copy
from Noyau.N_ASSD import ASSD
+from Noyau.N_UserASSDMultiple import UserASSDMultiple
from Noyau.N_CO import CO
from . import N_OBJECT
from .N_CONVERT import ConversionFactory
# Le mot cle simple a été créé sans parent
# est-ce possible ?
print ('je suis dans le else sans parent du build')
- print (poum)
self.jdc = None
self.cata = None
self.niveau = None
self.etape = None
if self.definition.creeDesObjets :
- self.convProto = ConversionFactory('UserASSD', self.definition.creeDesObjetsDeType)
+ if issubclass(self.definition.creeDesObjetsDeType, UserASSDMultiple) :
+ self.convProto = ConversionFactory('UserASSDMultiple', self.definition.creeDesObjetsDeType)
+ else :
+ self.convProto = ConversionFactory('UserASSD', self.definition.creeDesObjetsDeType)
else :
self.convProto = ConversionFactory('type', typ=self.definition.type)
self.valeur = self.getValeurEffective(self.val)
self.type = (typ,)
for t in (self.type) :
try :
- if issubclass(t,Accas.UserASSD) :
+ if issubclass(t,Accas.UserASSDMultiple) :
+ creeDesObjetsDeType = t
+ self.utiliseUneReference = True
+ elif issubclass(t,Accas.UserASSD) :
creeDesObjetsDeType = t
self.utiliseUneReference = True
except : pass
"""
def __init__(self,nom='sansNom'):
- #print ('dans init de UserASSD pour ', nom, type(nom))
+ print ('dans init de UserASSD pour ', nom, type(nom))
self.nom = nom
self.jdc = CONTEXT.getCurrentJdC()
self.parent = None
self.parent= parent
def initialiseNom(self,nom):
- print ('je passe initialiseNom pour : ', self, nom, type(nom))
+ #print ('je passe initialiseNom pour : ', self, nom, type(nom))
for (i,j) in self.jdc.sdsDict.items() :
if j == self :
del(self.jdc.sdsDict[i])
--- /dev/null
+# coding=utf-8
+# Copyright (C) 2007-2017 EDF R&D
+#
+# 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.
+#
+# 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
+
+"""
+
+"""
+
+from __future__ import absolute_import
+from __future__ import print_function
+try :
+ from builtins import object
+except : pass
+import traceback
+import sys
+
+from .N_UserASSD import UserASSD
+
+class UserASSDMultiple(UserASSD):
+ """
+ Classe de base pour definir des types de structures de donnees definie par
+ l utilisateur
+ equivalent d un concept ASSD pour un SIMP ou un FACT
+ mais pouvant referencer 2 objets par exemple les groupes de mailles qui peuvent porter
+ le meme nom dans 2 maillages differents
+ """
+ def __init__(self,nom='sansNom'):
+ UserASSD.__init__(self,nom)
+
'Lagrangian one-particle pdfFluid_Particle_Mass_Source_Field',
'Particle_Volumetric_Concentration_Modified_Fluid_Viscosity',
'Particle_Extra_Stress_Tensor'),
+ ('Particles','Particles') : ('Pas encore fait'),
+ ('Fields','Fields') : ('Pas encore fait'),
}
dictCodeConvertisseur = {
('Fluent', 'OpenFOAM') : ('Fluent2CDM and CDM2OpenFoam'),
}
-#def prepareBlocSystemType(systemType) :
-# condition = "SystemType == '" + systemType + "'"
- #Identifier = SIMP(statut='o', typ=(modeleNumDuCompo,'createObject'),)
-# ModelType = SIMP(statut='o', typ='TXM', into = ('Particles', 'Fields'),position='global')
- #stl = SIMP (statut ='o', typ = simulatedTime)
-# dicoArgs={}
-
-# first=1
-# for typeMod in ( 'Fields', 'Particles'):
-# conditionType = "ModelType == '" + typeMod + "'"
-# NumericalMethod = SIMP(statut='o',typ='TXM', into=dictTypModNumModNum[systemType, typeMod],
-# position='global_jdc', intoXML=allValueInDict(dictTypModNumModNum))
-# if first :
-# blocNumMethod_1 = BLOC(condition =conditionType, NumericalMethod=NumericalMethod)
-# first=0
-# else :
-# blocNumMethod_2 = BLOC(condition =conditionType, NumericalMethod=NumericalMethod)
- #blocMeshRef = BLOC(condition = 'ModelType == "Fields" and NumericalMethod == "FV"',
- # Mesh_Identifiers = SIMP (statut ='o', max ='**', typ = meshIdentifier),)
-
-# dicoBloc = {}
-# for modeleNumerique in list(dictTypModNumModNum[systemType,typeMod]):
-# conditionNum = "NumericalMethod == '" + modeleNumerique + "'"
-# setCode = set()
-# for code in dictCodeModeleNumerique.keys():
-# if modeleNumerique in dictCodeModeleNumerique[code]: setCode.add(code)
-# Solver = SIMP(statut='o', typ='TXM', into=list(setCode), intoXML=list(dictCodeModeleNumerique.keys()) )
-# monNomBloc='b_ModelName_' + modeleNumerique.replace(' ','_')
-# if setCode !=set(): dicoBloc[monNomBloc]=BLOC(condition=conditionNum, nomXML='b_ModelName',Solver=Solver)
-# if setCode ==set(): print (condition, conditionNum)
-# #dicoArgs['b_modelType'+typeMod] = BLOC(condition=conditionType, NumericalMethod=NumericalMethod,**dicoBloc)
-# dicoArgs['b_modelType'+typeMod] = BLOC(condition=conditionType, **dicoBloc)
-# #NumericalModel = FACT(statut='o', max= '**', Identifier=Identifier, ModelType=ModelType,
-# NumericalModel = FACT(statut='o', max= '**', ModelType=ModelType,
-# blocNumMethod_1 = blocNumMethod_1, blocNumMethod_2 = blocNumMethod_2,
-# #blocMeshRef=blocMeshRef , Simulated_Time_Lapse=stl, **dicoArgs)
-# **dicoArgs)
-# return BLOC(condition=condition, nomXML='b_systemType', NumericalModel=NumericalModel)
def prepareBlocSystemType(systemType) :
condition = "SystemType == '" + systemType + "'"
Identifier = SIMP(statut='o', typ=(modeleNumDuCompo,'createObject'),)
SimulatedTimeLapse = SIMP (statut ='o', typ = simulatedTime)
- ModelType = SIMP(statut='o', typ='TXM', into = ('Particles', 'Fields'))
+ ModelType = SIMP(statut='o', typ='TXM', into = ('Particles', 'Fields'), position='inGetAttribut')
dicoArgs={}
for typeMod in ('Particles', 'Fields'):
conditionType = "ModelType == '" + typeMod + "'"
NumericalMethod = SIMP(statut='o',typ='TXM', into=dictTypModNumModNum[systemType, typeMod],
- position='global_jdc', intoXML=allValueInDict(dictTypModNumModNum))
+ position='global', intoXML=allValueInDict(dictTypModNumModNum))
dicoBloc = {}
for modeleNumerique in list(dictTypModNumModNum[systemType,typeMod]):
conditionNum = "NumericalMethod == '" + modeleNumerique + "'"
if setCode !=set(): dicoBloc[monNomBloc]=BLOC(condition=conditionNum, nomXML='b_ModelName',Solver=Solver)
dicoArgs['b_modelType'+typeMod] = BLOC(condition=conditionType, NumericalMethod=NumericalMethod,**dicoBloc)
- blocMeshRef = BLOC(condition = 'ModelType == "Fields" and NumericalMethod == "FV"',
+ blocMeshRef = BLOC(condition = '(ModelType == "Fields") and (NumericalMethod == "FV")',
+ #blocMeshRef = BLOC(condition = 'NumericalMethod == "FV"',
Mesh_Identifiers = SIMP (statut ='o', max ='**', typ = meshIdentifier),)
dicoArgs['blocMeshRef'] = blocMeshRef
NumericalModel = FACT(statut='o', max= '**', Identifier=Identifier, ModelType=ModelType,
Interaction = FACT( max = '**',
origine = SIMP(typ=modeleNumDuCompo, statut='o'),
destination = SIMP(typ=modeleNumDuCompo, statut='o'),
-# PN a derouler avec une fonction
+ monBloc_FFFF = BLOC (
+ condition = 'getEficasAttribut(origine,"ModelType") == "Fields" and getEficasAttribut(destination,"ModelType") == "Fields"' ,
+ termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Fields','Particles'],fenetreIhm='menuDeroulant'),
+ ),
+ monBloc_DPDP = BLOC (
+ condition = 'getEficasAttribut(origine,"ModelType") == "Particles" and getEficasAttribut(destination,"ModelType") == "Particles"' ,
+ termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Particles','Fields'],fenetreIhm='menuDeroulant'),
+ ),
monBloc_FFDP = BLOC (
condition = 'getEficasAttribut(origine,"ModelType") == "Fields" and getEficasAttribut(destination,"ModelType") == "Particles"' ,
termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Fields','Particles'],fenetreIhm='menuDeroulant'),
),
)
-dict_condition={'NumericalMethod' : ('Interactions', 'Component'),
+dict_condition={
+'ModelType' : ('Interactions', 'Component'),
+#'NumericalMethod' : ('Interactions', 'Component'),
# 'TypeOfSolid' : ('Component',)
}