MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); sr = new SimRunner(); connect(this, SIGNAL(runSim()), sr, SLOT(runSim())); connect(this, SIGNAL(stopSim()), sr, SLOT(stopSim())); connect(sr, SIGNAL(newDataPoints(QVector<double>*,QVector<QVector<double> *>*)), ui->signalPlot, SLOT(onNewDataPoints(QVector<double>*,QVector<QVector<double> *>*))); ui->PWMDutySpinBox->setValue(sr->getPWMDuty()*100); }
int main(int argc, char** argv) { //debug //test_apo(); //return 0; if (argc <= 1) { std::cerr << GINSENG_USAGE_MESSAGE; return 0; } else { std::string command(argv[1]); if (command == "help" || command == "--help") { std::cerr << GINSENG_USAGE_MESSAGE; return 0; } else if (command == "swap") { runSwap(argc -1, argv + 1); } else if (command == "fishhook") { runFishhook(argc-1, argv+1); } else if (command == "sim") { runSim(argc-1, argv+1); } else { std::cerr << GINSENG_USAGE_MESSAGE; return 0; } } }
int main() { pid_t PID; int status; register_sig_handler(); setup(); runSim(); shutdown(); }
main(int argc, char **argv){ // Check for correct input if(argc != 3){ printf("usage: mmu <config_file> <trace_file>\n"); exit(1); } parseConf(&conf , argv[1]); traceStack = new_dllist(); parseTrace(&traceStack, argv[2]); setupSim(&conf, &mmuSim); runSim(&mmuSim, &traceStack); endSim(&mmuSim); }
int _tmain(int argc, _TCHAR* argv[]) { #ifdef _DEBUG printf("RUNNING DEBUG BUILD\n"); #endif //for (int pl = 2; pl <= 8; pl++) runSim(pl, 1000 * 1000 * 1); runSim(3, 1000 * 1000 * 1000); //runSim(9, 1000 * 1000 * 1000); //runSimCompair(9, 1000*1000*1); // done 1000M: 3, 10, // done 200M: 9 char cc; std::cin.get(cc); return 0; }
// Main: Program Entry Point // Responsible for initializing GLFW, OpenGL, OpenCL and running the main loop int main(int argc, char **argv){ GLFWwindow* window; //double time = glfwGetTime(); double loopStart; // GLFW Initialization ---------------------------------------------------------------------- // Set GLFW Error Callback Function glfwSetErrorCallback(error_callback); // Initialize GLFW if (!glfwInit()) exit(EXIT_FAILURE); // Set OpenGL Version (Use 3.3) glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Create Window window = glfwCreateWindow(windowSize[0], windowSize[1], "AttractorCL", NULL, NULL); // Check if window creation failed if (!window){ glfwTerminate(); exit(EXIT_FAILURE); } // Set current OpenGL Context glfwMakeContextCurrent(window); glfwSwapInterval(1); printf("wglGetCurrentDC(): %u\nGLFW DC: %u\n", (unsigned int)wglGetCurrentDC(), (unsigned int)GetDC(GetForegroundWindow())); // Load OpenGL3.3 Extensions (MUST BE AFTER CONTEXT CREATION) if(ogl_LoadFunctions() == ogl_LOAD_FAILED){ glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_FAILURE); } // Set GLFW Functions glfwSetKeyCallback(window, key_callback); glfwSetFramebufferSizeCallback(window, resize); // ------------------------------------------------------------------------------------------ // Initialize OpenGL initGL(); // Initialize OpenCL initCL(); glUseProgram(programGL); glm::mat4 mtx = calcViewTransforms(); GLint uniMtx = glGetUniformLocation(programGL, "mtx"); glUniformMatrix4fv(uniMtx, 1, GL_FALSE, glm::value_ptr(mtx)); glUseProgram(0); runSim(); readBuffer(); runSim(); readBuffer(); // Run main loop, checking the glfwWindowShouldClose flag for termination while (!glfwWindowShouldClose(window)){ loopStart = glfwGetTime(); glfwPollEvents(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); runSim(); glUseProgram(programGL); glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glBindBuffer(GL_ARRAY_BUFFER, bufParticle_GL); glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(Particle), (void*)(sizeof(cl_uint)+3*sizeof(cl_float))); glBindBuffer(GL_ARRAY_BUFFER, bufParticle_GL); glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(Particle), (void*)(sizeof(cl_uint) + 2*sizeof(cl_float4) + 3*sizeof(cl_float))); glDrawArrays(GL_POINTS, 0, NUM_PARTICLES); glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); glUseProgram(0); glFinish(); glfwSwapBuffers(window); //printf("%f\n",1/(glfwGetTime()-loopStart)); } // Free Resources and Exit Program ----- killCL(); killGL(); glfwDestroyWindow(window); glfwTerminate(); return 0; }
void MainWindow::on_actionRunSim_triggered() { ui->actionRunSim->setEnabled(false); ui->actionRunSim->setIcon(QIcon(":/icons/stop_sim_inactive.png")); emit runSim(); }
ToRun::ToRun() { readInInput(); runSim(); countLights(); }