Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/Application/src/parallel.cpp
3203 views
1
/*****************************************************************************
2
* *
3
* Elmer, A Finite Element Software for Multiphysical Problems *
4
* *
5
* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *
6
* *
7
* This program is free software; you can redistribute it and/or *
8
* modify it under the terms of the GNU General Public License *
9
* as published by the Free Software Foundation; either version 2 *
10
* of the License, or (at your option) any later version. *
11
* *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with this program (in file fem/GPL-2); if not, write to the *
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
20
* Boston, MA 02110-1301, USA. *
21
* *
22
*****************************************************************************/
23
24
/*****************************************************************************
25
* *
26
* ElmerGUI parallel control *
27
* *
28
*****************************************************************************
29
* *
30
* Authors: Mikko Lyly, Juha Ruokolainen and Peter R�back *
31
* Email: [email protected] *
32
* Web: http://www.csc.fi/elmer *
33
* Address: CSC - IT Center for Science Ltd. *
34
* Keilaranta 14 *
35
* 02101 Espoo, Finland *
36
* *
37
* Original Date: 15 Mar 2008 *
38
* *
39
*****************************************************************************/
40
41
#include <QtGui>
42
#include <iostream>
43
#include "parallel.h"
44
45
#if WITH_QT5 || WITH_QT6
46
#include <QtWidgets>
47
#endif
48
49
using namespace std;
50
51
Parallel::Parallel(QWidget *parent)
52
: QDialog(parent)
53
{
54
ui.setupUi(this);
55
56
connect(ui.browseButton, SIGNAL(clicked()),
57
this, SLOT(browseButtonClicked()));
58
59
connect(ui.defaultsButton, SIGNAL(clicked()),
60
this, SLOT(defaultsButtonClicked()));
61
62
connect(ui.okButton, SIGNAL(clicked()),
63
this, SLOT(okButtonClicked()));
64
65
defaultsButtonClicked();
66
67
setWindowIcon(QIcon(":/icons/Mesh3D.png"));
68
69
ui.okButton->setIcon(QIcon::fromTheme("dialog-accept"));
70
}
71
72
Parallel::~Parallel()
73
{
74
}
75
76
void Parallel::browseButtonClicked()
77
{
78
QString fileName = QFileDialog::getOpenFileName(this);
79
80
if(fileName.isEmpty())
81
return;
82
83
ui.parallelExecLineEdit->setText(fileName);
84
}
85
86
void Parallel::defaultsButtonClicked()
87
{
88
ui.parallelActiveCheckBox->setChecked(false);
89
ui.skipPartitioningCheckBox->setChecked(false);
90
ui.nofProcessorsSpinBox->setValue(2);
91
92
#ifdef WIN32
93
ui.parallelExecLineEdit->setText("mpiexec.exe");
94
ui.parallelArgsLineEdit->setText("-n %n ElmerSolver_mpi.exe");
95
#else
96
ui.parallelExecLineEdit->setText("mpirun");
97
ui.parallelArgsLineEdit->setText("-np %n ElmerSolver_mpi");
98
#endif
99
100
ui.divideLineEdit->setText("ElmerGrid 2 2 \"%msh\" -partdual -metiskway %n");
101
ui.mergeLineEdit->setText("echo 'No need to merge VTU files!'");
102
}
103
104
void Parallel::okButtonClicked()
105
{
106
this->close();
107
}
108
109
void Parallel::appendToProject(QDomDocument *projectDoc, QDomElement *item)
110
{
111
projectIO.parentWidget = this;
112
projectIO.appendToProject(projectDoc, item);
113
}
114
115
void Parallel::readFromProject(QDomDocument *projectDoc, QDomElement *item)
116
{
117
projectIO.parentWidget = this;
118
projectIO.readFromProject(projectDoc, item);
119
}
120
121