コード例 #1
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
 def getres(self):
     """
       Retourne le nom du resultat, le nom du concept
       et le nom de la commande
       Ces noms sont en majuscules et completes par des
       blancs jusqu a une longueur de 8
       Utilise par l interface C-FORTRAN
     """
     if CONTEXT.debug:
         prbanner("getres " + self.nom + " " + reprlim(self))
     # self ne peut etre qu'un objet de type ETAPE
     nom_cmd = self.definition.nom.ljust(8)
     nom_concept = " "
     type_concept = " "
     if self.sd != None:
         nom_concept = self.sd.get_name().ljust(8)
         type_concept = self.sd.__class__.__name__.upper()
     assert (nom_concept != None), "getres : nom_concept est Vide (None)"
     if CONTEXT.debug:
         print "\tGETRES : nom_concept =", '"' + nom_concept + '"'
         print "\tGETRES : type_concept =", '"' + type_concept + '"'
         print "\tGETRES : nom_cmd =", '"' + nom_cmd + '"'
     # message.debug(SUPERV, "commande : %s, concept : %s, type : %s",
     # nom_cmd, nom_concept, type_concept)
     return nom_concept, type_concept, nom_cmd
コード例 #2
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getvid(self, nom_motfac, nom_motcle, iocc, mxval):
        """
          Methode B_ETAPE.ETAPE.getvid
          Auteur : Christian Carémoli
          Intention : récupérer la liste des valeurs pour le mot-cle passe
                      en argument (cette fonction traite les blocs)
        """
        if CONTEXT.debug:
            prbanner("getvid %s %s %d %d" %
                     (nom_motfac, nom_motcle, iocc, mxval))

        nom_motfac = nom_motfac.strip()
        nom_motcle = nom_motcle.strip()

        valeur = self.get_valeur_motcle_pour_getvid(nom_motfac, iocc,
                                                    nom_motcle)
        if valeur == None:
            if CONTEXT.debug:
                print "\tGETVID : valeur =", None
            return 0, (), 1
        valeur = B_utils.CONVID(valeur)
        valeur = B_utils.RETLIST(valeur, mxval)
        if CONTEXT.debug:
            print "\tGETVID : valeur =", valeur
        iarg = self.getdef(nom_motfac, nom_motcle, iocc)
        return valeur[0], valeur[1], iarg
コード例 #3
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getvr8(self, nom_motfac, nom_motcle, iocc, mxval):
        """
            Cette methode retourne la valeur du mot cle simple nom_motcle de type R8
        """
        if CONTEXT.debug:
            prbanner("getvr8 %s %s %d %d" %
                     (nom_motfac, nom_motcle, iocc, mxval))

        valeur = self.get_valeur_mc(nom_motfac, nom_motcle, iocc, mxval)
        valeur = self.Traite_value(valeur, "R8")
        if not self.check_float(valeur[1]):
            # elements de contexte
            print '! Etape  :', getattr(self, 'nom',
                                        '?'), '/', nom_motfac, '/', nom_motcle
            print '! Parent :', getattr(self.parent, 'nom', '?')
            print "! ERREUR incoherence fortran/catalogue de commande, réel attendu et non :"
            print "!", valeur[1]
            raise AssertionError

        if CONTEXT.debug:
            B_utils.TraceGet('GETVR8', nom_motfac, iocc, nom_motcle, valeur)
            for k in valeur[1]:
                assert is_float_or_int(k), ` k ` + " n'est pas un float"
        iarg = self.getdef(nom_motfac, nom_motcle, iocc)
        return valeur[0], valeur[1], iarg
