Beispiel #1
0
 def test_bdf_test(self):
     filenames = [
         #os.path.join(MODEL_PATH, 'superelements', 'resvec23.bdf'),
         os.path.join(MODEL_PATH, 'elements', 'time_thermal_elements.bdf'),
     ]
     run_lots_of_files(filenames, folder='', debug=False, xref=True, check=True, punch=False,
                       nastran='', encoding=None, size=None, is_double=None, post=None,
                       sum_load=True, dev=True, crash_cards=None, pickle_obj=True,
                       write_hdf5=True, quiet=False)
Beispiel #2
0
def run(regenerate=True,
        run_nastran=False,
        debug=False,
        sum_load=True,
        xref=True,
        crash_cards=None):
    """Runs the full BDF test suite"""
    if crash_cards is None:
        crash_cards = []
    # F:\work\pyNastran\pyNastran\master2\pyNastran\bdf\test
    files = get_files_of_type('tests', '.bdf')
    files += get_files_of_type('tests', '.dat')
    folders_file = 'tests/foldersRead.txt'

    # isubcases = []
    # save_cases = True
    # stop_on_failure = False
    if run_nastran:
        if os.path.exists(r'C:\MSC.Software\MSC.Nastran\bin\nastran.exe'):
            nastran = r'C:\MSC.Software\MSC.Nastran\bin\nastran.exe scr=yes bat=no old=no '
        else:
            raise RuntimeError('cant find Nastran')
        # elif os.path.exsits():
    else:
        nastran = ''

    failed_cases_filename = 'failed_cases%s%s.in' % (sys.version_info[:2])
    if regenerate:
        files2 = get_all_files(folders_file, '.bdf')
        files2 += get_all_files(folders_file, '.nas')
        files2 += get_all_files(folders_file, '.dat')
        files2 = list(set(files2))
        files2.sort()
    else:
        print('failed_cases_filename = %r' % failed_cases_filename)
        files2 = get_failed_files(failed_cases_filename)

    #for filename in files2:
    #print(filename)
    skip_files = [
        'mp10a.dat',
        'mp20e.dat',
        'mp30.dat',
        'mp30b.dat',
        'mp60bd.dat',
        'mp60br.dat',
        'mp60cd.dat',
        'mp60cr.dat',
        'mp70a.dat',
        #'heli112em8.dat',  # horrible CORD1x model
    ]

    files = remove_marc_files(files2)
    files = [
        fname for fname in files
        if not os.path.basename(fname).startswith('out_')
        and '.test_op2.' not in fname  # removing test output files
        and '.test_bdf.' not in fname and '.test_bdfv.' not in fname and
        'tecplot' not in fname and os.path.basename(fname) not in skip_files
    ]

    if os.path.exists('skipped_cards.out'):
        os.remove('skipped_cards.out')

    print("nfiles = %s" % len(files))
    check = True
    debug = False
    size = [8]
    is_double = [False]
    post = -1
    failed_files = run_lots_of_files(files,
                                     debug=debug,
                                     xref=xref,
                                     check=check,
                                     nastran=nastran,
                                     size=size,
                                     is_double=is_double,
                                     post=post,
                                     encoding='latin1',
                                     crash_cards=crash_cards,
                                     dev=True,
                                     pickle_obj=True)
    ntotal = len(files)
    nfailed = len(failed_files)
    npassed = ntotal - nfailed
    sys.stderr.write('%i/%i passed\n' % (npassed, ntotal))

    if PY2:
        write = 'wb'
    else:
        write = 'w'
    with open(failed_cases_filename, write) as failed_cases_file:
        for fname in failed_files:
            failed_cases_file.write('%s\n' % fname)
    sys.exit('finished...')
Beispiel #3
0
    skipFiles = []  # giant

    nStart = 0
    nStop = 10000
    try:
        os.remove('skippedCards.out')
    except:
        pass

    print("nFiles = %s" % len(files))
    cid = None
    check = True
    xref = True
    debug = False
    failed_files = run_lots_of_files(files,
                                     debug=debug,
                                     xref=xref,
                                     check=check,
                                     cid=cid)
    try:
        f = open('failedCases.in', 'w')
    except IOError:
        #fds = get_open_fds()
        #print(get_file_names_from_file_number(fds))
        raise
    for fname in failed_files:
        f.write('%s\n' % fname)
    f.close()
    sys.exit('finished...')
