//! [0] QueryMainWindow::QueryMainWindow() : ui_defaultQueries(0) { setupUi(this); new XmlSyntaxHighlighter(findChild<QTextEdit*>("inputTextEdit")->document()); new XmlSyntaxHighlighter(findChild<QTextEdit*>("outputTextEdit")->document()); ui_defaultQueries = findChild<QComboBox*>("defaultQueries"); QMetaObject::connectSlotsByName(this); connect(ui_defaultQueries, SIGNAL(currentIndexChanged(int)), SLOT(displayQuery(int))); loadInputFile(); const QStringList queries(QDir(":/files/", "*.xq").entryList()); int len = queries.count(); for(int i = 0; i < len; ++i) ui_defaultQueries->addItem(queries.at(i)); }
void PairFinder::doWork() { qDebug()<<"started file loading in new thread"; loadInputFile(); std::stringstream ss1, ss2; ss1 << "Offset (nm): "; ss2 << "Offset (px): "; for (int i = 0; i < dimensions; ++i) { ss1 << Offset[i] << " "; ss2 << Offset[i]/NM_PER_PX << " "; } sdm->writeToLogFile(QString::fromStdString(ss1.str())); sdm->writeToLogFile(QString::fromStdString(ss2.str())); if(canceled) { sdm->setStartDemixingButtonEnabled(true); emit finished(); return; } if(fishing_settings.run) { sdm->writeToLogFile("searching optimal offset"); qDebug() << "starting fishing"; /*if(fishing_settings.range > min_maxValues.max_x) { fishing_settings.range = min_maxValues.max_x/10; if(fishing_settings.range > min_maxValues.max_y) fishing_settings.range = min_maxValues.max_y/10; }*/ double minOffsetX = Offset[0]-(fishing_settings.range/2); double minOffsetY = Offset[1]-(fishing_settings.range/2); double maxOffsetX = Offset[0]+(fishing_settings.range/2); double maxOffsetY = Offset[1]+(fishing_settings.range/2); int counterX = 0; int counterY = 0; while(Offset[0]<maxOffsetX) { Offset[0] = minOffsetX + fishing_settings.increment*counterX; while(Offset[1]<maxOffsetY) { Offset[1] = minOffsetY + fishing_settings.increment*counterY; //qDebug() << "current Offset : " << Offset[0] << " " << Offset[1]; FindPairs(true, fishing_settings.subset); counterY++; } Offset[1]=minOffsetY; counterY=0; counterX++; } int index = 0; fishing_run max_pairs; std::vector<fishing_run>::iterator it; for( it = fishing_results.begin(); it != fishing_results.end(); ++it ) { fishing_run current_result = *it; if (index == 0) { max_pairs = current_result; } if(max_pairs.numpairs < current_result.numpairs) max_pairs = current_result; ++index; } std::stringstream ss1, ss2; ss1 << "new Offset (nm): "; ss2 << "new Offset (px): "; for (int i = 0; i < dimensions; ++i) { //new Offset: Offset[i] = max_pairs.getOffset(i); qDebug() << "new Offset : " << Offset[i]; ss1 << Offset[i] << " "; ss2 << Offset[i]/NM_PER_PX << " "; } sdm->writeToLogFile(QString::fromStdString(ss1.str())); sdm->writeToLogFile(QString::fromStdString(ss2.str())); } FindPairs(false); qDebug() << "found " << numpairs << " pairs"; if ( numpairs == 0) { //QMessageBox msgBox; // msgBox.setText(""); // msgBox.critical(0,"SDmixer Error","No pairs found! Please check input file and offset settings."); /*int ret = msgBox.exec(); if(ret == QMessageBox::Ok)*/ emit error("No pairs found! Please check input file and offset settings."); return; } std::ostringstream os; os << "found " << numpairs << " pairs." ; sdm->writeToLogFile(QString::fromStdString(os.str())); if(runGrouping) { qDebug() << "starting grouping"; sdm->writeToLogFile("starting Grouping"); startGrouping(); } sdm->setPF_min_maxValues(min_maxValues); //saveFile(); emit finished(); }
SimManager::SimManager(IOManager &IO, const char *input_file) : _IO(IO), _print_reduced_conf_every(0), _print_energy_every(1000), _restart_step_counter(false) { _start_step = _cur_step = _steps = 0; _IO = IO; // variable to terminate the program; it is checked in the main // loop; if set to 1, the mayn cycle will exit; //void (*termhandler)(int); loadInputFile(&_input, input_file); if(_input.state == ERROR) _IO.die("Caught an error while opening the input file"); char backend_opt[256], backend_prec[256], sim_type[256]; getInputString(&_input, "backend", backend_opt, 1); if(getInputString(&_input, "backend_precision", backend_prec, 0) == KEY_NOT_FOUND) { _IO.log(_IO.LOG_INFO, "Backend precision not speficied, using double"); sprintf(backend_prec, "%s", "double"); } else _IO.log(_IO.LOG_INFO, "Backend precision: %s", backend_prec); if(getInputString(&_input, "sim_type", sim_type, 0) == KEY_NOT_FOUND) { _IO.log(_IO.LOG_INFO, "Simulation type not specified, using MD"); sprintf(sim_type, "%s", "MD"); } else _IO.log(_IO.LOG_INFO, "Simulation type: %s", sim_type); // I know that this is really ugly but I couldn't find a better way if(!strcmp(sim_type, "MD")) { if(!strcmp(backend_opt, "CPU")) { if(!strcmp(backend_prec, "double")) _backend = new MD_CPUBackend<double>(&_IO); else if(!strcmp(backend_prec, "float")) _backend = new MD_CPUBackend<float>(&_IO); else _IO.die("Backend precision '%s' is not supported", backend_prec); } #ifndef NOCUDA else if(!strcmp(backend_opt, "CUDA")) { // what's the list type we want to use? char list_type[256]; // LR_double4 is defined in CUDAUtils.h if(!strcmp(backend_prec, "double")) { if(getInputString(&_input, "CUDA_list", list_type, 0) == KEY_NOT_FOUND || !strcmp("no", list_type)) _backend = new MD_CUDABackend<double, LR_double4, CUDANoList<double, LR_double4> >(&_IO); else if(!strcmp("verlet", list_type)) _backend = new MD_CUDABackend<double, LR_double4, CUDASimpleVerletList<double, LR_double4> >(&_IO); else _IO.die("CUDA_list '%s' is not supported", list_type); } else if(!strcmp(backend_prec, "float")) { if(getInputString(&_input, "CUDA_list", list_type, 0) == KEY_NOT_FOUND || !strcmp("no", list_type)) _backend = new MD_CUDABackend<float, float4, CUDANoList<float, float4> >(&_IO); else if(!strcmp("verlet", list_type)) _backend = new MD_CUDABackend<float, float4, CUDASimpleVerletList<float, float4> >(&_IO); else _IO.die("CUDA_list '%s' is not supported", list_type); } else if(!strcmp(backend_prec, "mixed")) { if(getInputString(&_input, "CUDA_list", list_type, 0) == KEY_NOT_FOUND || !strcmp("no", list_type)) _backend = new CUDAMixedBackend<CUDANoList<float, float4> >(&_IO); else if(!strcmp("verlet", list_type)) _backend = new CUDAMixedBackend<CUDASimpleVerletList<float, float4> >(&_IO); else _IO.die("CUDA_list '%s' is not supported", list_type); } else _IO.die("Backend precision '%s' is not supported", backend_prec); } #endif else _IO.die("Backend '%s' not supported", backend_opt); } else if(!strcmp(sim_type, "MC")) { if(!strcmp(backend_opt, "CPU")) { if(!strcmp(backend_prec, "double")) _backend = new MC_CPUBackend<double>(&_IO); else if(!strcmp(backend_prec, "float")) _backend = new MC_CPUBackend<float>(&_IO); else _IO.die("Backend precision '%s' is not supported", backend_prec); } #ifndef NOCUDA else if(!strcmp(backend_opt, "CUDA")) { // what's the list type we want to use? char list_type[256]; // LR_double4 is defined in CUDAUtils.h if(!strcmp(backend_prec, "double")) { if(getInputString(&_input, "CUDA_list", list_type, 0) == KEY_NOT_FOUND || !strcmp("no", list_type)) _backend = new MC_CUDABackend<double, LR_double4, CUDANoList<double, LR_double4> >(&_IO); else if(!strcmp("verlet", list_type)) _backend = new MC_CUDABackend<double, LR_double4, CUDASimpleVerletList<double, LR_double4> >(&_IO); else _IO.die("CUDA_list '%s' is not supported", list_type); } else if(!strcmp(backend_prec, "float")) { if(getInputString(&_input, "CUDA_list", list_type, 0) == KEY_NOT_FOUND || !strcmp("no", list_type)) _backend = new MC_CUDABackend<float, float4, CUDANoList<float, float4> >(&_IO); else if(!strcmp("verlet", list_type)) _backend = new MC_CUDABackend<float, float4, CUDASimpleVerletList<float, float4> >(&_IO); else _IO.die("CUDA_list '%s' is not supported", list_type); } else _IO.die("Backend precision '%s' is not supported", backend_prec); } #endif else _IO.die("Backend '%s' not supported", backend_opt); } else _IO.die("Simulation type '%s' not supported", sim_type); }