Path: blob/devel/ElmerGUI/Application/src/parallel.cpp
3203 views
/*****************************************************************************1* *2* Elmer, A Finite Element Software for Multiphysical Problems *3* *4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *5* *6* This program is free software; you can redistribute it and/or *7* modify it under the terms of the GNU General Public License *8* as published by the Free Software Foundation; either version 2 *9* of the License, or (at your option) any later version. *10* *11* This program is distributed in the hope that it will be useful, *12* but WITHOUT ANY WARRANTY; without even the implied warranty of *13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *14* GNU General Public License for more details. *15* *16* You should have received a copy of the GNU General Public License *17* along with this program (in file fem/GPL-2); if not, write to the *18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *19* Boston, MA 02110-1301, USA. *20* *21*****************************************************************************/2223/*****************************************************************************24* *25* ElmerGUI parallel control *26* *27*****************************************************************************28* *29* Authors: Mikko Lyly, Juha Ruokolainen and Peter R�back *30* Email: [email protected] *31* Web: http://www.csc.fi/elmer *32* Address: CSC - IT Center for Science Ltd. *33* Keilaranta 14 *34* 02101 Espoo, Finland *35* *36* Original Date: 15 Mar 2008 *37* *38*****************************************************************************/3940#include <QtGui>41#include <iostream>42#include "parallel.h"4344#if WITH_QT5 || WITH_QT645#include <QtWidgets>46#endif4748using namespace std;4950Parallel::Parallel(QWidget *parent)51: QDialog(parent)52{53ui.setupUi(this);5455connect(ui.browseButton, SIGNAL(clicked()),56this, SLOT(browseButtonClicked()));5758connect(ui.defaultsButton, SIGNAL(clicked()),59this, SLOT(defaultsButtonClicked()));6061connect(ui.okButton, SIGNAL(clicked()),62this, SLOT(okButtonClicked()));6364defaultsButtonClicked();6566setWindowIcon(QIcon(":/icons/Mesh3D.png"));6768ui.okButton->setIcon(QIcon::fromTheme("dialog-accept"));69}7071Parallel::~Parallel()72{73}7475void Parallel::browseButtonClicked()76{77QString fileName = QFileDialog::getOpenFileName(this);7879if(fileName.isEmpty())80return;8182ui.parallelExecLineEdit->setText(fileName);83}8485void Parallel::defaultsButtonClicked()86{87ui.parallelActiveCheckBox->setChecked(false);88ui.skipPartitioningCheckBox->setChecked(false);89ui.nofProcessorsSpinBox->setValue(2);9091#ifdef WIN3292ui.parallelExecLineEdit->setText("mpiexec.exe");93ui.parallelArgsLineEdit->setText("-n %n ElmerSolver_mpi.exe");94#else95ui.parallelExecLineEdit->setText("mpirun");96ui.parallelArgsLineEdit->setText("-np %n ElmerSolver_mpi");97#endif9899ui.divideLineEdit->setText("ElmerGrid 2 2 \"%msh\" -partdual -metiskway %n");100ui.mergeLineEdit->setText("echo 'No need to merge VTU files!'");101}102103void Parallel::okButtonClicked()104{105this->close();106}107108void Parallel::appendToProject(QDomDocument *projectDoc, QDomElement *item)109{110projectIO.parentWidget = this;111projectIO.appendToProject(projectDoc, item);112}113114void Parallel::readFromProject(QDomDocument *projectDoc, QDomElement *item)115{116projectIO.parentWidget = this;117projectIO.readFromProject(projectDoc, item);118}119120121