class meshIdentifier(spatialRegion):pass
class scalar(UserASSD):pass
+class mapper2(UserASSD):pass
dictSystemTypeModeleNumerique = { 'Quantum system' : (),
'OpenFOAM' : ('OpenFoamFormat', 'Med', ),
}
+dictMapperFormat = {
+ 'Med Coupling' : ('Med',),
+ 'Gmsh' : ('Med', 'OpenFoamFormat'),
+}
+
dictTermeLE = {
('Fields','Particles') : ('Fluid_Velocity_Field',
'Fluid_Temperature_Field',
fieldNameInDestination = SIMP(typ='TXM', statut='o'),
)
-def monBlocAGenerer(condition):
- return BLOC (condition = condition,
- transferType = SIMP(typ='TXM', statut='o', into =['File', 'Memory', 'CorbaObject']),
- #monBloc_Saturne_Saturne = BLOC (
- # condition = 'transferType == "File" and getEficasAttribut(origine,"Solver") == "Code_Saturne" and getEficasAttribut(destination,"Solver") == "Code_Saturne"' ,
- # #condition = '1==1',
- # Format = SIMP(typ='TXM', statut='o', into = calculCommun( "Code_Saturne", "Code_Saturne",dictCodeFormat) ),
- #),
- #monBloc_Saturne_Fluent = BLOC (
- # condition = 'transferType == "File" and getEficasAttribut(origine,"Solver") == "Code_Saturne" and getEficasAttribut(destination,"Solver") == "Fluent"' ,
- # Format = SIMP(typ='TXM', statut='o', into = calculCommun( "Code_Saturne", "Code_Saturne",dictCodeFormat) ),
- # ),
- #monBloc_Saturne_OpenFoam = BLOC (
- #condition = 'transferType == "File" and getEficasAttribut(origine,"Solver") == "Code_Saturne" and getEficasAttribut(destination,"Solver") == "OpenFOAM"' ,
- # condition = 'transferType == "File" ,#and getEficasAttribut(origine,"Solver") == "Code_Saturne" and getEficasAttribut(destination,"Solver") == "OpenFOAM"' ,
- # Format = SIMP(typ='TXM', statut='o', into = calculCommun( "Code_Saturne", "OpenFOAM",dictCodeFormat) ),
- # monBloc_conversion = BLOC (condition = 'Format == "Use converter"',
- # converter = SIMP(typ='TXM', statut='o', into = dictCodeConvertisseur['Saturne', 'OpenFOAM']),
- # ),
- # ),
- monBlocFichier = creeBlocPourLesFichiers ("transferType=='File'", 'FileName', calculCommun( "Code_Saturne", "Code_Saturne",dictCodeFormat)),
- monBlocChamp = BLOC(condition = "transferType=='File'",
- FieldName=SIMP(typ='TXM', statut='o')
- ),
- )
-
-Mapper = OPER (nom= 'Mapper',sd_prod=mapper)
+def TousSelonLeTypeDeFormatDisponible(condition, labelName='fileName'):
+ transferType = SIMP(typ='TXM', statut='o', into =['File', 'Memory', 'CorbaObject'])
+ maListe = list(dictCodeFormat.keys())
+ dicoArgs={}
+ #index=0
+ #for Solv1 in maListe[index:]:
+ # for Solv2 in maListe[index:]:
+ # #print (Solv1,Solv2, calculCommun(Solv1, Solv2,dictCodeFormat))
+ # print ('PNPN attention changement de dictCodeFormat tant que getEficasAttribut n est pas correct')
+ # conditionSolv = 'transferType == "File" and getEficasAttribut(origine,"Solver")==Solv1 and getEficasAttribut(destination,"Solver")==Solv2' ,
+ # conditionSolv = 'transferType == "File"'
+ # monBlocFichier=creeBlocPourLesFichiers (conditionSolv, 'FileName', calculCommun(Solv1, Solv2,dictCodeFormat))
+ # dicoArgs['monBlocFichier'+str(index)]=monBlocFichier
+ # index=index+1
+ mesFormats=set()
+ for solv1 in dictCodeFormat.keys() :
+ for f in dictCodeFormat[solv1] : mesFormats.add(f)
+ conditionSolv='transferType == "File"'
+ BlocFichier=creeBlocPourLesFichiers (conditionSolv, labelName, mesFormats)
+ dicoArgs['BlocFichier']=BlocFichier
+ monBlocChamp = BLOC(condition = "transferType=='File'", FieldName=SIMP(typ='TXM', statut='o'))
+ dicoArgs['monBlocChamp']=monBlocChamp
+ return BLOC(condition = condition,transferType=transferType, **dicoArgs)
+
+def SelonLeTypeDeFormatDisponibleMapper(condition):
+ transferType = SIMP(typ='TXM', statut='o', into =['File', 'Memory', 'CorbaObject'])
+ maListe = list(dictCodeFormat.keys())
+ dicoArgs={}
+ index=0
+ for Solv1 in maListe[index:]:
+ for Solv2 in maListe[index:]:
+ #print (Solv1,Solv2, calculCommun(Solv1, Solv2,dictCodeFormat))
+ print ('PNPN attention changement de dictCodeFormat tant que getEficasAttribut n est pas correct')
+ conditionSolv = 'transferType == "File" and getEficasAttribut(origine,"Solver")==Solv1 and getEficasAttribut(destination,"Solver")==Solv2' ,
+ conditionSolv = 'transferType == "File"'
+ monBlocFichier=creeBlocPourLesFichiers (conditionSolv, 'FileName', calculCommun(Solv1, Solv2,dictCodeFormat))
+ dicoArgs['monBlocFichier'+str(index)]=monBlocFichier
+ index=index+1
+ monBlocChamp = BLOC(condition = "transferType=='File'", FieldName=SIMP(typ='TXM', statut='o'))
+ dicoArgs['monBlocChamp']=monBlocChamp
+ return BLOC(condition = condition,transferType=transferType, **dicoArgs)
+
+Mapper = OPER (nom= 'Mapper',sd_prod=mapper,
+ Solver=SIMP(statut='o', typ='TXM', into = list(dictMapperFormat.keys())),
+ )
Converter = OPER (nom= 'Converter',sd_prod=converter)
Interactions = PROC(nom='Interactions',
monBloc_DPFF = BLOC (
condition = 'getEficasAttribut(origine,"ModelType") == "Particles" and getEficasAttribut(destination,"ModelType") == "Fields"' ,
termeLE = SIMP(typ='TXM', statut='o', into = dictTermeLE['Particles','Fields'],fenetreIhm='menuDeroulant'),
- monBloc_Champ = monBlocInteractionTypeChamp(),
),
- couplingMode = SIMP(typ='TXM', statut='o', into =['direct', 'scaling','use converter']),
- monBlocDirect = monBlocAGenerer( "couplingMode=='direct'" ),
- monBlocMapper = BLOC ( condition = "couplingMode=='scaling'",
- myMapper = SIMP(typ=mapper, statut ='o')
+ couplingPart = FACT( statut='o',
+ couplingMode = SIMP(typ='TXM', statut='o', into =['direct', 'scaling','use converter']),
+ monBlocDirect = TousSelonLeTypeDeFormatDisponible( "couplingMode=='direct'" ),
+ monBlocIn = BLOC ( condition = "couplingMode=='scaling'",
+ OutConversion = FACT( statut='o',
+ monBlocFormat = TousSelonLeTypeDeFormatDisponible( "1", labelName = 'outFromMapperFileName' ),
+ ),
+ ),
+ monBlocMapper = BLOC ( condition = "couplingMode=='scaling'",
+ ConversionNode = FACT( min=1, max='**', statut ='o',
+ MapperInformation = FACT (statut ='o',
+ myMapper = SIMP(typ=mapper, statut ='o'),
+ mesParametres = FACT (statut ='o', monParametreQuiDependDeTermeLESiCelaExiste= SIMP(statut='o', typ='I')),
+ ),
+ #couplingMode = SIMP(typ='TXM', statut='o', into =['direct', 'scaling','use converter']),
+ OutNode = FACT (statut ='o',
+ monBlocFormat = TousSelonLeTypeDeFormatDisponible( "1", labelName = 'outFromMapperFileName' ),
+ ),
+ ),
+ ),
),
monBlocUseConverter = BLOC ( condition = "couplingMode=='use converter'",
myConverter = SIMP(typ=converter, statut ='o')