代码拉取完成,页面将自动刷新
#!/usr/bin/env python
import fnmatch
import os
import sys
processed = 'output'
f = open("petscoptions.txt", "a")
if(len(sys.argv)!=2):
print 'Usage : python '+sys.argv[0]+' pathToMatrixFiles'
exit(1)
processedMatList = []
for root, dirnames, filenames in os.walk(processed):
for dirname in dirnames:
processedMatList.append(dirname)
matrixFileList = []
vectorFileList = []
for root, dirnames, filenames in os.walk(sys.argv[1].rstrip('/')):
for filename in fnmatch.filter(filenames, '*.dat'):
datafile = os.path.splitext(filename)[0]
datafile = datafile.rsplit("_",1)[0] # remove size
if datafile.endswith("_b") :
print('adding b vector '+datafile)
vectorFileList.append(os.path.join(root, filename))
continue
if datafile in processedMatList :
print('skipping '+datafile)
continue
print 'adding A matrix '+datafile
matrixFileList.append(os.path.join(root, filename))
for matrixFile in matrixFileList:
path = matrixFile.rsplit("/",1)[0]
datafile = matrixFile.replace("/",".")
datafile = datafile.split(".")[-2]
matName = datafile.rsplit("_",1)[0] # remove size
size = datafile.split("x")[-1]
vectorFile = os.path.join(path, matName+'_b_'+size+'.dat')
if vectorFile in vectorFileList :
f.write('-A '+matrixFile+' -b '+vectorFile+'\n')
else :
f.write('-A '+matrixFile+'\n')
f.close()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。