コード例 #4
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getvtx(self, nom_motfac, nom_motcle, iocc, mxval):
        """
            Cette méthode retourne la valeur du mot-clé simple nom_motcle de la commande self.
            Ce mot clé peut etre directement sous la commande (nom_motfac == "") ou sous
            un mot cle facteur (nom_motfac != "").
            Dans ce cas iocc indique le numéro du mot-clé facteur à utiliser
        """
        if CONTEXT.debug:
            prbanner("getvtx %s %s %d %d" %
                     (nom_motfac, nom_motcle, iocc, mxval))

        valeur = self.get_valeur_mc(nom_motfac, nom_motcle, iocc, mxval)

        if not self.check_text(valeur[1]):
            # elements de contexte
            print '! Etape  :', getattr(self, 'nom',
                                        '?'), '/', nom_motfac, '/', nom_motcle
            print '! Parent :', getattr(self.parent, 'nom', '?')
            print "! ERREUR incoherence fortran/catalogue de commande, " \
                  "chaine de caractères attendue et non :"
            print "!", valeur[1]
            raise AssertionError

        valeur = self.Traite_value(valeur, "TX")
        if CONTEXT.debug:
            B_utils.TraceGet('GETVTX', nom_motfac, iocc, nom_motcle, valeur)
            for k in valeur[1]:
                assert is_str(k)
        iarg = self.getdef(nom_motfac, nom_motcle, iocc)
        return valeur[0], valeur[1], iarg
コード例 #5
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def get_mcsimp(self, nom_motfac, nom_motcle):
        """Fonction :
             retourne le mot-clé si :
                   - le mot-cle de nom nom_motcle existe dans le mot-cle facteur
                            de nom nom_motfac
                   - ou si le mot-cle de nom nom_motcle existe dans l'etape
                            self, dans ce cas nom_motfac est blanc (ou vide)
                   - ou si le mot-cle de nom nom_motfac existe dans l'etape
                            self, dans cas nom_motcle est blanc (ou vide).
             dans le cas contraire get_mcsimp retourne la valeur None.
        """
        if CONTEXT.debug:
            prbanner("get_mcsimp '%s' '%s' " % (nom_motfac, nom_motcle))

        nom_motfac = nom_motfac.strip()
        nom_motcle = nom_motcle.strip()
        assert (nom_motfac != "" or nom_motcle != "")

        mcsimp = None
        if nom_motfac == "":
            mcsimp = self.definition.get_entite(nom=nom_motcle,
                                                typ=N_SIMP.SIMP)
        else:
            if nom_motcle == "":
                # ici on recherche nom_motfac dans l'etape courante
                mcsimp = self.definition.get_entite(nom=nom_motfac,
                                                    typ=N_FACT.FACT)
            else:
                l_mot_fac = self.definition.getmcfs(nom_motfac)
                for mot_fac in l_mot_fac:
                    mcsimp = mot_fac.get_entite(nom=nom_motcle,
                                                typ=N_SIMP.SIMP)
                    if mcsimp != None:
                        break
        return mcsimp
コード例 #6
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getvc8(self, nom_motfac, nom_motcle, iocc, mxval):
        """
            Methode B_ETAPE.ETAPE.getvc8
            Auteurs : FR/AY
            Intention : récupérer la liste des valeurs complexes pour le mot-cle passe
                            en argument (cette fonction traite les blocs)
        """
        if CONTEXT.debug:
            prbanner("getvc8 %s %s %d %d" %
                     (nom_motfac, nom_motcle, iocc, mxval))

        valeur = self.get_valeur_mc(nom_motfac, nom_motcle, iocc, mxval)
        valeur = self.Traite_value(valeur, "C8")
        if CONTEXT.debug:
            B_utils.TraceGet('GETVC8', nom_motfac, iocc, nom_motcle, valeur)
        iarg = self.getdef(nom_motfac, nom_motcle, iocc)
        return valeur[0], valeur[1], iarg
