void Fft<TimeType>::setLength(size_t length) { if (length_!=length) { length_=length; createPlan(); } }
DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { ui.setupUi(this); ui.dateEdit->setDisplayFormat(getDateFormat()); ui.tableWidget->setTitle(tr("Dive planner points")); ui.tableWidget->setModel(DivePlannerPointsModel::instance()); DivePlannerPointsModel::instance()->setRecalc(true); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this)); ui.cylinderTableWidget->setTitle(tr("Available gases")); ui.cylinderTableWidget->setModel(CylindersModel::instance()); QTableView *view = ui.cylinderTableWidget->view(); view->setColumnHidden(CylindersModel::START, true); view->setColumnHidden(CylindersModel::END, true); view->setColumnHidden(CylindersModel::DEPTH, false); view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this)); connect(ui.cylinderTableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addCylinder_clicked())); connect(ui.tableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addStop())); connect(CylindersModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), GasSelectionModel::instance(), SLOT(repopulate())); connect(CylindersModel::instance(), SIGNAL(rowsInserted(QModelIndex, int, int)), GasSelectionModel::instance(), SLOT(repopulate())); connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, int, int)), GasSelectionModel::instance(), SLOT(repopulate())); connect(CylindersModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), plannerModel, SIGNAL(cylinderModelEdited())); connect(CylindersModel::instance(), SIGNAL(rowsInserted(QModelIndex, int, int)), plannerModel, SIGNAL(cylinderModelEdited())); connect(CylindersModel::instance(), SIGNAL(rowsRemoved(QModelIndex, int, int)), plannerModel, SIGNAL(cylinderModelEdited())); ui.tableWidget->setBtnToolTip(tr("Add dive data point")); connect(ui.startTime, SIGNAL(timeChanged(QTime)), plannerModel, SLOT(setStartTime(QTime))); connect(ui.dateEdit, SIGNAL(dateChanged(QDate)), plannerModel, SLOT(setStartDate(QDate))); connect(ui.ATMPressure, SIGNAL(valueChanged(int)), this, SLOT(atmPressureChanged(int))); connect(ui.atmHeight, SIGNAL(valueChanged(int)), this, SLOT(heightChanged(int))); connect(DivePlannerPointsModel::instance(), SIGNAL(startTimeChanged(QDateTime)), this, SLOT(setupStartTime(QDateTime))); // Creating (and canceling) the plan connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan())); connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan())); QShortcut *closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), this); connect(closeKey, SIGNAL(activated()), plannerModel, SLOT(cancelPlan())); // This makes shure the spinbox gets a setMinimum(0) on it so we can't have negative time or depth. ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::DEPTH, new SpinBoxDelegate(0, INT_MAX, 1, this)); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::RUNTIME, new SpinBoxDelegate(0, INT_MAX, 1, this)); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::DURATION, new SpinBoxDelegate(0, INT_MAX, 1, this)); ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::CCSETPOINT, new DoubleSpinBoxDelegate(0, 2, 0.1, this)); /* set defaults. */ ui.ATMPressure->setValue(1013); ui.atmHeight->setValue(0); setMinimumWidth(0); setMinimumHeight(0); }
void Fft<TimeType>::run(void) { // make sure you zero pad in both time and frquency // if the user hasn't provided us with enough data size_t timeSize=vTime_.size(); if (timeSize < length_) vTime_.resize(length_,0); size_t numFreqPts = this->getFreqPoints(); if (vFreq_.size()<numFreqPts) vFreq_.resize(numFreqPts,0); if (timePtr_!=&vTime_[0] || freqPtr_!=&vFreq_[0]) createPlan(); fftwf_execute(*plan_); }
void inverse(const GPUMatrixPitched<TSpectralType>& fft_x, GPUMatrixPitched<TSignalType>& x) { // assert that we have no zero-padded lines AGILE_ASSERT(x.getNumColumns() == x.getPitchElements(), StandardException::ExceptionMessage( "FFT of non-aligned matrices not implemented, yet")); // create a plan createPlan(x.getNumRows(), x.getNumColumns()); cufftResult result = cufftExecC2C( m_plan, (typename to_cufft_type<TSpectralType>::type*)fft_x.data(), (typename to_cufft_type<TSignalType>::type*)x.data(), CUFFT_INVERSE); AGILE_ASSERT(result == CUFFT_SUCCESS, StandardException::ExceptionMessage( "Error during FFT procedure")); scale(TSignalType(1./(fft_x.getNumRows() * fft_x.getNumColumns())), x, x); }
void MainWindow::on_startButton_clicked() { row = ui->tableProvider->rowCount(); column = ui->tableCustomer->columnCount(); fillProviders(); fillCustomers(); fillTariff(); if (isClosed()) { createPlan(); findUV(); printUV(); while (!planIsGood()) { findBadCell(); findCycle(); findMinAndBuildNewPlan(); findUV(); printUV(); }; }; printPlan(); }
void mainMenu() { char choice[3] = ""; system("clear"); printf("Select mode: \n"); printf("Manual\t(1)\n"); printf("Load\t(2)\n"); printf("Exit\t(3)\n"); fgets(choice, 2, stdin); if ((strlen(choice)>0) && (choice[strlen(choice) - 1] == '\n')){ choice[strlen(choice) - 1] = '\0'; } fpurge(stdin); system("clear"); switch(choice[0]) { case '1': createPlan(); break; case '2': loadFile(); break; case '3': default: exit(0); } system("clear"); }
void forward(const GPUMatrixPitched<TSignalType>& x, GPUMatrixPitched<TSpectralType>& fft_x) { // A GPU matrix is aligned to CRS_BLOCK_SIZE elements but the CuFFT // takes the elements in a contiguous form in row-major order. Thus, // we can only be sure that the CuFFT works as intended, if the aligned // and the contiguous storage are the same. AGILE_ASSERT(x.getNumColumns() == x.getPitchElements(), StandardException::ExceptionMessage( "FFT of non-aligned matrices not implemented, yet")); // create a plan createPlan(x.getNumRows(), x.getNumColumns()); cufftResult result = cufftExecR2C( m_plan, (typename to_cufft_type<TSignalType>::type*)x.data(), (typename to_cufft_type<TSpectralType>::type*)fft_x.data()); AGILE_ASSERT(result == CUFFT_SUCCESS, StandardException::ExceptionMessage( "Error during FFT procedure")); // scale(TSpectralType(1./std::sqrt(x.getNumRows() * x.getNumColumns())), // fft_x, fft_x); }
void DivePlannerPointsModel::saveDuplicatePlan() { createPlan(true); }
void DivePlannerPointsModel::savePlan() { createPlan(false); }