BlrSpherical::BlrSpherical( scfgp* cfg, jetGeometry* r, electrons* ele, std::string id ) : externalRadiationSpherical( cfg, r, ele, id ) { /* request parameters */ cfg -> request<double>( id+"q1", 1.0, &q1 ); cfg -> request<double>( id+"q2", 1.0, &q2 ); cfg -> request<double>( id+"r", 0.0, &rext ); //!!! cfg -> request<double>("mBH",1.0,&mBH); cfg -> request<double>("eDisk",0.1,&eDisk); cfg -> request<double>("mDot",1.0,&mDot); cfg -> request<double>("Gamma",10.0,&Gamma); cfg -> updateRequests( ); if( rext == 0.0 ) { setRadius( ); } else { bazinga::warning(id,"Overwritting rext value from config file!"); } vpMin = 0.01*DSQR( ele -> getGammaMin() )*getvext( rext ); vpMax = 100.0*DSQR( ele -> getGammaMax() )*getvext( rext ); allocateUpe( ); allocateLpv( ); allocateLvPoint( ); allocateLvPointAvg( ); for( int i=0;i<N;i++ ) { set_vp( i, vpMin*pow( vpMax/vpMin,(double)i/((double)N-1)) ); } }
proxynode::proxynode(index gid, index parent_gid, index model_id, index vp) : Node() { set_gid_(gid); Subnet* parent = dynamic_cast<Subnet*>(network()->get_node(parent_gid)); assert(parent); set_parent_(parent); set_model_id(model_id); set_vp(vp); set_frozen_(true); }
proxynode::proxynode( index gid, index parent_gid, index model_id, index vp ) : Node() { set_gid_( gid ); Subnet* parent = dynamic_cast< Subnet* >( kernel().node_manager.get_node( parent_gid ) ); assert( parent ); set_parent_( parent ); set_model_id( model_id ); set_vp( vp ); set_frozen_( true ); }
BlrSphericalGu::BlrSphericalGu( scfgp* cfg, jetGeometry* r, electrons* ele, std::string id ) : externalRadiationGu( cfg, r, ele, id ) { /* requested parameters */ cfg -> request<double>(id + "e", 10.0, &e ); cfg -> request<double>(id + "cf", 0.1, &cf ); cfg -> request<double>(id + "rext", 0.0, &rext ); cfg -> request<double>(id + "k", 3.0, &k ); cfg -> updateRequests( ); if( rext == 0.0 ) { setRadius( ); } else { bazinga::warning(id,"Overwritting rext value from config file!"); } vpMin = 0.01*DSQR( ele -> getGammaMin( ) )*getvext( r->getRMax() ); vpMax = 100.0*DSQR( ele -> getGammaMax( ) )*getvext( r->getR0() ); allocateUpeR( ); // this is for storing vector information about Upe(r) allocateLpv( ); allocateLvPoint( ); allocateLvPointAvg( ); for( int i=0;i<N;i++ ) { set_vp( i, vpMin*pow( vpMax/vpMin,(double)i/((double)N-1)) ); } }
int bwdpi_main(int argc, char **argv) { //dbg("[bwdpi] argc=%d, argv[0]=%s, argv[1]=%s, argv[2]=%s\n", argc, argv[0], argv[1], argv[2]); int c; char *mode = NULL, *name = NULL, *dura = NULL, *date = NULL; char *MAC = NULL; char *page = NULL; int clean_flag = 0; if (argc == 1){ printf("Usage :\n"); printf(" bwdpi [iqos/qosd/wrs] [start/stop/restart]\n"); printf(" bwdpi dc [start/stop/restart] [ptah]\n"); printf(" bwdpi stat -m [mode] -n [name] -u [dura] -d [date]\n"); printf(" bwpdi history -m [MAC] -z -p [page]\n"); printf(" bwpdi app [0/1]\n"); printf(" bwpdi cc [0/1]\n"); printf(" bwpdi vp [0/1]\n"); printf(" bwpdi device -m [MAC]\n"); printf(" bwpdi device_info -m [MAC]\n"); printf(" bwpdi get_vp [0/2]\n"); printf(" bwpdi wrs_url\n"); printf(" bwpdi rewrite path1 path2 path3\n"); printf(" bwpdi checksize path size\n"); printf(" bwpdi extract path\n"); printf(" bwpdi get_app_patrol\n"); printf(" bwpdi get_anomaly [0/2]\n"); return 0; } if (!strcmp(argv[1], "iqos")){ if(argc != 3) { printf(" bwdpi iqos [start/stop/restart]\n"); return 0; } else { return tm_qos_main(argv[2]); } } else if (!strcmp(argv[1], "qosd")){ if(argc != 3) { printf(" bwdpi qosd [start/stop/restart]\n"); return 0; } else { return qosd_main(argv[2]); } } else if (!strcmp(argv[1], "wrs")){ if(argc != 3) { printf(" bwdpi wrs [start/stop/restart]\n"); return 0; } else { return wrs_main(argv[2]); } } else if (!strcmp(argv[1], "stat")){ while ((c = getopt(argc, argv, "m:n:u:d:h")) != -1) { switch(c) { case 'm': mode = optarg; break; case 'n': name = optarg; break; case 'u': dura = optarg; break; case 'd': date = optarg; break; case 'h': show_help(argv[1]); break; default: printf("ERROR: unknown option %c\n", c); break; } } //dbg("[bwdpi] mode=%s, name=%s, dura=%s, date=%s\n", mode, name, dura, date); return stat_main(mode, name, dura, date); } else if (!strcmp(argv[1], "history")){ while ((c = getopt(argc, argv, "m:zp:")) != -1) { switch(c) { case 'm': MAC = optarg; clean_flag = 0; break; case 'z': printf("clear web history\n"); clean_flag = 1; break; case 'p': page = optarg; break; default: printf(" bwpdi history -m [MAC] -z -p [page]\n"); break; } } if(clean_flag) { return clear_user_domain(); } else { return web_history_main(MAC, page); } } else if (!strcmp(argv[1], "app")){ if(argc != 3) { printf(" bwpdi app [0/1]\n"); return 0; } else { return wrs_app_main(argv[2]); } } else if (!strcmp(argv[1], "cc")){ if(argc != 3) { printf(" bwpdi cc [0/1]\n"); return 0; } else { return set_cc(argv[2]); } } else if (!strcmp(argv[1], "vp")){ if(argc != 3) { printf(" bwpdi vp [0/1]\n"); return 0; } else { return set_vp(argv[2]); } } else if (!strcmp(argv[1], "dc")){ if(argc == 3) { return data_collect_main(argv[2], NULL); } else if(argc == 4) { return data_collect_main(argv[2], argv[3]); } else { printf(" bwpdi dc [start/stop/restart] [path]\n"); return 0; } } else if (!strcmp(argv[1], "device")){ while ((c = getopt(argc, argv, "m:")) != -1) { switch(c) { case 'm': name = optarg; break; default: printf(" bwpdi device -m [MAC]\n"); break; } } return device_main(name); } else if (!strcmp(argv[1], "device_info")){ while ((c = getopt(argc, argv, "m:")) != -1) { switch(c) { case 'm': name = optarg; break; default: printf(" bwpdi device_info -m [MAC]\n"); break; } } return device_info_main(name); } else if (!strcmp(argv[1], "get_vp")){ if(argc != 3) { printf(" bwpdi get_vp [0/2]\n"); return 0; } else { return get_vp(argv[2]); } } else if (!strcmp(argv[1], "wrs_url")){ if(argc != 2) { printf(" bwpdi wrs_url\n"); return 0; } else { return wrs_url_main(); } } else if (!strcmp(argv[1], "rewrite")){ if(argc != 5) { printf(" bwpdi rewrite path1 path2 path3\n"); return 0; } else { return rewrite_main(argv[2], argv[3], argv[4]); } } else if (!strcmp(argv[1], "checksize")){ if(argc != 4) { printf(" bwpdi checksize path size\n"); return 0; } else { return check_filesize_main(argv[2], argv[3]); } } else if (!strcmp(argv[1], "extract")){ if(argc != 3) { printf(" bwpdi extract path\n"); return 0; } else { return extract_data_main(argv[2]); } } else if (!strcmp(argv[1], "get_app_patrol")){ if(argc != 2) { printf(" bwpdi get_app_patrol\n"); return 0; } else { return get_app_patrol_main(); } } else if (!strcmp(argv[1], "get_anomaly")){ if(argc != 3) { printf(" bwpdi get_anomaly [0/2]\n"); return 0; } else { return get_anomaly_main(argv[2]); } } else{ printf("Usage :\n"); printf(" bwdpi [iqos/qosd/wrs] [start/stop/restart]\n"); printf(" bwdpi dc [start/stop/restart] [ptah]\n"); printf(" bwdpi stat -m [mode] -n [name] -u [dura] -d [date]\n"); printf(" bwpdi history -m [MAC] -z -p [page]\n"); printf(" bwpdi app [0/1]\n"); printf(" bwpdi cc [0/1]\n"); printf(" bwpdi vp [0/1]\n"); printf(" bwpdi device -m [MAC]\n"); printf(" bwpdi device_info -m [MAC]\n"); printf(" bwpdi get_vp [0/2]\n"); printf(" bwpdi wrs_url\n"); printf(" bwpdi rewrite path1 path2 path3\n"); printf(" bwpdi checksize path size\n"); printf(" bwpdi extract path\n"); printf(" bwpdi get_app_patrol\n"); printf(" bwpdi get_anomaly [0/2]\n"); return 0; } return 1; }
int main(int argc, char *argv[]) { GLFWwindow* window; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); // OpenGL 3.3, Mac OS X is reported to have some problem. However I don't have Mac to test glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); //set hint to glfwCreateWindow, (target, hintValue) glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); //hint--> window not resizable, explicit use core-profile, opengl version 3.3 // For Mac OS X glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); window = glfwCreateWindow(800, 600, "Simple Example", NULL, NULL); if (!window) { glfwTerminate(); return EXIT_FAILURE; } glfwMakeContextCurrent(window); //set current window as main window to focus // This line MUST put below glfwMakeContextCurrent glewExperimental = GL_TRUE; //tell glew to use more modern technique for managing OpenGL functionality glewInit(); // Enable vsync glfwSwapInterval(1); glProvokingVertex(GL_FIRST_VERTEX_CONVENTION); // Setup input callback glfwSetKeyCallback(window, key_callback); //set key event handler // load shader program program = setup_shader(readfile("flat_vs.txt").c_str(), readfile("flat_fs.txt").c_str()); program1 = setup_shader(readfile("gourand_vs.txt").c_str(), readfile("gourand_fs.txt").c_str()); program2 = setup_shader(readfile("phong_vs.txt").c_str(), readfile("phong_fs.txt").c_str()); program3 = setup_shader(readfile("blin_vs.txt").c_str(), readfile("blin_fs.txt").c_str()); int sun = add_obj(program, "sun.obj","sun.bmp"); int sun1 = add_obj(program1, "sun.obj", "sun.bmp"); int sun2 = add_obj(program2, "sun.obj", "sun.bmp"); int sun3 = add_obj(program3, "sun.obj", "sun.bmp"); glEnable(GL_DEPTH_TEST); // prevent faces rendering to the front while they're behind other faces. glCullFace(GL_BACK); // discard back-facing trangle // Enable blend mode for billboard //glEnable(GL_BLEND); //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //-----------------------------------------------------------setting view point----------------------------------// set_vp(program); set_vp(program1); set_vp(program2); set_vp(program3); //-----------------------------------------------------------end of setting--------------------------------------// //------------------------------------------------------setting viewing position---------------------------------// set_viewPosition(program); set_viewPosition(program1); set_viewPosition(program2); set_viewPosition(program3); //------------------------------------------------------end of setting-------------------------------------------// float last, start; last = start = glfwGetTime(); int fps=0; while (!glfwWindowShouldClose(window)) {//program will keep draw here until you close the window float delta = glfwGetTime() - start; render(); glfwSwapBuffers(window); //swap the color buffer and show it as output to the screen. glfwPollEvents(); //check if there is any event being triggered fps++; if(glfwGetTime() - last > 1.0) { std::cout<<(double)fps/(glfwGetTime()-last)<<std::endl; fps = 0; last = glfwGetTime(); } } releaseObjects(); glfwDestroyWindow(window); glfwTerminate(); return EXIT_SUCCESS; }