def genxde(xdename, gesname, coortype):

    # start parsing
    start = time()

    # xde elements and their line number
    xde_lists, list_addr, ges_info = {}, {}, {}

    # get shap, gaus, dim and axis information into ges_info
    from felac_data import prepare_to_genxde
    prepare_to_genxde(gesname, coortype, ges_info)

    # parse xde
    from parse_xde import parse_xde
    xdefile = open(xde_folder + xdename, mode='r')
    error = parse_xde(ges_info, xde_lists, list_addr, xdefile)
    xdefile.close()
    if error: return

    # generate ges by xde element
    from xde2ges import xde2ges
    gesfile = open(ges_folder + gesname + '.ges', mode='w')
    error = xde2ges(ges_info, xde_lists, list_addr, gesfile)
    gesfile.close()
    if error: return

    # export xde element
    import json
    file = open(ifo_folder + gesname + '.json', mode='w')
    file.write(json.dumps(xde_lists, indent=4))
    file.close()

    end = time()
    print('parsing time: {}s'.format(end - start))
def main(argvs=None):
    if argvs is None:
        argvs = argv

    start = time()

    from felac_data import get_felac_data
    get_felac_data()

    xdename, gesname, coortype = argvs[1], argvs[2], argvs[3]

    # xde elements and their line number
    xde_lists, list_addr, ges_info = {}, {}, {}

    # get shap, gaus, dim and axis information into ges_info
    from felac_data import prepare_to_genxde
    prepare_to_genxde(gesname, coortype, ges_info)

    from parse_xde import parse_xde
    xdefile = open('../0xde_source/' + xdename, mode='r')
    error = parse_xde(ges_info, xde_lists, list_addr, xdefile)
    xdefile.close()
    if error: return

    from xde2md import xde2md
    mdfile = open('../1ges_target/' + argvs[1] + '.md', mode='w')
    xde2md(gesname, coortype, xde_lists, list_addr, mdfile)
    mdfile.close()

    end = time()
    print('parsing time: {}s'.format(end - start))
Exemple #3
0
def main(argvs=None):
    if argvs is None:
        argvs = argv

    start = time()

    from felac_data import get_felac_data
    get_felac_data()

    xdename, gesname, coortype, fieldnum = 'nl', 'nl', 'nl', 'nl'

    if len(argvs) == 4:
        xdename, gesname, coortype = argvs[1], argvs[2], argvs[3]
    elif len(argvs) == 3:
        xdename = argvs[2].replace('\\', '/').rstrip('/')
        xdename = xdename.split('/')[-1]
        xdename, xdetype = xdename.split('.')[:2]
        mdifile = open(argv[1] + '.mdi', mode='r')
        for strings in mdifile.readlines():
            fieldSN = regx.search(r'#[a-z]', strings, regx.I)
            if fieldSN != None: fieldnum = fieldSN.group().lstrip('#')

            axi = regx.search(r'[123]d[xyzrozs]{1,3}', strings, regx.I)
            if axi != None: coortype = axi.group()

            if  regx.search(xdename, strings, regx.I) != None \
            and regx.search(xdetype, strings, regx.I) != None :
                ges_list = regx.findall(r'[ltqwc]\d+(?:g\d+)?', strings,
                                        regx.I)
                gesname = f'{fieldnum}e{ges_list[0]}'

        xdename = argvs[2]

    # xde elements and their line number
    xde_lists, list_addr, ges_info = {}, {}, {}

    # get shap, gaus, dim and axis information into ges_info
    from felac_data import prepare_to_genxde
    prepare_to_genxde(gesname, coortype, ges_info)

    from parse_xde import parse_xde
    xdefile = open(xdename, mode='r')
    error = parse_xde(ges_info, xde_lists, list_addr, xdefile)
    xdefile.close()
    if error: return

    from xde2html import xde2html
    htmlfile = open(xdename + '.html', mode='w')
    xde2html(ges_info, xde_lists, list_addr, htmlfile)
    htmlfile.close()

    end = time()
    print('parsing time: {}s'.format(end - start))
def genxde(xdename, gesname, coortype):

    # start parsing
    start = time()

    # xde elements and their line number
    xde_lists, list_addr, ges_info = {}, {}, {}

    # get shap, gaus, dim and axis information into ges_info
    from felac_data import prepare_to_genxde
    prepare_to_genxde(gesname, coortype, ges_info)

    # parse xde
    from parse_xde import parse_xde
    xdefile = open(xde_folder + xdename, mode='r')
    error = parse_xde(ges_info, xde_lists, list_addr, xdefile)
    xdefile.close()
    if error: return

    # generate ges by xde element
    if gen_obj['ges'] > 0:
        from xde2ges import xde2ges
        gesfile = open(ges_folder + gesname + '.ges', mode='w')
        error = xde2ges(ges_info, xde_lists, list_addr, gesfile)
        gesfile.close()
        if error: return

    # generate html by xde element
    if gen_obj['html'] > 0:
        from xde2html import xde2html
        htmlfile = open(ifo_folder + xdename + '.html', mode='w')
        xde2html(ges_info, xde_lists, list_addr, htmlfile)
        htmlfile.close()

    # generate markdown by xde element
    #if gen_obj['md'] > 0:
    #    from xde2md import xde2md
    #    mdfile = open('../1ges_target/'+argvs[1]+'.md', mode='w')
    #    xde2md(ges_info xde_lists, list_addr, mdfile)
    #    mdfile.close()

    # ...

    # export xde element
    import json
    file = open(ifo_folder + gesname+'.json', mode='w')
    file.write(json.dumps(xde_lists,indent=4))
    file.close()

    end   = time()
    print ('parsing time: {}s'.format(end-start))