コード例 #7
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getfac(self, nom_motfac):
        """
        - Retourne le nombre d occurences du mot cle facteur nom_motfac
          dans l'objet self : on examine les fils presents sinon on recherche dans
          les defauts.
        - est utilise par l'interface C-FORTRAN.
        """
        if CONTEXT.debug:
            prbanner("getfac %s " % (nom_motfac, ))
        nomfac = nom_motfac.strip()
        taille = 0
        for child in self.mc_liste:
            if child.nom == nomfac:
                if isinstance(child, N_MCFACT.MCFACT):
                    taille = 1
                    break
                elif isinstance(child, N_MCLIST.MCList):
                    taille = len(child.data)
                    break
                else:
                    raise AsException("incoherence de type dans getfac")
            elif isinstance(child, N_MCBLOC.MCBLOC):
                taille = child.getfac(nom_motfac)
                if taille:
                    break
        # On cherche si un mot cle par defaut existe
        if taille == 0:
            assert (hasattr(self, 'definition'))
            assert (hasattr(self.definition, 'entites'))
            if self.definition.entites.has_key(nomfac):
                assert isinstance(self.definition.entites[nomfac],
                                  N_ENTITE.ENTITE)
                assert (hasattr(self.definition.entites[nomfac], 'statut'))
                if self.definition.entites[nomfac].statut == 'd':
                    taille = 1

        if taille == 0:
            # On verifie que la definition du mot-cle nom_motfac existe
            if self.getexm(nom_motfac, '') == 0:
                raise AsException("le mot clé facteur " + nom_motfac +
                                  " n existe pas "
                                  "dans le catalogue de la commande")

        if CONTEXT.debug:
            print '\tGETFAC : ', "taille =", taille
        return taille
コード例 #8
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getexm(self, nom_motfac, nom_motcle):
        """ Fonction :
             retourne 1 si :
                   - le mot-cle de nom nom_motcle existe dans le mot-cle facteur
                            de nom nom_motfac
                   - ou si le mot-cle de nom nom_motcle existe dans l'etape
                            self, dans ce cas nom_motfac est blanc (ou vide)
                   - ou si le mot-cle de nom nom_motfac existe dans l'etape
                            self, dans cas nom_motcle est blanc (ou vide).
             dans le cas contraire getexm retourne la valeur 0.
        """
        if CONTEXT.debug:
            prbanner("getexm '%s' '%s' " % (nom_motfac, nom_motcle))

        presence = int(self.get_mcsimp(nom_motfac, nom_motcle) != None)
        if CONTEXT.debug:
            print '\tGETEXM : ', "presence = ", presence
        return presence
コード例 #9
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getvls(self, nom_motfac, nom_motcle, iocc, mxval):
        """
            Methode B_ETAPE.ETAPE.getvls
            Auteur : Christian Carémoli
            Intention : récupérer la liste des valeurs logiques pour le mot-cle passe
                            en argument (cette fonction traite les blocs)
        """
        if CONTEXT.debug:
            prbanner("getvls %s %s %d %d" %
                     (nom_motfac, nom_motcle, iocc, mxval))

        valeur = self.get_valeur_mc(nom_motfac, nom_motcle, iocc, mxval)
        valeur = self.Traite_value(valeur, "IS")
        # XXX est ce IS ou LS ????
        if CONTEXT.debug:
            B_utils.TraceGet('GETVLS', nom_motfac, iocc, nom_motcle, valeur)
            for k in valeur[1]:
                assert is_int(k)
        return valeur
コード例 #10
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def getvis(self, nom_motfac, nom_motcle, iocc, mxval):
        """
            Methode B_ETAPE.ETAPE.getvis
            Auteur : Christian Carémoli
            Intention : récupérer la liste des valeurs entières pour le mot-cle passe
                            en argument (cette fonction traite les blocs)
        """
        if CONTEXT.debug:
            prbanner("getvis %s %s %d %d" %
                     (nom_motfac, nom_motcle, iocc, mxval))

        valeur = self.get_valeur_mc(nom_motfac, nom_motcle, iocc, mxval)
        valeur = self.Traite_value(valeur, "IS")
        if CONTEXT.debug:
            B_utils.TraceGet('GETVIS', nom_motfac, iocc, nom_motcle, valeur)
            for k in valeur[1]:
                assert is_int(k), type(k)
        iarg = self.getdef(nom_motfac, nom_motcle, iocc)
        return valeur[0], valeur[1], iarg
