Beispiel #1
0
    def execute(this, arguments, WORKINGMATRIX):
        filename = arguments[0]
        form = None
        if len(arguments) == 2:
            form = arguments[1]
        else:
            form = load.loader.extrapolateFormat(None, arguments[0])


        if form not in ['bxf', 'hercm', 'mat', 'mtx', 'valcol']:
            print("ERROR: file format {0} not supported".format(form))
    
        libHercmIO.writeMatrix(filename, form, WORKINGMATRIX)
Beispiel #2
0
def convert(source, destination, sourceFormat, destinationFormat):
    # converts the matrix at source in sourceFormat to destinationFormat
    # then writes out at destination

    if not os.path.exists(source):
        print("ERROR: load from nonexistent path")
        return
    if not os.path.isfile(source):
        print("ERROR: {0} is not a file".format(source))
        return
    HERCMATRIX = libHercmIO.readMatrix(source, sourceFormat)

    HERCMATRIX.verification = libBXF.generateVerificationSum(HERCMATRIX)
    libHercmIO.writeMatrix(destination, destinationFormat, HERCMATRIX)