Beispiel #4
0
def run(regenerate=True, run_nastran=False, debug=False, sum_load=True):
    """Runs the full BDF test suite"""
    # F:\work\pyNastran\pyNastran\master2\pyNastran\bdf\test
    files = get_files_of_type('tests', '.bdf')
    files += get_files_of_type('tests', '.dat')
    folders_file = 'tests/foldersRead.txt'

    # isubcases = []
    # save_cases = True
    # stop_on_failure = False
    if run_nastran:
        if os.path.exists(r'C:\MSC.Software\MSC.Nastran\bin\nastran.exe'):
            nastran = r'C:\MSC.Software\MSC.Nastran\bin\nastran.exe scr=yes bat=no old=no '
        else:
            raise RuntimeError('cant find Nastran')
        # elif os.path.exsits():
    else:
        nastran = ''

    if regenerate:
        files2 = get_all_files(folders_file, '.bdf')
        files2 += get_all_files(folders_file, '.nas')
        files2 += get_all_files(folders_file, '.dat')
        files2 += files
        files2.sort()
    else:
        files2 = get_failed_files('failedCases.in')

    files = remove_marc_files(files2)
    files = [fname for fname in files
             if not os.path.basename(fname).startswith('out_')
             and '.test_op2.' not in fname]  # removing test output files

    # skip_files = []  # giant

    # nstart = 0
    # nstop = 10000
    if os.path.exists('skippedCards.out'):
        os.remove('skippedCards.out')

    print("nFiles = %s" % len(files))
    cid = None
    check = True
    xref = True
    debug = False
    size = [8]
    is_double = [False]
    post = -1
    failed_files = run_lots_of_files(files, debug=debug, xref=xref,
                                     check=check, cid=cid,
                                     nastran=nastran,
                                     size=size, is_double=is_double, post=post)
    ntotal = len(files)
    nfailed = len(failed_files)
    npassed = ntotal - nfailed
    sys.stderr.write('%i/%i passed\n' % (npassed, ntotal))

    if PY2:
        write = 'wb'
    else:
        write = 'w'
    with open('failedCases.in', write) as failed_cases_file:
        for fname in failed_files:
            failed_cases_file.write('%s\n' % fname)
    sys.exit('finished...')
Beispiel #5
0
        files2 = get_failed_files('failedCases.in')

    files = remove_marc_files(files2)

    skipFiles = []  # giant

    nStart = 0
    nStop = 10000
    try:
        os.remove('skippedCards.out')
    except:
        pass

    print("nFiles = %s" % len(files))
    cid = None
    check = True
    xref = True
    debug = False
    failed_files = run_lots_of_files(files, debug=debug, xref=xref,
                                     check=check, cid=cid)
    try:
        f = open('failedCases.in', 'w')
    except IOError:
        #fds = get_open_fds()
        #print(get_file_names_from_file_number(fds))
        raise
    for fname in failed_files:
        f.write('%s\n' % fname)
    f.close()
    sys.exit('finished...')
Beispiel #6
0
def main():
    # F:\work\pyNastran\pyNastran\master2\pyNastran\bdf\test
    files = get_files_of_type('tests', '.bdf')
    files += get_files_of_type('tests', '.dat')
    foldersFile = 'tests/foldersRead.txt'

    iSubcases = []
    debug = False

    saveCases = True
    regenerate = True
    stopOnFailure = False
    nastran = r'C:\MSC.Software\MSC.Nastran\bin\nastran.exe scr=yes bat=no old=no '
    nastran = ''

    if regenerate:
        files2 = get_all_files(foldersFile, '.bdf')
        files2 += get_all_files(foldersFile, '.nas')
        files2 += get_all_files(foldersFile, '.dat')
        files2 += files
        files2.sort()
    else:
        files2 = get_failed_files('failedCases.in')

    files = remove_marc_files(files2)
    files = [fname for fname in files
             if not os.path.basename(fname).startswith('out_')]  # removing test output files

    skipFiles = []  # giant

    nStart = 0
    nStop = 10000
    try:
        os.remove('skippedCards.out')
    except:
        pass

    print("nFiles = %s" % len(files))
    cid = None
    check = True
    xref = True
    debug = False
    size = [8]
    is_double = [False]
    post = -1
    failed_files = run_lots_of_files(files, debug=debug, xref=xref,
                                     check=check, cid=cid,
                                     nastran=nastran,
                                     size=size, is_double=is_double, post=post)
    ntotal = len(files)
    nfailed = len(failed_files)
    npassed = ntotal - nfailed
    sys.stderr.write('%i/%i passed\n' % (npassed, ntotal))
    try:
        if PY2:
            f = open('failedCases.in', 'wb')
        else:
            f = open('failedCases.in', 'w')
    except IOError:
        #fds = get_open_fds()
        #print(get_file_names_from_file_number(fds))
        raise
    for fname in failed_files:
        f.write('%s\n' % fname)
    f.close()
    sys.exit('finished...')