bool D3MFExporter::exportArchive( const char *file ) { bool ok( true ); m_zipArchive = zip_open( file, ZIP_DEFAULT_COMPRESSION_LEVEL, 'w' ); if ( nullptr == m_zipArchive ) { return false; } ok |= exportContentTypes(); ok |= export3DModel(); ok |= exportRelations(); zip_close( m_zipArchive ); m_zipArchive = nullptr; return ok; }
BpdeMainWindow::BpdeMainWindow(RInside& R, const QString& sourceFile, QObject *parent) : R(R), sourceFile(sourceFile), x(), y(), H(), solver(NULL) { tempfile = QString::fromStdString(Rcpp::as<std::string>(R.parseEval("tfile <- tempfile()"))); svgfile = QString::fromStdString(Rcpp::as<std::string>(R.parseEval("sfile <- tempfile()"))); QWidget *window = new QWidget; window->setWindowTitle("BpdeGUI"); setCentralWidget(window); QGroupBox *runParameters = new QGroupBox("Параметры запуска"); openMPEnabled = new QRadioButton("&OpenMP"); openClEnabled = new QRadioButton("&OpenCL"); openMPEnabled->setChecked(true); connect(openMPEnabled, SIGNAL(clicked()), this, SLOT(loadSource())); connect(openClEnabled, SIGNAL(clicked()), this, SLOT(loadSource())); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(openMPEnabled); vbox->addWidget(openClEnabled); QLabel *threadsLabel = new QLabel("Количество потоков"); threadsLineEdit = new QLineEdit("4"); QHBoxLayout *threadNumber = new QHBoxLayout; threadNumber->addWidget(threadsLabel); threadNumber->addWidget(threadsLineEdit); QHBoxLayout *deviceLayout = new QHBoxLayout; QLabel *deviceLabel = new QLabel("Устройство"); deviceComboBox = new QComboBox(); scanDevices(); for (std::vector<cl::Device>::iterator it = devices.begin(); it != devices.end(); it++) deviceComboBox->addItem((*it).getInfo<CL_DEVICE_NAME>().c_str()); connect(deviceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSource())); deviceLayout->addWidget(deviceLabel); deviceLayout->addWidget(deviceComboBox); QHBoxLayout* runLayout = new QHBoxLayout; runButton = new QPushButton("Начать вычисления", this); qDebug() << "Connect : " << connect(runButton, SIGNAL(clicked()), this, SLOT(solve())); runLayout->addWidget(runButton); QVBoxLayout* ulLayout = new QVBoxLayout; ulLayout->addLayout(vbox); ulLayout->addLayout(threadNumber); ulLayout->addLayout(deviceLayout); ulLayout->addLayout(runLayout); runParameters->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); runParameters->setLayout(ulLayout); QButtonGroup *kernelGroup = new QButtonGroup; kernelGroup->addButton(openMPEnabled, 0); kernelGroup->addButton(openClEnabled, 1); QGroupBox *solveParamBox = new QGroupBox("Настройки вычислительного метода"); QHBoxLayout *iterationsLayout = new QHBoxLayout; QHBoxLayout *stepLayout = new QHBoxLayout; QLabel *sourceFileLabel = new QLabel("SourceFile"); sourceFileEdit = new QLineEdit(sourceFile); iterationsEdit = new QLineEdit("10000"); stepEdit = new QLineEdit("3600"); QLabel *iterationsLabel = new QLabel("Итерации"); QLabel *stepLabel = new QLabel("Шаг "); QHBoxLayout *exportLayout = new QHBoxLayout; exportImage = new QPushButton("Экспорт изотерм"); export3D = new QPushButton("Экспорт 3D модели"); connect(exportImage, SIGNAL(clicked()), this, SLOT(exportIsoterms())); connect(export3D, SIGNAL(clicked()), this, SLOT(export3DModel())); iterationsLayout->addWidget(iterationsLabel); iterationsLayout->addWidget(iterationsEdit); stepLayout->addWidget(stepLabel); stepLayout->addWidget(stepEdit); exportLayout->addWidget(exportImage); exportLayout->addWidget(export3D); svg = new QSvgWidget(); loadSource(); QVBoxLayout *solveParamLayout = new QVBoxLayout; solveParamLayout->addWidget(sourceFileLabel); solveParamLayout->addWidget(sourceFileEdit); solveParamLayout->addLayout(iterationsLayout); solveParamLayout->addLayout(stepLayout); solveParamLayout->addLayout(exportLayout); solveParamBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); solveParamBox->setLayout(solveParamLayout); QHBoxLayout *upperlayout = new QHBoxLayout; upperlayout->addWidget(runParameters); upperlayout->addWidget(solveParamBox); QHBoxLayout *lowerlayout = new QHBoxLayout; lowerlayout->addWidget(svg); QVBoxLayout *outer = new QVBoxLayout; outer->addLayout(upperlayout); outer->addLayout(lowerlayout); window->setLayout(outer); }