def accept(self): msg = Translator.translate("Building data...\n") App.Console.PrintMessage(msg) # Get GUI data endTime = self.form.time.value() output = [] output.append(self.form.output.value()) output.append(self.form.outputType.currentIndex()) devId = self.form.device.currentIndex() - 1 # First is not OpenCL # Get OpenCL device device = None count = 0 platforms = cl.get_platforms() for p in platforms: devs = p.get_devices() for d in devs: if count == devId: device = d count = count + 1 # Get free surfaces data FSMesh = SimInstance.FSMesh(self.sim) wData = self.sim.Waves wDir = self.sim.Waves_Dir waves = [] for i in range(0, len(wData)): waves.append([wData[i].x, wData[i].y, wData[i].z, wDir[i]]) msg = Translator.translate("Launching simulation...\n") App.Console.PrintMessage(msg) # Build simulation thread simulator = Sim(device, endTime, output, self.sim, FSMesh, waves) simulator.start() msg = Translator.translate("Done!\n") App.Console.PrintMessage(msg) return True
def accept(self): msg = Translator.translate("Building data...\n") App.Console.PrintMessage(msg) # Get GUI data endTime = self.form.time.value() output = [] output.append(self.form.output.value()) output.append(self.form.outputType.currentIndex()) devId = self.form.device.currentIndex() - 1 # First is not OpenCL # Get OpenCL device device = None count = 0 platforms = cl.get_platforms() for p in platforms: devs = p.get_devices() for d in devs: if count == devId: device = d count = count + 1 # Get free surfaces data FSMesh = SimInstance.FSMesh(self.sim) wData = self.sim.Waves wDir = self.sim.Waves_Dir waves = [] for i in range(0,len(wData)): waves.append([wData[i].x, wData[i].y, wData[i].z, wDir[i]]) msg = Translator.translate("Launching simulation...\n") App.Console.PrintMessage(msg) # Build simulation thread simulator = Sim(device, endTime, output, FSMesh, waves) simulator.start() msg = Translator.translate("Done!\n") App.Console.PrintMessage(msg) return True
def stopSimulation(): try: simulator = Sim() if not simulator.isRunning(): msg = Translator.translate("Simulation already stopped\n") App.Console.PrintWarning(msg) return except: msg = Translator.translate("Any active simulation to stop!\n") App.Console.PrintError(msg) return simulator.stop() msg = Translator.translate("Simulation will stop at the end of actual iteration\n") App.Console.PrintMessage(msg)
def stopSimulation(): try: simulator = Sim() if not simulator.isRunning(): msg = Translator.translate("Simulation already stopped\n") App.Console.PrintWarning(msg) return except: msg = Translator.translate("Any active simulation to stop!\n") App.Console.PrintError(msg) return simulator.stop() msg = Translator.translate( "Simulation will stop at the end of actual iteration\n") App.Console.PrintMessage(msg)
def stopSimulation(): try: simulator = Sim() if not simulator.isRunning(): msg = QtGui.QApplication.translate("ship_console", "Simulation already stopped", None,QtGui.QApplication.UnicodeUTF8) App.Console.PrintWarning(msg + '\n') return except: msg = QtGui.QApplication.translate("ship_console", "Any active simulation to stop", None,QtGui.QApplication.UnicodeUTF8) App.Console.PrintError(msg + '\n') return simulator.stop() msg = QtGui.QApplication.translate("ship_console", "Simulation will stop at the end of actual iteration", None,QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + '\n')
def accept(self): msg = QtGui.QApplication.translate("ship_console", "Building data", None, QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + "...\n") # Get GUI data endTime = self.form.time.value() output = [] output.append(self.form.output.value()) output.append(self.form.outputType.currentIndex()) devId = self.form.device.currentIndex() - 1 # First is not OpenCL # Get OpenCL device device = None count = 0 platforms = cl.get_platforms() for p in platforms: devs = p.get_devices() for d in devs: if count == devId: device = d count = count + 1 # Get free surfaces data FSMesh = SimInstance.FSMesh(self.sim) FSData = (self.sim.L, self.sim.B, self.sim.FS_Nx, self.sim.FS_Ny) wData = self.sim.Waves wDir = self.sim.Waves_Dir waves = [] for i in range(0, len(wData)): waves.append([wData[i].x, wData[i].y, wData[i].z, wDir[i]]) SeaNx = self.sim.Sea_Nx SeaNy = self.sim.Sea_Ny msg = QtGui.QApplication.translate("ship_console", "Launching simulation", None, QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + "...\n") # Build simulation thread simulator = Sim(device, endTime, output, self.sim, FSMesh, FSData, waves, SeaNx, SeaNy) # simulator.start() # Activate me for final release simulator.run( ) # Activate me for development (I will show python fails) msg = QtGui.QApplication.translate("ship_console", "Done", None, QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + "!\n") return True
def accept(self): msg = QtGui.QApplication.translate("ship_console","Building data", None,QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + "...\n") # Get GUI data endTime = self.form.time.value() output = [] output.append(self.form.output.value()) output.append(self.form.outputType.currentIndex()) devId = self.form.device.currentIndex() - 1 # First is not OpenCL # Get OpenCL device device = None count = 0 platforms = cl.get_platforms() for p in platforms: devs = p.get_devices() for d in devs: if count == devId: device = d count = count + 1 # Get free surfaces data FSMesh = SimInstance.FSMesh(self.sim) FSData = (self.sim.L,self.sim.B,self.sim.FS_Nx,self.sim.FS_Ny) wData = self.sim.Waves wDir = self.sim.Waves_Dir waves = [] for i in range(0,len(wData)): waves.append([wData[i].x, wData[i].y, wData[i].z, wDir[i]]) SeaNx = self.sim.Sea_Nx SeaNy = self.sim.Sea_Ny msg = QtGui.QApplication.translate("ship_console","Launching simulation", None,QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + "...\n") # Build simulation thread simulator = Sim(device, endTime, output, self.sim, FSMesh, FSData, waves, SeaNx, SeaNy) simulator.start() # Activate me for final release # simulator.run() # Activate me for development (i will show python fails) msg = QtGui.QApplication.translate("ship_console","Done", None,QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + "!\n") return True
def stopSimulation(): try: simulator = Sim() if not simulator.isRunning(): msg = QtGui.QApplication.translate("ship_console", "Simulation already stopped", None, QtGui.QApplication.UnicodeUTF8) App.Console.PrintWarning(msg + '\n') return except: msg = QtGui.QApplication.translate("ship_console", "Any active simulation to stop", None, QtGui.QApplication.UnicodeUTF8) App.Console.PrintError(msg + '\n') return simulator.stop() msg = QtGui.QApplication.translate( "ship_console", "Simulation will stop at the end of actual iteration", None, QtGui.QApplication.UnicodeUTF8) App.Console.PrintMessage(msg + '\n')