Esempio n. 1
0
    def postprocess(self, state, output):
        def parseMesh(meshfile=None, output={}, task=None):
            task.set_text("Parsing mesh")
            p = mshparser.MeshParser(meshfile)
            output['parser'] = p
            
        wizard.Wizpage.postprocess(self, state, output)
        state['mshfile'] = output[self.pageid]['mshfile']
        x = {}
        status = quickui.runWithProgressDialog(state['parent'], "Progress", parseMesh, pulse=True, meshfile=state['mshfile'], output=x)
	if not status:
	   raise IOError('Unable to parse msh file.')

	p = x['parser']
        zones = p.getFaceZones()
        cellzones = p.getCellZones()
	dimension = p.getDimention()

        bcs = [(z['name'], z['bc'], z['id']) for z in zones]
        fluidbcs =  [(z['name'],z['bc'], z['id']) for z in cellzones]
	output.update(BcSelectPage=dict(bcs=bcs))
        state['fluidbcs'] = fluidbcs
        output['allbcs'] = bcs + fluidbcs
	state['bcs'] = output['BcSelectPage']['bcs']
        state['mshval'] = reduce(lambda x,y: x and y, [z['bc'] for z in zones], True)
	output['dimension'] = dimension
Esempio n. 2
0
def checkOutputFile(out={},key=None,status=False,errmsg=None):
    parent=tool.getToolWindow()

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

    if not status or (not os.path.isfile(out[key]) and not os.path.isfile(out[key]+'.gz') ):
       quickui.error(message=errmsg)
       raise IOError(errmsg)
Esempio n. 3
0
def processExecution(parent=None,label=None,exe=None,pulse=True,errmsg=None,out={}):

    status = quickui.runWithProgressDialog(parent,label,exe,pulse=pulse,output=out)
    
    for item in exeValList[exe.func_name]:
       checkOutputFile(out=out,key=item,status=status,errmsg=errmsg)
Esempio n. 4
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'])