def run_subcommand(command, options, targets, blade_path, build_dir): if command == 'query' and options.depended: targets = ['.:...'] blade.blade = blade.Blade(targets, blade_path, _WORKING_DIR, build_dir, _BLADE_ROOT_DIR, options, command) # Build the targets blade.blade.load_targets() if options.stop_after == 'load': return 0 blade.blade.analyze_targets() if options.stop_after == 'analyze': return 0 blade.blade.generate() if options.stop_after == 'generate': return 0 # Switch case due to different sub command action = { 'build': build, 'run': run, 'test': test, 'clean': clean, 'query': query }[command] try: returncode = action(options) finally: clear_build_script() return returncode
def main(): os.system("cls") songsdir = "songs" for i in range(math.floor(maxsong / cpucount)): for j in range(1, cpucount + 1): worker = blade.Blade(i * j, nectarine_url, songsdir) worker.start() print("Ripping song {}".format(i * j), end='\r') time.sleep(0.2)
def appStarted(app): app.running = True app.debugMode = False app.maxThreads = 8 app.runThreads = True app.focalLength = 600 app.ticks = 0 app.timerDelay = 1 app.cubes = [] app.polys = [] app.cubeSpeed = 10 #no units app.grid = grid3d.Grid3d(app, app.focalLength) app.blade = blade.Blade(app) app.beatCount = 0 #number of beats a block spawns beforehand app.preSpawnBeats = 4 app.camThreshold = .9 app.cam = camTracker.camTracker() app.playerPos = (0,0) cThread = camThread(1, "camThread", app) cThread.start() app.driver = audioDriver.audioDriver("all") app.totalScore = 0 app.totalCubes = 0 app.goodSlices = 0 app.badSlices = 0 app.sliceErrorRange = (0,0.5) #by how many beats the player can be off app.timeScoreWeight = 20 app.sliceScoreWeight = 20 app.songName = app.app.song app.loadSong() app.sparks = [] app.animationPulse = 0 app.bgColor = (0,0,0) aThread = animationThread("aThread", app) aThread.start()
def main(): """実行用関数.""" # クオータニオンモジュールの初期化. att = attitude.Attitude6DoF() att.omegaBody = [0.0, 0.0 * pi / 180, 0.0 * pi / 180] # ブレードの初期化(複数の翼をつける場合は逐次appendする) blade_pitch = -80.0 Blades = [] Blades.append( blade.Blade( n_elem=10, pos_root=[0.0, 0.06, -0.05], att=[0.0 * pi / 180, blade_pitch * pi / 180, 0.0 * pi / 180], b_len=0.13, c_len=0.1, airfoil=af.NACA0012_181127)) Blades.append( blade.Blade( n_elem=10, pos_root=[0.0, -0.06, -0.05], att=[0.0 * pi / 180, blade_pitch * pi / 180, 180.0 * pi / 180], b_len=0.13, c_len=0.1, airfoil=af.NACA0012_181127)) Blades.append( blade.Blade( n_elem=10, pos_root=[0.06, 0.0, -0.05], att=[0.0 * pi / 180, blade_pitch * pi / 180, 270.0 * pi / 180], b_len=0.13, c_len=0.1, airfoil=af.NACA0012_181127)) Blades.append( blade.Blade( n_elem=10, pos_root=[-0.06, 0.0, -0.05], att=[0.0 * pi / 180, blade_pitch * pi / 180, 90.0 * pi / 180], b_len=0.13, c_len=0.1, airfoil=af.NACA0012_181127)) # 状態量の初期化 x0 = np.zeros((13), dtype=float) x0[0:4] = att.setQuartanionFrom(5.0 * pi / 180, 0.0 * pi / 180, 0.0 * pi / 180) x0[4:7] = att.omegaBody # x0[7:10]: position of the model x0[10:13] = att.velocityBody t0 = 0.0 tf = 2.0 dt = 0.0001 F = np.array([0.0, 0.0, 0]) M = np.array([0.0, 0.0, 0]) # ODEの設定 solver = ode(func).set_integrator('dopri5', method='bdf') solver.set_initial_value(x0, t0) solver.set_f_params(att, solver.y, F, M) x = np.zeros([int((tf - t0) / dt) + 1, 13]) t = np.zeros([int((tf - t0) / dt) + 1, 1]) F_log = np.zeros((int((tf - t0) / dt) + 1, 3)) M_log = np.zeros((int((tf - t0) / dt) + 1, 3)) arrP_log = np.zeros((int((tf - t0) / dt) + 1, len(Blades), 3, 11), dtype=float) # TODO: solver.yのクオータニオン地を正規化しなければならない index = 0 while solver.successful() and solver.t < tf and index < int( (tf - t0) / dt) + 1: solver.integrate(solver.t + dt) x[index] = solver.y t[index] = solver.t print(solver.y) F, M, arrPressures = blade_FM(solver.y, Blades) F_log[index] = F M_log[index] = M arrP_log[index, :, :, :] = arrPressures xt = postProcess(att, solver.y) solver.set_initial_value(xt, solver.t) solver.set_f_params(att, solver.y, F, M) index += 1 x_log = np.hstack((t, x)) F_log = np.hstack((t, F_log)) M_log = np.hstack((t, M_log)) np.save('x_1', x_log) np.save('M_1', M_log) np.save('F_1', F_log) np.save('dist_df', arrP_log)
"""Just some testing.""" from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from base import Base import blade import airfoil import flosim import flosolver engine = create_engine('sqlite:///my_test_db.sqlite3') Session = sessionmaker(bind=engine) session = Session() # Create table Base.metadata.create_all(engine) myblade = blade.Blade() myairfoil = airfoil.Airfoil(airfoil_name='jfoil') airfoil2 = airfoil.Airfoil(airfoil_name='bfoil') myblade.airfoils.append(myairfoil) myblade.airfoils.append(airfoil2) session.add(myblade) session.commit()