Пример #1
0
def executeParallelPreprocessor(p,subds):

    out={}
    out['no_of_subds']=str(subds)

    parent = tool.getToolWindow()

    set_Parallel_Preprocess_Data(x=out,p=p)

    os.chdir(out['path'])

    if subds < 2:
       quickui.error(message='Number of subdomains are less than 2. Unable to Execute.')
       raise ValueError
    
    metis=os.path.join(const.home,"Third_Party/METIS/kmetis")

    if not metis:
       quickui.error(message='KMETIS not found. Unable to proceed')
       raise RuntimeError

    if os.path.exists(out['subd_dir']):
       msg="Subdomain Directory "+out['subd_dir']+" is already available. Do you want to overwrite?."
       subd=quickui.question(message=msg)
       if subd == -8:
	  shutil.rmtree(out['subd_dir'])
       else:
          return
 
    if out['graphfile'].endswith('.gz'):
       out['graphfile']=unzip_File(out['graphfile'])
      
    quickui.runWithProgressDialog(parent, "METIS", executeMetis, pulse=True, output=out)

    if int(out['zip_opt']):
       quickui.runWithProgressDialog(parent, "Zipping", zip_File, pulse=True, key='graphfile',output=out)
       #zip_File(key='graphfile',output=out,task=None)

    if not os.path.isfile(out['partfile']):
       quickui.error(message='Unable to create part file.')
       raise IOError

    if int(out['zip_opt']):
       quickui.runWithProgressDialog(parent, "Zipping", zip_File, pulse=True, key='partfile',output=out)
       #out['partfile']=zip_File(out['partfile'])


    if not os.path.isfile(out['cellzone_file']):
       quickui.error(message='cellzone.dat file not found in project directory. Unable to proceed.')
       raise IOError
 
    os.mkdir(out['subd_dir'])

    if not os.path.exists(out['subd_dir']):
       msg="Unable to create Subdomain Directory "+out['subd_dir']+"."
       subd=quickui.info(message=msg)
       raise OSError("Unable to create Subdomain Directory")
            
    os.chdir(out['subd_dir'])

    quickui.runWithProgressDialog(parent, "FEP", executeFEP, pulse=False,output=out)

    ps=re.compile(('SUBDOMAIN.'))

    slist=os.listdir(os.getcwd())
    lst=[]
    for item in slist:
       if re.match(ps,item):
          lst.append(item)

    if len(lst) != int(out['no_of_subds']):
       quickui.error(message='Unable to create SUBDOMAINS.')
       shutil.rmtree(out['subd_dir'])
       raise IOError

    os.chdir(out['cexepath'])