def toCoviseCaseFile(self, cocaseDir): #cocaseDir is path to which the file will be saved theCase = CoviseCaseFile() for node in self._rootNode.children(): part = self._idPartMap[node.key()] item = None #name of data itemName = part.filename.lstrip('/').split('/') itemName.reverse() itemName = itemName[0] relPath = self.toShortPath(cocaseDir, os.path.dirname(part.filename)) relPath = relPath + itemName if '2D' == part.type: item = CoviseCaseFileItem(part.name, GEOMETRY_2D, relPath) elif '3D' == part.type: item = CoviseCaseFileItem(part.name, GEOMETRY_3D, relPath) else: assert False for cnode in node.children(): cpart = self._idPartMap[cnode.key()] relPath = self.toShortPath(cocaseDir, os.path.dirname(cpart.filename)) partName = cpart.filename.lstrip('/').split('/') partName.reverse() partName = partName[0] relPath = relPath+partName if 'S' == cpart.type: item.addVariableAndFilename( cpart.name, relPath, SCALARVARIABLE) if 'V' == cpart.type: item.addVariableAndFilename( cpart.name, relPath, VECTOR3DVARIABLE) theCase.add(item) return theCase
def convert(self, domainname, domainchoice, processGrid, processBoundaries): # write logfile self.logFile.write("\nprocessing %s\n"%(domainname)) self.logFile.flush() text = "\nprocessing %s"%(domainname) self.statusText.append(text) # reset wait variable self.scalar_dataGetterAction.resetWait() self.vector_dataGetterAction.resetWait() self.boundary_scalar_dataGetterAction.resetWait() # select the domain self.ReadCfx_1.set_domains( domainchoice ) # wait for choices to be updated by the module self.scalar_dataGetterAction.waitForChoices() self.vector_dataGetterAction.waitForChoices() self.boundary_scalar_dataGetterAction.waitForChoices() # read chocies scalarVariablesTuple = self.scalar_dataGetterAction.getChoices() vectorVariablesTuple = self.vector_dataGetterAction.getChoices() scalarVariables = {} vectorVariables = {} #first choice is none varChoice = 2 for svar in scalarVariablesTuple: if not 'boundary' in svar: scalarVariables[varChoice] = svar varChoice += 1 varChoice = 2 for vvar in vectorVariablesTuple: if not 'boundary' in vvar: vectorVariables[varChoice] = vvar varChoice += 1 #get boundaries from message if processBoundaries: boundaries = self.aBoundaryCollectorAction.getBoundaryNames(domainname) else: boundaries = [] # # CONVERT GRID # # connect grid gridPort = (self.ReadCfx_1, "GridOut0") if (self.scale != 1.0): theNet.connect( gridPort[0], gridPort[1], self.Transform_1, "geo_in" ) gridPort = (self.Transform_1, "geo_out") if (self.mirror != 0): theNet.connect( gridPort[0], gridPort[1], self.Transform_2, "geo_in" ) gridPort = (self.Transform_2, "geo_out") if (self.rotAngle != 0.0): theNet.connect( gridPort[0], gridPort[1], self.Transform_3, "geo_in" ) gridPort = (self.Transform_3, "geo_out") theNet.connect( gridPort[0], gridPort[1], self.RWCovise_1, "mesh_in" ) # set variables to None self.ReadCfx_1.set_scalar_data( 1 ) self.ReadCfx_1.set_vector_data( 1 ) self.ReadCfx_1.set_boundary_scalar_data( 1 ) covisename = domainname + "-3D.covise" # create the cocase file item item3D = None if processGrid: self.ReadCfx_1.set_readGrid('True') item3D = CoviseCaseFileItem(domainname, GEOMETRY_3D, covisename) # write logfile self.logFile.write("\n\tconverting grid %s ...\n"%(domainname)) self.logFile.flush() text = "\n\tconverting grid "+ domainname + " ..." self.statusText.append( text ) # clean the domainname if "/" in domainname: self.logFile.write("\t! Attention: Replacing the / in domainname = %s\n"%(domainname,)) self.logFile.flush() text = "\t! Attention: Replacing the / in domainname = "+ domainname self.statusText.append(text) domainname=domainname.replace("/","per") if "\x7f" in domainname: self.logFile.write("\t! Attention: Replacing a special character in domainname = %s\n"%(domainname,)) self.logFile.flush() text = "\t! Attention: Removing a special character in domainname = "+ domainname self.statusText.append(text) domainname=domainname.replace("\x7f","_") # create the RWCovise name self.RWCovise_1.set_grid_path( self.outputFilePath + '/' +covisename ) # execute self.ReadCfx_1.execute() theNet.finishedBarrier() # write logfile self.logFile.write("\t... conversion successful! File: %s\n"%(covisename,)) self.logFile.flush() text = "\t... conversion successful! File: "+covisename self.statusText.append(text) # disconnect grid theNet.disconnectAllFromModule(self.ReadCfx_1) theNet.disconnectAllFromModule(self.RWCovise_1) if (self.scale != 1.0): theNet.disconnectAllFromModule(self.Transform_1) if (self.mirror != 0): theNet.disconnectAllFromModule(self.Transform_2) if (self.rotAngle != 0.0): theNet.disconnectAllFromModule(self.Transform_3) self.ReadCfx_1.set_readGrid("False") else: self.ReadCfx_1.set_readGrid('False') item3D = CoviseCaseFileItem(domainname, GEOMETRY_3D, covisename) for item in self.cocase.items_: text = "name "+item.name_ self.statusText.append( text) text = "covisename "+domainname self.statusText.append( text) if item.name_ == domainname: item3D = item break self.ReadCfx_1.execute() theNet.finishedBarrier() timesteps = self.timestepsGetterAction.getInt() if timesteps == 0: timesteps = None # # CONVERT BOUNDARIES # # workaround for bug in readCFX, some parts are not convertes correctly, # but "all" parts are allways correct, therefore we use all parts # and extract the parts with GetSubset item2D={} if processBoundaries: self.ReadCfx_1.set_readBoundaries("True") # # RWCovise # self.RWCovise_2.set_stepNo( 0 ) self.RWCovise_2.set_rotate_output( "FALSE" ) self.RWCovise_2.set_rotation_axis( 3 ) self.RWCovise_2.set_rot_speed( 2.000000 ) # connect boundaries outPort = (self.ReadCfx_1, "GridOut2") if timesteps==None: theNet.connect( outPort[0], outPort[1], self.GetSubset_1, "DataIn0" ) theNet.connect( self.GetSubset_1, "DataOut0", self.FixUsg_1, "GridIn0" ) outPort = (self.FixUsg_1, "GridIn0") if self.reduce: theNet.connect( outPort[0], outPort[1], self.SimplifySurface_1, "meshIn" ) outPort = (self.SimplifySurface_1, "meshOut") if (self.scale != 1.0): theNet.connect( outPort[0], outPort[1], self.Transform_1, "geo_in" ) outPort = (self.Transform_1, "geo_out") if (self.mirror != 0): theNet.connect( outPort[0], outPort[1], self.Transform_2, "geo_in" ) outPort = (self.Transform_2, "geo_out") if (self.rotAngle != 0.0): theNet.connect( outPort[0], outPort[1], self.Transform_3, "geo_in" ) outPort = (self.Transform_3, "geo_out") theNet.connect( outPort[0], outPort[1], self.RWCovise_2, "mesh_in" ) subset=0 boundchoice=1 for boundname in boundaries: boundchoice = int(boundaries[boundname]) self.ReadCfx_1.set_BoundarySelection(str(boundchoice)) # ommit names "None" "all" #boundchoice+=1 if int(boundchoice) > 0 : # write logfile self.logFile.write("\n\tconverting surface %s ...\n"%(boundname,)) self.logFile.flush() text = "\n\tconverting surface %s ..."%(boundname,) self.statusText.append( text) bname=boundname # clean boundname if "/" in boundname: self.logFile.write("\t! Attention: Replacing the / in boundname = %s\n"%(boundname,)) self.logFile.flush() text = "\t! Attention: Replacing the / in boundname = "+ boundname self.statusText.append( text) bname=boundname.replace("/","per") if "\x7f" in boundname: self.logFile.write("\t! Attention: Replacing a special character in boundname = %s\n"%(boundname,)) self.logFile.flush() text = "\t! Attention: Replacing a special character in boundname = ", boundname self.statusText.append( text) bname=boundname.replace("\x7f","_") # set the subset self.GetSubset_1.set_selection( str(0) ) # create RWCovise name bname = bname.replace(' ','_') covisename = domainname + "-boundary-" + bname + "-2D.covise" self.RWCovise_2.set_grid_path( self.outputFilePath + '/' +covisename ) # execute self.ReadCfx_1.execute() #if timesteps==None: # GetSubset_1.execute() #else : # GetSetelem_1.set_stepNo(1) # GetSetelem_1.execute() theNet.finishedBarrier() # write logfile self.logFile.write("\t... conversion successful! Filen: %s\n"%(covisename,)) self.logFile.flush() text = "\t... conversion successful! File: "+covisename self.statusText.append( text) # create cocase item item2D[boundname] = CoviseCaseFileItem(domainname + "-" + bname, GEOMETRY_2D, covisename) subset+=1 # disconnect boundaries theNet.disconnectAllFromModule(self.ReadCfx_1) theNet.disconnectAllFromModule(self.RWCovise_2) if self.reduce: theNet.disconnectAllFromModule(self.SimplifySurface_1) if timesteps==None: theNet.disconnectAllFromModule(self.GetSubset_1) theNet.disconnectAllFromModule(self.FixUsg_1) if (self.scale != 1.0): theNet.disconnectAllFromModule(self.Transform_1) if (self.mirror != 0): theNet.disconnectAllFromModule(self.Transform_2) if (self.rotAngle != 0.0): theNet.disconnectAllFromModule(self.Transform_3) #theNet.remove( RWCovise_2 ) #theNet.remove( GetSubset_1 ) #theNet.remove( FixUsg_1 ) #if not timesteps==None: # theNet.remove( GetSetelem_1 ) # theNet.remove( self.PipelineCollect_1 ) # # CONVERT SCALAR VARIABLES # # connect the 3D scalar data theNet.connect( self.ReadCfx_1, "DataOut0", self.RWCovise_1, "mesh_in" ) # loop through the scalar variables # select the variable, ommit variable "none" countVar = 0 for varchoice in scalarVariables: svar = scalarVariables[varchoice] #bsvar = boundScalarVariables[varchoice] # convert only the first numVariables variables countVar += 1 #if ( fixresult=="None" and int(varchoice) < (int(self.numVariables)+2) ) or svar==fixresult : if countVar <= self.numVariables : # # CONVERT SCALAR VARIABLES OF GRID # self.logFile.write("\n\tconverting scalar variable %s on grid %s...\n"%(svar,domainname)) self.logFile.flush() text = "\n\tconverting scalar variable "+ svar + " on grid " + domainname + "..." self.statusText.append( text) # clean variablename if "/" in svar: self.logFile.write("\t! Attention: Replacing the / in svar = %s\n"%(svar,)) self.logFile.flush() text = "\t! Attention: Replacing the / in svar = "+ svar self.statusText.append( text) svar=svar.replace("/","per") if "\x7f" in svar: self.logFile.write("\t! Attention: Replacing a special character in svar = %s\n"%(svar,)) self.logFile.flush() text = "\t! Attention: Replacing a special character in svar = "+ svar self.statusText.append( text) svar=svar.replace("\x7f","_") # select variable self.ReadCfx_1.set_scalar_data( varchoice ) self.ReadCfx_1.set_boundary_scalar_data( varchoice ) self.ReadCfx_1.set_readGrid("false") covisename = domainname + "-" + svar + "-3D.covise" #create RWCovise name self.RWCovise_1.set_grid_path( self.outputFilePath + '/' +covisename ) # execute self.ReadCfx_1.execute() theNet.finishedBarrier() # write logile self.logFile.write("\t... conversion successful! Filename: %s\n"%(covisename,)) self.logFile.flush() text = "\t... conversion successful! Filename: "+covisename self.statusText.append( text) # add variable to cocase item item3D.addVariableAndFilename(svar, covisename, SCALARVARIABLE) # # CONVERT SCALAR VARIABLES OF BOUNDARIES # if processBoundaries: # # RWCovise # self.RWCovise_2.set_stepNo( 0 ) self.RWCovise_2.set_rotate_output( "FALSE" ) self.RWCovise_2.set_rotation_axis( 3 ) self.RWCovise_2.set_rot_speed( 2.000000 ) # connect the boundary scalar data gridPort = (self.ReadCfx_1, "GridOut2") dataPort = (self.ReadCfx_1, "DataOut3") if timesteps==None: theNet.connect( gridPort[0], gridPort[1], self.GetSubset_1, "DataIn0" ) theNet.connect( dataPort[0], dataPort[1], self.GetSubset_1, "DataIn1" ) theNet.connect( self.GetSubset_1, "DataOut0", self.FixUsg_1, "GridIn0" ) theNet.connect( self.GetSubset_1, "DataOut1", self.FixUsg_1, "DataIn0" ) gridPort = (self.FixUsg_1, "GridOut0") dataPort = (self.FixUsg_1, "DataOut0") if self.reduce: theNet.connect( gridPort[0], gridPort[1], self.SimplifySurface_1, "meshIn") theNet.connect( dataPort[0], dataPort[1], self.SimplifySurface_1, "dataIn_0") gridPort = (self.SimplifySurface_1, "meshOut") dataPort = (self.SimplifySurface_1, "dataOut_0") theNet.connect( dataPort[0], dataPort[1], self.RWCovise_2, "mesh_in" ) subset=0 boundchoice=1 for boundname in boundaries: boundchoice = int(boundaries[boundname]) self.ReadCfx_1.set_BoundarySelection(str(boundchoice)) # ommit names "None" "all" #boundchoice+=1 if int(boundchoice) > 0 : self.logFile.write("\n\tconverting scalar variable %s on surface %s %d...\n"%(svar,boundname, boundchoice)) self.logFile.flush() text = "\n\tconverting scalar variable "+ svar + " on surface " + boundname + "..." self.statusText.append( text) bname=boundname # clean boundname if "/" in boundname: self.logFile.write("\t! Attention: Replacing the / in boundname = %s\n"%(boundname,)) self.logFile.flush() text = "\t! Attention: Replacing the / in boundname = "+ boundname self.statusText.append( text) bname=boundname.replace("/","per") if "\x7f" in boundname: self.logFile.write("\t! Attention: Replacing a special character in boundname = %s\n"%(boundname,)) self.logFile.flush() text = "\t! Attention: Replacing a special character in boundname = "+ boundname self.statusText.append( text) bname=boundname.replace("\x7f","_") # clean variablename if "/" in svar: self.logFile.write("\t! Attention: Replacing the / in svar = %s\n"%(svar,)) self.logFile.flush() text = "\t! Attention: Replacing the / in svar = "+ svar self.statusText.append( text) svar=svar.replace("/","per") if "\x7f" in svar: self.logFile.write("\t! Attention: Replacing a special character in svar = %s\n"%(svar,)) self.logFile.flush() text = "\t! Attention: Replacing a special character in svar = "+ svar self.statusText.append( text) svar=svar.replace("\x7f","_") text = "\t! new svar = ", svar self.statusText.append( text) # set the subset self.GetSubset_1.set_selection( str(0) ) # create RWCovise name bname = bname.replace(' ', '_') svar = svar.replace(' ', '_') covisename = domainname + "-boundary-" + bname + "-" + svar + "-2D.covise" self.RWCovise_2.set_grid_path( self.outputFilePath + '/' +covisename ) # execute self.ReadCfx_1.execute() #if timesteps==None: # self.ReadCfx_1.execute() #else : # self.GetSetelem_1.set_stepNo(1) # self.GetSetelem_1.execute() theNet.finishedBarrier() # write logfile self.logFile.write("\t... conversion successful: Filename %s\n"%(covisename,)) self.logFile.flush() text = "\t... conversion successful: "+covisename self.statusText.append( text) # append variable to cocase item if boundname in item2D: item2D[boundname].addVariableAndFilename(svar, covisename, SCALARVARIABLE) subset+=1 # disconnect the boundaries gridPort = (self.ReadCfx_1, "GridOut2") dataPort = (self.ReadCfx_1, "DataOut3") if timesteps==None: theNet.disconnect( gridPort[0], gridPort[1], self.GetSubset_1, "DataIn0" ) theNet.disconnect( dataPort[0], dataPort[1], self.GetSubset_1, "DataIn1" ) theNet.disconnect( self.GetSubset_1, "DataOut0", self.FixUsg_1, "GridIn0" ) theNet.disconnect( self.GetSubset_1, "DataOut1", self.FixUsg_1, "DataIn0" ) gridPort = (self.FixUsg_1, "GridOut0") dataPort = (self.FixUsg_1, "DataOut0") if self.reduce: theNet.disconnect( gridPort[0], gridPort[1], self.SimplifySurface_1, "meshIn") theNet.disconnect( dataPort[0], dataPort[1], self.SimplifySurface_1, "dataIn_0") gridPort = (self.SimplifySurface_1, "meshOut") dataPort = (self.SimplifySurface_1, "dataOut_0") theNet.disconnect( dataPort[0], dataPort[1], self.RWCovise_2, "mesh_in" ) #theNet.remove( RWCovise_2 ) #theNet.remove( GetSubset_1 ) #theNet.remove( FixUsg_1 ) #if not timesteps==None: # theNet.remove( GetSetelem_1 ) # theNet.remove( self.PipelineCollect_1 ) # disconnect the grid theNet.disconnect( self.ReadCfx_1, "DataOut0", self.RWCovise_1, "mesh_in" ) # # convert the vector variables # # read no boundaries self.ReadCfx_1.set_readBoundaries( "False" ) if (self.scale == 1.0) and (self.mirror == 0) and (self.rotAngle == 0.0): self.ReadCfx_1.set_readGrid("false") else: self.ReadCfx_1.set_readGrid("true") # connect the modules gridPort = (self.ReadCfx_1, "GridOut0") dataPort = (self.ReadCfx_1, "DataOut1") if (self.scale != 1.0): theNet.connect( gridPort[0], gridPort[1], self.Transform_1, "geo_in" ) theNet.connect( dataPort[0], dataPort[1], self.Transform_1, "data_in0" ) gridPort = (self.Transform_1, "geo_out") dataPort = (self.Transform_1, "data_out0") if (self.mirror != 0): theNet.connect( gridPort[0], gridPort[1], self.Transform_2, "geo_in" ) theNet.connect( dataPort[0], dataPort[1], self.Transform_2, "data_in0" ) gridPort = (self.Transform_2, "geo_out") dataPort = (self.Transform_2, "data_out0") if (self.rotAngle != 0.0): theNet.connect( gridPort[0], gridPort[1], self.Transform_3, "geo_in" ) theNet.connect( dataPort[0], dataPort[1], self.Transform_3, "data_in0" ) gridPort = (self.Transform_3, "geo_out") dataPort = (self.Transform_3, "data_out0") theNet.connect( dataPort[0], dataPort[1], self.RWCovise_1, "mesh_in" ) # loop though the variables # ommit variable "none" countVar = 0 for varchoice in vectorVariables: vvar = vectorVariables[varchoice] # select only the first numVariables variables #if ( fixresult=="None" and int(varchoice) < (int(numVariables)+2) ) or vvar==fixresult : countVar +=1 if countVar <= self.numVariables : self.logFile.write("\n\tconverting vector variable %s ...\n"%(vvar,)) self.logFile.flush() text = "\n\tconverting vector variable "+ vvar + " ..." self.statusText.append( text) # clean variablename if "/" in vvar: self.logFile.write("\t! Attention: Replacing the / in vvar = %s\n"%(vvar,)) self.logFile.flush() text = "\t! Attention: Replacing the / in vvar = "+ vvar self.statusText.append( text) vvar=vvar.replace("/","per") if "\x7f" in vvar: self.logFile.write("\t! Attention: Replacing a special character in vvar = %s\n"%(vvar,)) self.logFile.flush() text = "\t! Attention: Replacing a special character in vvar = "+ vvar self.statusText.append( text) vvar=vvar.replace("\x7f","_") text = "\t! new vvar = ", vvar self.statusText.append( text) # select variable self.ReadCfx_1.set_vector_data( varchoice ) # create RWCovise name covisename = domainname + "-" + vvar + "-3D.covise" self.RWCovise_1.set_grid_path(self.outputFilePath + '/' + covisename ) # execute self.ReadCfx_1.execute() theNet.finishedBarrier() # write logfile self.logFile.write("\t... conversion successful! Filename: %s\n"%(covisename,)) self.logFile.flush() text = "\t... conversion successful! Filename: "+covisename self.statusText.append( text) # append variable to cocase item item3D.addVariableAndFilename(vvar, covisename, VECTOR3DVARIABLE) # disconnect the modules theNet.disconnectAllFromModule(self.ReadCfx_1) theNet.disconnectAllFromModule(self.RWCovise_1) if (self.scale != 1.0): theNet.disconnectAllFromModule(self.Transform_1) if (self.mirror != 0): theNet.disconnectAllFromModule(self.Transform_2) if (self.rotAngle != 0.0): theNet.disconnectAllFromModule(self.Transform_3) # # add Grid to coCase # if processGrid: # add to cocase self.cocase.add(item3D) # add the boundary item do the case file if processBoundaries: for boundname in boundaries: # ommit names "None" "all" boundchoice = int(boundaries[boundname]) if int(boundchoice) > 0 : self.calculatePDYN(item2D[boundname]) self.cocase.add(item2D[boundname])
name = getName(bifname) RWCovise3DGrid.set_grid_path(covFile3Dgrid) RWCovise2DGrid.set_grid_path(covFile2Dgrid) if bofname: RWCovise3DData.set_grid_path(covFile3Ddata) RWCovise2DData.set_grid_path(covFile2Ddata) runMap() theNet.finishedBarrier() # 3D item3D = None if os.access(covFile3Dgrid, os.F_OK): if (os.path.getsize(covFile3Dgrid) >= MIN_FILESIZE): # valid file item3D = CoviseCaseFileItem(name, GEOMETRY_3D, covFile3Dgrid) cocase.add(item3D) else: os.remove(covFile3Dgrid) if os.access(covFile3Ddata, os.F_OK): if bofname and (os.path.getsize(covFile3Ddata) >= MIN_FILESIZE): # valid file if item3D: item3D.addVariableAndFilename(variable, covFile3Ddata, SCALARVARIABLE) else: os.remove(covFile3Ddata) # 2D item2D = None if os.access(covFile2Dgrid, os.F_OK): if (os.path.getsize(covFile2Dgrid) >= MIN_FILESIZE):
def startConversionOf2DParts(self): #print "__________START 2D---------" for partid in self.aPartsCollectorAction.getRefNameDict2dParts().keys(): partname = self.aPartsCollectorAction.getRefNameDict2dParts()[partid] # write logfile text="\nConverting surface of part %s, please be patient..."%(partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # connect modules if self.scale!=1: theNet.connect( self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in" ) theNet.connect( self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in" ) else: theNet.connect( self.ReadEnsight_1, "geoOut_2D", self.RWCovise_1, "mesh_in" ) # select part self.ReadEnsight_1.set_choose_parts( str(partid) ) # clean partname if "/" in partname: text="! Removing the / in partname = %s\n"%(partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname=partname.replace("/","") # create RWCovise name covisename = self.outputFilePath + partname + "-2D.covise" counter=0 while os.path.isfile(covisename): text="! A file named %s is already available trying a new name"%(covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter=counter+1 covisename = self.outputFilePath + partname + str(counter) + "-2D.covise" self.RWCovise_1.set_grid_path( covisename ) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text="Converted surface of part %s to file %s"%(partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # create cocase item item2D = CoviseCaseFileItem(partname, GEOMETRY_2D, os.path.basename(covisename)) # disconnect the modules if self.scale !=1: theNet.disconnect( self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in" ) theNet.disconnect( self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in" ) else: theNet.disconnect( self.ReadEnsight_1, "geoOut_2D", self.RWCovise_1, "mesh_in" ) # # scalar variables # # connect modules if self.scale!=1: theNet.connect( self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in" ) theNet.connect( self.ReadEnsight_1, "sdata1_2D", self.Transform_1, "data_in0" ) theNet.connect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.connect( self.ReadEnsight_1, "sdata1_2D", self.RWCovise_1, "mesh_in" ) choice=1 for svar in self.scalarVariables2D: # select variable choice+=1 text="\nConverting scalar variable %s of part %s, please be patient..."%(svar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() self.ReadEnsight_1.set_data_for_sdata1_2D( choice ) # clean variablename if "/" in partname: text="! Removing the / in partname = %s\n"%(partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname=partname.replace("/","") # create RWCovise name covisename = self.outputFilePath + partname + "-" + svar + "-2D.covise" counter=0 while os.path.isfile(covisename): text="! A file named %s is already available ... trying a new name"%(covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter=counter+1 covisename = self.outputFilePath + partname + str(counter) + "-" + svar + "-2D.covise" self.RWCovise_1.set_grid_path( covisename ) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text="Converted scalar variable %s of part %s to file %s"%(svar, partname, covisename,) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add variable to cicase item item2D.addVariableAndFilename(svar, covisename, SCALARVARIABLE) # print memory usage of module #os.system('ps aux | grep ReadEnsight_1') # disconnect modules if self.scale!=1: theNet.disconnect( self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in" ) theNet.disconnect( self.ReadEnsight_1, "sdata1_2D", self.Transform_1, "data_in0" ) theNet.disconnect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.disconnect( self.ReadEnsight_1, "sdata1_2D", self.RWCovise_1, "mesh_in" ) # vector variables # connect modules if self.scale!=1: theNet.connect( self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in" ) theNet.connect( self.ReadEnsight_1, "vdata1_2D", self.Transform_1, "data_in0" ) theNet.connect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.connect( self.ReadEnsight_1, "vdata1_2D", self.RWCovise_1, "mesh_in" ) choice=1 for vvar in self.vectorVariables2D: # select variable choice+=1 text="\nConverting vector variable %s of part %s, please be patient..."%(vvar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() self.ReadEnsight_1.set_data_for_vdata1_2D( choice ) # clean partname if "/" in partname: text="! Removing the / in partname = %s\n"%(partname,) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname=partname.replace("/","") # create RWCovise name covisename = self.outputFilePath + partname + "-" + vvar + "-2D.covise" counter=0 while os.path.isfile(covisename): text="! A file named %s is already available ... trying a new name"%(covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter=counter+1 covisename = self.outputFilePath + partname + str(counter) + "-" + vvar + "-2D.covise" self.RWCovise_1.set_grid_path( covisename ) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text="Converted vector variable%s of part %s to file %s"%(vvar, partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add varibale to coscase item item2D.addVariableAndFilename(vvar, covisename, VECTOR3DVARIABLE) # disconnect modules if self.scale!=1: theNet.disconnect( self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in" ) theNet.disconnect( self.ReadEnsight_1, "vdata1_2D", self.Transform_1, "data_in0" ) theNet.disconnect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.disconnect( self.ReadEnsight_1, "vdata1_2D", self.RWCovise_1, "mesh_in" ) # add the cocase item to the case file self.cocase.add(item2D)
def startConversionOf3DParts(self): for partid in self.aPartsCollectorAction.getRefNameDict3dParts().keys(): #if int(partid) >= int(self.comboStartId.getCurrentIndex()): # get partname partname = self.aPartsCollectorAction.getRefNameDict3dParts()[partid] text = "\nConverting grid of part %s please be patient..."%(partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # connect modules if self.scale != 1: theNet.connect( self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in" ) theNet.connect( self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in" ) else: theNet.connect( self.ReadEnsight_1, "geoOut_3D", self.RWCovise_1, "mesh_in" ) # select part self.ReadEnsight_1.set_choose_parts( str(partid) ) # clean partname if "/" in partname: text="! Removing the / in partname = %s\n"%(partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname=partname.replace("/","") # create RW Covise name covisename = self.outputFilePath +partname + "-3D.covise" # check if file is already available #print "rwcovisename=", covisename counter=0 while os.path.isfile(covisename): text= "! A file named %s is already available ... trying a new name"%(covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter=counter+1 covisename = self.outputFilePath + partname + str(counter) + "-3D.covise" QtWidgets.QApplication.processEvents() self.RWCovise_1.set_grid_path( covisename ) QtWidgets.QApplication.processEvents() # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() #theNet.save( "grid.net" ) # write logfile text="Converted grid of part %s to covise file %s"%(partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # create cocase item item3D = CoviseCaseFileItem(partname, GEOMETRY_3D, os.path.basename(covisename)) # disconnect modules if self.scale !=1: theNet.disconnect( self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in" ) theNet.disconnect( self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in" ) else: theNet.disconnect(self. ReadEnsight_1, "geoOut_3D", self.RWCovise_1, "mesh_in" ) QtWidgets.QApplication.processEvents() # scalar variables # connect modules if self.scale!=1: theNet.connect( self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in" ) theNet.connect( self.ReadEnsight_1, "sdata1_3D", self.Transform_1, "data_in0" ) theNet.connect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.connect( self.ReadEnsight_1, "sdata1_3D", self.RWCovise_1, "mesh_in" ) # loop over scalar variables choice=1 for svar in self.scalarVariables3D: text= "\nConverting scalar variable %s of part %s, please be patient..."%(svar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # select variable choice+=1 self.ReadEnsight_1.set_data_for_sdata1_3D( choice ) # clean variablename if "/" in svar: text="! Removing the / in svar = %s\n"%(svar,) statusText.append(text) QtWidgets.QApplication.processEvents() svar=svar.replace("/","") # create RWCovise name covisename = self.outputFilePath + partname + "-" + svar + "-3D.covise" # check if file is already available counter=0 while os.path.isfile(covisename): text="! A file named %s is already available ... trying a new name"%(covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter=counter+1 covisename = self.outputFilePath + partname + str(counter) + "-" + svar + "-3D.covise" self.RWCovise_1.set_grid_path( covisename ) QtWidgets.QApplication.processEvents() # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text="Converted scalar variable %s of part %s to file %s"%(svar, partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add variable to cacase item item3D.addVariableAndFilename(svar, covisename, SCALARVARIABLE) #theNet.save( "scalar.net" ) # disconnect modules if self.scale!=1: theNet.disconnect( self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in" ) theNet.disconnect( self.ReadEnsight_1, "sdata1_3D", self.Transform_1, "data_in0" ) theNet.disconnect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.disconnect( self.ReadEnsight_1, "sdata1_3D", self.RWCovise_1, "mesh_in" ) QtWidgets.QApplication.processEvents() # vector variables # connect modules if self.scale!=1: theNet.connect( self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in" ) theNet.connect( self.ReadEnsight_1, "vdata1_3D", self.Transform_1, "data_in0" ) theNet.connect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.connect( self.ReadEnsight_1, "vdata1_3D", self.RWCovise_1, "mesh_in" ) # loop over variables choice=1 for vvar in self.vectorVariables3D: text= "\nConverting vector variable %s of part %s, please be patient..."%(vvar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # select variable choice+=1 self.ReadEnsight_1.set_data_for_vdata1_3D( choice ) # clean variablename if "/" in vvar: text="! Removing the / in vvar = %s\n"%(vvar,) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname=partname.replace("/","") # create covisename covisename = self.outputFilePath + partname + "-" + vvar + "-3D.covise" # check if file is already available counter=0 while os.path.isfile(covisename): text="! A file named %s is already available trying a new name"%(covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter=counter+1 covisename = self.outputFilePath + partname + str(counter) + "-" + vvar + "-3D.covise" self.RWCovise_1.set_grid_path( covisename ) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text="Converted vector variable%s of part %s to file %s"%(vvar,partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add variable to cocase item item3D.addVariableAndFilename(vvar, covisename, VECTOR3DVARIABLE) # disconnect modules if self.scale!=1: theNet.disconnect( self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in" ) theNet.disconnect( self.ReadEnsight_1, "vdata1_3D", self.Transform_1, "data_in0" ) theNet.disconnect( self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in" ) else: theNet.disconnect( self.ReadEnsight_1, "vdata1_3D",self. RWCovise_1, "mesh_in" ) # add the cocase item to the case file self.cocase.add(item3D) QtWidgets.QApplication.processEvents()
def startConversionOf2DParts(self): #print "__________START 2D---------" for partid in self.aPartsCollectorAction.getRefNameDict2dParts().keys( ): partname = self.aPartsCollectorAction.getRefNameDict2dParts( )[partid] # write logfile text = "\nConverting surface of part %s, please be patient..." % ( partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # connect modules if self.scale != 1: theNet.connect(self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in") theNet.connect(self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in") else: theNet.connect(self.ReadEnsight_1, "geoOut_2D", self.RWCovise_1, "mesh_in") # select part self.ReadEnsight_1.set_choose_parts(str(partid)) # clean partname if "/" in partname: text = "! Removing the / in partname = %s\n" % (partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname = partname.replace("/", "") # create RWCovise name covisename = self.outputFilePath + partname + "-2D.covise" counter = 0 while os.path.isfile(covisename): text = "! A file named %s is already available trying a new name" % ( covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter = counter + 1 covisename = self.outputFilePath + partname + str( counter) + "-2D.covise" self.RWCovise_1.set_grid_path(covisename) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text = "Converted surface of part %s to file %s" % (partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # create cocase item item2D = CoviseCaseFileItem(partname, GEOMETRY_2D, os.path.basename(covisename)) # disconnect the modules if self.scale != 1: theNet.disconnect(self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in") theNet.disconnect(self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in") else: theNet.disconnect(self.ReadEnsight_1, "geoOut_2D", self.RWCovise_1, "mesh_in") # # scalar variables # # connect modules if self.scale != 1: theNet.connect(self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in") theNet.connect(self.ReadEnsight_1, "sdata1_2D", self.Transform_1, "data_in0") theNet.connect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.connect(self.ReadEnsight_1, "sdata1_2D", self.RWCovise_1, "mesh_in") choice = 1 for svar in self.scalarVariables2D: # select variable choice += 1 text = "\nConverting scalar variable %s of part %s, please be patient..." % ( svar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() self.ReadEnsight_1.set_data_for_sdata1_2D(choice) # clean variablename if "/" in partname: text = "! Removing the / in partname = %s\n" % (partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname = partname.replace("/", "") # create RWCovise name covisename = self.outputFilePath + partname + "-" + svar + "-2D.covise" counter = 0 while os.path.isfile(covisename): text = "! A file named %s is already available ... trying a new name" % ( covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter = counter + 1 covisename = self.outputFilePath + partname + str( counter) + "-" + svar + "-2D.covise" self.RWCovise_1.set_grid_path(covisename) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text = "Converted scalar variable %s of part %s to file %s" % ( svar, partname, covisename, ) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add variable to cicase item item2D.addVariableAndFilename(svar, covisename, SCALARVARIABLE) # print memory usage of module #os.system('ps aux | grep ReadEnsight_1') # disconnect modules if self.scale != 1: theNet.disconnect(self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in") theNet.disconnect(self.ReadEnsight_1, "sdata1_2D", self.Transform_1, "data_in0") theNet.disconnect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.disconnect(self.ReadEnsight_1, "sdata1_2D", self.RWCovise_1, "mesh_in") # vector variables # connect modules if self.scale != 1: theNet.connect(self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in") theNet.connect(self.ReadEnsight_1, "vdata1_2D", self.Transform_1, "data_in0") theNet.connect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.connect(self.ReadEnsight_1, "vdata1_2D", self.RWCovise_1, "mesh_in") choice = 1 for vvar in self.vectorVariables2D: # select variable choice += 1 text = "\nConverting vector variable %s of part %s, please be patient..." % ( vvar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() self.ReadEnsight_1.set_data_for_vdata1_2D(choice) # clean partname if "/" in partname: text = "! Removing the / in partname = %s\n" % (partname, ) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname = partname.replace("/", "") # create RWCovise name covisename = self.outputFilePath + partname + "-" + vvar + "-2D.covise" counter = 0 while os.path.isfile(covisename): text = "! A file named %s is already available ... trying a new name" % ( covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter = counter + 1 covisename = self.outputFilePath + partname + str( counter) + "-" + vvar + "-2D.covise" self.RWCovise_1.set_grid_path(covisename) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text = "Converted vector variable%s of part %s to file %s" % ( vvar, partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add varibale to coscase item item2D.addVariableAndFilename(vvar, covisename, VECTOR3DVARIABLE) # disconnect modules if self.scale != 1: theNet.disconnect(self.ReadEnsight_1, "geoOut_2D", self.Transform_1, "geo_in") theNet.disconnect(self.ReadEnsight_1, "vdata1_2D", self.Transform_1, "data_in0") theNet.disconnect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.disconnect(self.ReadEnsight_1, "vdata1_2D", self.RWCovise_1, "mesh_in") # add the cocase item to the case file self.cocase.add(item2D)
def startConversionOf3DParts(self): for partid in self.aPartsCollectorAction.getRefNameDict3dParts().keys( ): #if int(partid) >= int(self.comboStartId.getCurrentIndex()): # get partname partname = self.aPartsCollectorAction.getRefNameDict3dParts( )[partid] text = "\nConverting grid of part %s please be patient..." % ( partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # connect modules if self.scale != 1: theNet.connect(self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in") theNet.connect(self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in") else: theNet.connect(self.ReadEnsight_1, "geoOut_3D", self.RWCovise_1, "mesh_in") # select part self.ReadEnsight_1.set_choose_parts(str(partid)) # clean partname if "/" in partname: text = "! Removing the / in partname = %s\n" % (partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname = partname.replace("/", "") # create RW Covise name covisename = self.outputFilePath + partname + "-3D.covise" # check if file is already available #print "rwcovisename=", covisename counter = 0 while os.path.isfile(covisename): text = "! A file named %s is already available ... trying a new name" % ( covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter = counter + 1 covisename = self.outputFilePath + partname + str( counter) + "-3D.covise" QtWidgets.QApplication.processEvents() self.RWCovise_1.set_grid_path(covisename) QtWidgets.QApplication.processEvents() # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() #theNet.save( "grid.net" ) # write logfile text = "Converted grid of part %s to covise file %s" % (partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # create cocase item item3D = CoviseCaseFileItem(partname, GEOMETRY_3D, os.path.basename(covisename)) # disconnect modules if self.scale != 1: theNet.disconnect(self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in") theNet.disconnect(self.Transform_1, "geo_out", self.RWCovise_1, "mesh_in") else: theNet.disconnect(self.ReadEnsight_1, "geoOut_3D", self.RWCovise_1, "mesh_in") QtWidgets.QApplication.processEvents() # scalar variables # connect modules if self.scale != 1: theNet.connect(self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in") theNet.connect(self.ReadEnsight_1, "sdata1_3D", self.Transform_1, "data_in0") theNet.connect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.connect(self.ReadEnsight_1, "sdata1_3D", self.RWCovise_1, "mesh_in") # loop over scalar variables choice = 1 for svar in self.scalarVariables3D: text = "\nConverting scalar variable %s of part %s, please be patient..." % ( svar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # select variable choice += 1 self.ReadEnsight_1.set_data_for_sdata1_3D(choice) # clean variablename if "/" in svar: text = "! Removing the / in svar = %s\n" % (svar, ) statusText.append(text) QtWidgets.QApplication.processEvents() svar = svar.replace("/", "") # create RWCovise name covisename = self.outputFilePath + partname + "-" + svar + "-3D.covise" # check if file is already available counter = 0 while os.path.isfile(covisename): text = "! A file named %s is already available ... trying a new name" % ( covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter = counter + 1 covisename = self.outputFilePath + partname + str( counter) + "-" + svar + "-3D.covise" self.RWCovise_1.set_grid_path(covisename) QtWidgets.QApplication.processEvents() # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text = "Converted scalar variable %s of part %s to file %s" % ( svar, partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add variable to cacase item item3D.addVariableAndFilename(svar, covisename, SCALARVARIABLE) #theNet.save( "scalar.net" ) # disconnect modules if self.scale != 1: theNet.disconnect(self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in") theNet.disconnect(self.ReadEnsight_1, "sdata1_3D", self.Transform_1, "data_in0") theNet.disconnect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.disconnect(self.ReadEnsight_1, "sdata1_3D", self.RWCovise_1, "mesh_in") QtWidgets.QApplication.processEvents() # vector variables # connect modules if self.scale != 1: theNet.connect(self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in") theNet.connect(self.ReadEnsight_1, "vdata1_3D", self.Transform_1, "data_in0") theNet.connect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.connect(self.ReadEnsight_1, "vdata1_3D", self.RWCovise_1, "mesh_in") # loop over variables choice = 1 for vvar in self.vectorVariables3D: text = "\nConverting vector variable %s of part %s, please be patient..." % ( vvar, partname) self.statusText.append(text) QtWidgets.QApplication.processEvents() # select variable choice += 1 self.ReadEnsight_1.set_data_for_vdata1_3D(choice) # clean variablename if "/" in vvar: text = "! Removing the / in vvar = %s\n" % (vvar, ) self.statusText.append(text) QtWidgets.QApplication.processEvents() partname = partname.replace("/", "") # create covisename covisename = self.outputFilePath + partname + "-" + vvar + "-3D.covise" # check if file is already available counter = 0 while os.path.isfile(covisename): text = "! A file named %s is already available trying a new name" % ( covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() counter = counter + 1 covisename = self.outputFilePath + partname + str( counter) + "-" + vvar + "-3D.covise" self.RWCovise_1.set_grid_path(covisename) # execute self.ReadEnsight_1.execute() theNet.finishedBarrier() # write logfile text = "Converted vector variable%s of part %s to file %s" % ( vvar, partname, covisename) self.statusText.append(text) QtWidgets.QApplication.processEvents() # add variable to cocase item item3D.addVariableAndFilename(vvar, covisename, VECTOR3DVARIABLE) # disconnect modules if self.scale != 1: theNet.disconnect(self.ReadEnsight_1, "geoOut_3D", self.Transform_1, "geo_in") theNet.disconnect(self.ReadEnsight_1, "vdata1_3D", self.Transform_1, "data_in0") theNet.disconnect(self.Transform_1, "data_out0", self.RWCovise_1, "mesh_in") else: theNet.disconnect(self.ReadEnsight_1, "vdata1_3D", self.RWCovise_1, "mesh_in") # add the cocase item to the case file self.cocase.add(item3D) QtWidgets.QApplication.processEvents()