コード例 #1
0
ファイル: TaskPanel.py プロジェクト: h4ck3rm1k3/FreeCAD
 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
コード例 #2
0
ファイル: TaskPanel.py プロジェクト: RoyOnWheels/FreeCAD
 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
コード例 #3
0
ファイル: TaskPanel.py プロジェクト: RoyOnWheels/FreeCAD
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)
コード例 #4
0
ファイル: TaskPanel.py プロジェクト: h4ck3rm1k3/FreeCAD
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)
コード例 #5
0
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')
コード例 #6
0
ファイル: TaskPanel.py プロジェクト: guilhemdesq/FreeCAD_dev
 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
コード例 #7
0
	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
コード例 #8
0
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')