void CSpotsMainDlg::OnBnClickedBtnSizedingbiao() { saveParameter(IDC_TB_Real_WidthMM, "SYS_STANDARD", "Standard_Width_mm"); saveParameter(IDC_TB_Real_LengthMM, "SYS_STANDARD", "Standard_Length_mm"); p_contrller->ResetParameter(); Block::BiaoDing(&p_contrller->block); SettingHelper::AddKey("SYS_STANDARD", "X_mmPerPix", StringHelper::double2string(Block::X_mmPerPix)); SettingHelper::AddKey("SYS_STANDARD", "Y_mmPerPix", StringHelper::double2string(Block::Y_mmPerPix)); }
void lab::simCorr(int runtime) { int *eArray = new int[runtime]; for(double T = Ti; T <= Tf; T += dT) { curSim = new rods(size, (double)1/T, dens); std::cout << std::endl << "Running simulation at " << T << std::endl; std::cout << "Initial energy: " << curSim->getEnergy() << std::endl; std::cout << "I had to wait: " << waitForEquilibrium() << std::endl; std::cout << "Final energy: " << curSim->getEnergy() << " vs "; std::cout << curSim->recalcEnergy() << std::endl; std::cout << std::endl << "Measuring energy..." << std::endl; for(int i = 0; i < runtime; i++) { curSim->run(); eArray[i] = curSim->getEnergy(); } saveParameter("energy", T, eArray, runtime); std::cout << std::endl << "Calculating acfunction..." << std::endl; //calcAcFunction(eArray, runtime, 0); double res = calcAcFunction(eArray, runtime, 1); saveCorrTime(T, res); delete curSim; } delete[] eArray; }
ActionEditor::ActionEditor(QWidget *parent) : QDialog(parent) { topItem = new PredicateItem( Solid::Predicate(), 0 ); rootItem = 0; rootModel = new PredicateModel( topItem, this ); // Prepare the dialog resize( QSize(600, 600) ); // Set a decent initial size // setModal( true ); // Set up the interface ui.setupUi(this); ui.TvPredicateTree->setHeaderHidden( true ); ui.TvPredicateTree->setModel( rootModel ); ui.IbActionIcon->setIconSize( KIconLoader::SizeLarge ); ui.CbDeviceType->addItems( actionData()->interfaceList() ); // Connect up with everything needed -> slot names explain connect( ui.TvPredicateTree, SIGNAL(activated(QModelIndex)), this, SLOT(updateParameter()) ); connect( ui.PbParameterSave, SIGNAL(clicked()), this, SLOT(saveParameter()) ); connect( ui.PbParameterReset, SIGNAL(clicked()), this, SLOT(updateParameter()) ); connect( ui.CbDeviceType, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePropertyList()) ); connect( ui.CbParameterType, SIGNAL(currentIndexChanged(int)), this, SLOT(manageControlStatus()) ); connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &ActionEditor::accept); connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &ActionEditor::reject); if (ui.TvPredicateTree->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) { connect( ui.TvPredicateTree, SIGNAL(clicked(QModelIndex)), this, SLOT(updateParameter()) ); } }
void ActionEditor::accept() { // Save any open parameter changes first... saveParameter(); // Read the data and prepare to save QString iconName = ui.IbActionIcon->icon(); QString actionName = ui.LeActionFriendlyName->text(); QString command = ui.LeActionCommand->text(); QString predicate = predicateString(); // We need to ensure that they are all valid before applying if (iconName.isEmpty() || actionName.isEmpty() || command.isEmpty() || !Solid::Predicate::fromString(predicate).isValid()) { KMessageBox::error(this, i18n("It appears that the action name, command, icon or condition are not valid.\nTherefore, changes will not be applied."), i18n("Invalid action")); return; } // apply the changes if (iconName != activeItem->icon()) { // Has the icon changed? activeItem->setIcon( ui.IbActionIcon->icon() ); // Write the change } if (actionName != activeItem->name()) { // Has the friendly name changed? activeItem->setName( ui.LeActionFriendlyName->text() ); // Write the change } if (command != activeItem->exec()) { // Has the command changed? activeItem->setExec( ui.LeActionCommand->text() ); // Write the change } if (predicate != activeItem->predicate().toString() ) { // Has it changed? activeItem->setPredicate( predicate ); // Write the change } QDialog::accept(); }
void CSpotsMainDlg::ShowHSV(int Hvalue, int Svalue, int Vvalue) { stringstream ss; ss << Hvalue << "," << Svalue << "," << Vvalue; GetDlgItem(IDC_MAIN_HSV)->SetWindowText(StringHelper::string2CString(ss.str())); saveParameter(IDC_MAIN_HSV, "AreaCam", "MainHSVs"); }
void SpotsSurfaceParaSetDlg::OnBnClickedOk() { //#define IDC_CB_LINECANNY2 1070 saveParameter(IDC_CB_LINECANNY, "SURFACE", "Pretreatment_LINE_CANNY"); saveParameter(IDC_CB_LINETHRESH, "SURFACE", "Pretreatment_LINE_THRESH"); saveParameter(IDC_CB_PINHOLETHRESH, "SURFACE", "Pretreatment_CONVEX_PINHOLE"); saveParameter(IDC_CB_MAINGRAY, "SURFACE", "Pretreatment_CONVEX_MAINGRAY"); CButton* pBtn = (CButton*)GetDlgItem(IDC_CB_EnablePretreatment); SettingHelper::AddKey("SURFACE", "Pretreatment_Enable", pBtn->GetCheck()); pBtn = (CButton*)GetDlgItem(IDC_CB_EnableLINE); SettingHelper::AddKey("SURFACE", "LINE_Enable", pBtn->GetCheck()); // TODO: 在此添加控件通知处理程序代码 CDialogEx::OnOK(); }
void lab::simSimple(int runtime, int startMode) { int *eArray = new int[runtime]; char *prevLattice = NULL; for(double T = Ti; T <= Tf; T += dT) { curSim = new rods(size, 1/T, dens, prevLattice); std::cout << std::endl << "Running simulation at " << T << std::endl; std::cout << "Initial energy: " << curSim->getEnergy() << std::endl; for(int i=0; i < runtime; i++) { curSim->run(); eArray[i] = curSim->getEnergy(); } std::cout << "Final energy: " << curSim->getEnergy() << std::endl; std::cout << "M ratio: " << curSim->getMRatio() << std::endl; std::cout << "Av length: " << curSim->getAvLen() << std::endl; std::cout << "Av x length: " << curSim->getAvxLen() << std::endl; std::cout << "Av y length: " << curSim->getAvyLen() << std::endl; std::cout << "rho_x: " << curSim->getRhox() << std::endl; std::cout << "rho_y: " << curSim->getRhoy() << std::endl; #ifdef VERBOSE //write the final state to a file saveState(T); saveParameter("energy", T, eArray, runtime); #endif if(startMode == 1) { char *temp = curSim->getLat(); prevLattice = new char[(size*size)]; for(int n = 0; n < (size * size); n++) { prevLattice[n] = temp[n]; } } delete curSim; } if(prevLattice != NULL) delete[] prevLattice; delete eArray; }
bool CConfigurationFile::CXML::save(std::ostream & os, const std::string & relativeTo) { mPWD = relativeTo; os.imbue(std::locale::classic()); os.precision(16); mpOstream = &os; *mpOstream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; *mpOstream << "<!-- generated with COPASI " << CVersion::VERSION.getVersion() << " (http://www.copasi.org) at " << UTCTimeStamp() << " UTC -->" << std::endl; saveParameter(mConfiguration); return true; }