コード例 #11
0
ファイル: B_ETAPE.py プロジェクト: jacojvr/Code_Aster
 def getltx(self, nom_motfac, nom_motcle, iocc, mxval, taille):
     """
         Methode B_ETAPE.ETAPE.getltx
         Auteur : Antoine Tessayan
         Intention : récupérer dans un tuple la longueur des variables de type texte
                         du mocle nom_motcle
     """
     if CONTEXT.debug:
         prbanner("getltx %s %s %d %d" %
                  (nom_motfac, nom_motcle, iocc, mxval))
     # Recuperation des chaines elles memes
     nbval, tup, iarg = self.getvtx(nom_motfac, nom_motcle, iocc, mxval)
     # stockage des longueurs des chaines dans un tuple
     longueurs = []
     k = 0
     for chaine in tup:
         assert is_str(chaine)
         longueurs.append(min(len(chaine), taille))
         k = k + 1
     assert k == abs(nbval), (k, nbval, tup)
     if CONTEXT.debug:
         print "\tGETLTX : isval =", longueurs
     return nbval, tuple(longueurs)
コード例 #12
0
ファイル: E_ETAPE.py プロジェクト: jacojvr/Code_Aster
    def Exec(self):
        """
        Realise une passe d'execution sur l'operateur "fortran" associé
        si le numero d'operateur (self.definition.op) est défini.

        On execute l'operateur numero self.definition.op
        en lui passant les arguments :
          - self : la commande courante
          - lot : le mode d'execution qui peut prendre comme valeur :
                 -  0 = execution par lot (verification globale avant execution)
                 -  1 = execution commande par commande (verification + execution commande par commande)
          - ipass : passe d'execution
                 -  1 = verifications supplémentaires
                 -  2 = execution effective
          - icmd  : numéro d'ordre de la commande
        Retour : iertot = nombre d erreurs
        """
        from Utilitai.Utmess import UTMESS, MessageLog
        if CONTEXT.debug:
            prbanner(" appel de l operateur %s numero %s " %
                     (self.definition.nom, self.definition.op))

        # On n'execute pas les etapes qui n'ont pas de numero d'operateur
        # associé
        if self.definition.op is None:
            return 0

        assert(type(self.definition.op) == int), "type(self.definition.op)=" + \
            `type(self.definition.op)`

        ier = 0

        # Il ne faut pas executer les commandes non numerotees
        # Pour les affichages et calculs de cpu, on exclut les commandes
        # tout de suite executees (op_init) de type FORMULE. Sinon, ca
        # produit un affichage en double.
        if self.icmd is not None:
            # appel de la methode oper dans le module codex
            if self.definition.op_init is None:
                self.AfficheTexteCommande()
                if self.sd and self.jdc.sdveri:
                    l_before = checksd.get_list_objects()

            self.jdc.timer.Stop(' . part Superviseur')
            self.jdc.timer.Start(' . part Fortran', num=1.2e6)
            astype = type(self.sd).__name__.upper()
            if self.sd:
                self.codex.register_type(self.sd.nom, astype)
            self.codex.oper(self, self.jdc.jxveri)
            self.jdc.timer.Stop(' . part Fortran')
            self.jdc.timer.Start(' . part Superviseur')
            for co in self.get_created_sd():
                co.executed = 1

            if self.definition.op_init is None:
                # vérification de la SD produite
                if self.sd and self.jdc.sdveri:
                    # on force la vérif si :
                        # concept réentrant
                        # sd.nom absent du contexte (detruit ? car les nouveaux sont forcément vérifiés)
                        # pb avec macro reentrante et commande non reentrante :
                        # cf. ssnv164b ou ssll14a
                    force = (self.reuse is not None) \
                        or (self.parent.get_contexte_avant(self).get(self.sd.nom) is None) \
                        or (self.parent != self.jdc)
                    self.jdc.sd_checker.force(force)
                    self.jdc.timer.Start('   . sdveri', num=1.15e6)
                    self.jdc.sd_checker = checksd.check(
                        self.jdc.sd_checker, self.sd, l_before, self)
                    self.jdc.timer.Stop('   . sdveri')
                # pour arreter en cas d'erreur <E>
                MessageLog.reset_command()
                # affichage du texte de la commande
                self.AfficheFinCommande()
        else:
            self.AfficheTexteCommande()

        if CONTEXT.debug:
            prbanner(
                " fin d execution de l operateur %s numero %s " % (self.definition.nom,
                                                                   self.definition.op))
        return ier