Salome HOME
suite chgt copyright et menage
[tools/eficas.git] / Tests / testelem / cata1.py
1 from Accas import SIMP,FACT,OPER,ASSD,AsException,AsType
2 import Noyau
3
4 class CATA:
5    def __init__(self):
6       CONTEXT.unset_current_cata()
7       CONTEXT.set_current_cata(self)
8    def enregistre(self,cmd):
9       pass
10
11 cata=CATA()
12
13 class concept(ASSD,Noyau.AsBase):pass
14
15 OP1 = OPER(nom='OP1',op=1,sd_prod=concept,
16            a=SIMP(typ='I'),
17            c=SIMP(typ='I',position='global'),
18           )
19
20 class concept2(ASSD,Noyau.AsBase):pass
21 class concept3(ASSD,Noyau.AsBase):pass
22
23 def op2_prod(TYPE_RESU,**args):
24    if TYPE_RESU == "TRANS" : return concept2
25    if TYPE_RESU == "HARMO" : return concept3
26    raise AsException("type de concept resultat non prevu")
27
28 OP2=OPER(nom='OP2',op=2,sd_prod=op2_prod,
29           TYPE_RESU       =SIMP(statut='f',typ='TXM',defaut="TRANS",into=("TRANS","HARMO") ),
30         )
31
32 def op3_prod(MATR,**args):
33    if AsType(MATR) == concept : return concept2
34    raise AsException("type de concept resultat non prevu")
35
36 OP3=OPER(nom='OP3',op=3,sd_prod=op3_prod,
37            MATR    =SIMP(statut='o',typ=concept),
38         )
39
40 def op4_prod(MESURE,**args):
41    vale=MESURE['NOM_PARA']
42    if  vale == 'INST'   : return concept
43    raise AsException("type de concept resultat non prevu")
44
45 OP4=OPER(nom='OP4',op=4,sd_prod=op4_prod,
46             MESURE  =FACT(statut='o',min=01,max=01,
47                           NOM_PARA  =SIMP(statut='f',typ='TXM',defaut="INST",into=("INST",) ),
48                          )
49         )
50
51 def op5_prod(FFT,**args):
52    if (FFT != None)        :
53       vale=FFT.get_child('FONCTION').get_valeur()
54       if (AsType(vale) == concept )  : return concept
55       if (AsType(vale) == concept2) : return concept2
56    raise AsException("type de concept resultat non prevu")
57
58
59 OP5=OPER(nom='OP5',op=5,sd_prod=op5_prod,
60          FFT =FACT(statut='f',min=1,max=1,
61                     FONCTION =SIMP(statut='o',typ=(concept,concept2) )
62                    ),
63          )
64
65 def op6_prod(FILTRE,**args):
66    vale=FILTRE[0]['MODE']
67    if  AsType(vale) == concept : return concept
68    if  AsType(vale) == concept2 : return concept2
69    raise AsException("type de concept resultat non prevu")
70
71 OP6=OPER(nom='OP6',op=6,sd_prod=op6_prod,
72             FILTRE  =FACT(statut='o',min=01,max='**',
73                           MODE  =SIMP(statut='o',typ=(concept,concept2) ),
74                          )
75         )
76
77 OP7=OPER(nom='OP7',op=7,sd_prod=concept,
78             FILTRE  =FACT(statut='o',min=01,max='**',
79                           MODE  =SIMP(statut='o',typ=(concept,concept2) ),
80                          )
81         )
82