예제 #1
0
def vocab01_ops(self, EXISTANT, INFO, **kwargs):
    """Fake macro-command to check the catalog"""
    test = code_aster.TestCase()

    # start the job
    commands = getListOfCommands()
    checkDefinition(test, commands)
    checkDocStrings(test, commands)

    print("\n>>> Checking for keywords...")
    fileList = None
    if INFO == 2:
        fileList = tempfile.NamedTemporaryFile(prefix="vocab01a_").name
    allKwd = printKeywordsUsage(commands, fileList)
    nbWords = len(allKwd)

    diff = set(allKwd).difference(EXISTANT)
    nbNew = len(diff)
    if nbNew:
        UTMESS('A',
               'CATAMESS_2',
               valk=("Liste des nouveaux mots-clefs (relancer avec INFO=2 "
                     "pour produire la nouvelle liste) :", str(list(diff))))
    test.assertEqual(nbNew,
                     0,
                     msg="nouveaux mots-clefs (absents de vocab01a.34)")

    nbExist = len(EXISTANT)
    if nbExist != nbWords:
        UTMESS('A',
               'CATAMESS_2',
               valk=("Il y avait {} mots-clefs dans le catalogue et, "
                     "maintenant, il y en a {}.".format(nbExist, nbWords),
                     "Relancez avec INFO=2 pour écrire la nouvelle liste "
                     "et comparer avec le fichier vocab01a.34 existant."))
    test.assertEqual(nbWords,
                     nbExist,
                     msg="nombre de mots-clefs (catalogue vs vocab01a.34)")

    diff = set(EXISTANT).difference(allKwd)
    nbDel = len(diff)
    if nbDel:
        UTMESS('A',
               'CATAMESS_2',
               valk=("Liste des %d mots-clefs supprimés ou non définis dans "
                     "cette version.\nIl faut activer le support de MFront "
                     "pour que tous les mots-clés soient reconnus.\n\n"
                     "Relancer avec INFO=2 "
                     "pour produire la nouvelle liste :" % nbDel,
                     str(list(diff))))

    check_material_def(test)

    print("\n>>> Tests de vocab01a")
    test.printSummary()
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# code_aster 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.
#
# You should have received a copy of the GNU General Public License
# along with code_aster.  If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------------------

import code_aster
from code_aster.Commands import *
test = code_aster.TestCase()

code_aster.init("--test")

rank = code_aster.getMPIRank()

Mesh2 = code_aster.Mesh()
Mesh2.readMedFile("xxNotParallelMechanicalLoad001i.med")

model = AFFE_MODELE(MAILLAGE = Mesh2,
                    AFFE = _F(MODELISATION = "D_PLAN",
                              PHENOMENE = "MECANIQUE",
                              TOUT = "OUI",),
                    DISTRIBUTION=_F(METHODE='CENTRALISE',),)

char_cin = AFFE_CHAR_CINE(MODELE=model,