diff --git a/src/Mod/Fem/Gui/DlgSettingsFemElmer.ui b/src/Mod/Fem/Gui/DlgSettingsFemElmer.ui index 04ec2bd10f..205c3d2e2c 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemElmer.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFemElmer.ui @@ -33,17 +33,20 @@ - + + + + 100 + 0 + + - ElmerGrid + ElmerSolver path - - - - false - + + 0 @@ -69,7 +72,7 @@ - <html><head/><body><p>Leave blank to use default Elmer elmer binary file</p><p><span style=" font-weight:600;">Note:</span> To use multithreading you must specify here<br> the executable variant with the suffix &quot;_mpi&quot;.</p></body></html> + Leave blank to use default ElmerSolver binary file elmerBinaryPath @@ -79,27 +82,21 @@ - - + + + + + 100 + 0 + + - Search in known binary directories - - - true - - - UseStandardGridLocation - - - Mod/Fem/Elmer + ElmerGrid path - - - false - + 0 @@ -135,61 +132,6 @@ - - - - ElmerSolver - - - - - - - Search in known binary directories - - - true - - - UseStandardElmerLocation - - - Mod/Fem/Elmer - - - - - - - false - - - - 100 - 0 - - - - ElmerGrid binary path - - - - - - - false - - - - 100 - 0 - - - - ElmerSolver binary path - - - @@ -198,40 +140,27 @@ Options - - - - - Multithreading - - - - - - - - - true - + + + + + - CPU cores to be used + Number of processes - - - - true + + + + Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter - <html><head/><body><p><span style=" font-weight:600;">Note:</span> It is recommended to use an even number of cores to benefit from mesh symmetries. (Using 8 cores can be faster than 9 cores.)<br/><span style=" font-weight:600;">Note too:</span> In extreme cases ElmerSolver might not converge if the core number is too high.</p></body></html> + Number of parallel tasks. Set to `1` if Elmer does not use MPI.<br>It is recommended to use an even number of cores to benefit from mesh symmetries<br>(Using 8 cores can be faster than 9 cores).<br>In extreme cases ElmerSolver might not converge if the core number is too high. 1 - - 32 - UseNumberOfCores @@ -240,48 +169,27 @@ - - - - Qt::Horizontal + + + + Merge mesh volume regions processed by each CPU core to make boundaries invisible. - - - 40 - 20 - + + Filter results - + + true + + + FilterMultiCPUResults + + + Mod/Fem/Elmer + + - - - - Multi-core CPU support - - - - - - - The mesh volume regions processed by each CPU core -will be merged to make the volume boundaries invisible. - - - Filter results - - - true - - - FilterMultiCPUResults - - - Mod/Fem/Elmer - - - @@ -292,7 +200,7 @@ will be merged to make the volume boundaries invisible. - + Save result in binary format @@ -311,7 +219,7 @@ will be merged to make the volume boundaries invisible. - + Save the index of geometric entities @@ -352,11 +260,6 @@ will be merged to make the volume boundaries invisible. - - Gui::FileChooser - QWidget -
Gui/FileDialog.h
-
Gui::PrefFileChooser Gui::FileChooser @@ -376,70 +279,4 @@ will be merged to make the volume boundaries invisible. - - - cb_grid_binary_std - toggled(bool) - l_grid_binary_path - setDisabled(bool) - - - 247 - 45 - - - 71 - 68 - - - - - cb_grid_binary_std - toggled(bool) - fc_grid_binary_path - setDisabled(bool) - - - 247 - 45 - - - 247 - 68 - - - - - cb_elmer_binary_std - toggled(bool) - fc_elmer_binary_path - setDisabled(bool) - - - 247 - 91 - - - 247 - 114 - - - - - cb_elmer_binary_std - toggled(bool) - l_elmer_binary_path - setDisabled(bool) - - - 247 - 91 - - - 71 - 114 - - - - diff --git a/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.cpp index adbd9ed9f4..a40fa3c9b7 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.cpp +++ b/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.cpp @@ -25,7 +25,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ #include -#include +#include #endif #include "DlgSettingsFemElmerImp.h" @@ -40,56 +40,40 @@ DlgSettingsFemElmerImp::DlgSettingsFemElmerImp(QWidget* parent) { ui->setupUi(this); - // determine number of CPU cores - processor_count = QThread::idealThreadCount(); - ui->sb_elmer_num_cores->setMaximum(processor_count); - connect(ui->fc_grid_binary_path, - &Gui::PrefFileChooser::fileNameChanged, + &Gui::PrefFileChooser::fileNameSelected, this, - &DlgSettingsFemElmerImp::onfileNameChanged); + &DlgSettingsFemElmerImp::onfileNameSelected); connect(ui->fc_elmer_binary_path, - &Gui::PrefFileChooser::fileNameChanged, + &Gui::PrefFileChooser::fileNameSelected, this, - &DlgSettingsFemElmerImp::onfileNameChanged); - connect(ui->fc_elmer_binary_path, - &Gui::PrefFileChooser::fileNameChanged, - this, - &DlgSettingsFemElmerImp::onfileNameChangedMT); - connect(ui->sb_elmer_num_cores, - qOverload(&Gui::PrefSpinBox::valueChanged), - this, - &DlgSettingsFemElmerImp::onCoresValueChanged); + &DlgSettingsFemElmerImp::onfileNameSelected); } DlgSettingsFemElmerImp::~DlgSettingsFemElmerImp() = default; void DlgSettingsFemElmerImp::saveSettings() { - ui->cb_elmer_binary_std->onSave(); ui->fc_elmer_binary_path->onSave(); - - ui->cb_grid_binary_std->onSave(); ui->fc_grid_binary_path->onSave(); - ui->sb_elmer_num_cores->onSave(); - ui->cb_elmer_filtering->onSave(); - ui->ckb_elmer_format->onSave(); - ui->ckb_elmer_geom_id->onSave(); + ui->sb_num_processes->onSave(); + + ui->cb_filtering->onSave(); + ui->ckb_binary_format->onSave(); + ui->ckb_geom_id->onSave(); } void DlgSettingsFemElmerImp::loadSettings() { - ui->cb_elmer_binary_std->onRestore(); ui->fc_elmer_binary_path->onRestore(); - - ui->cb_grid_binary_std->onRestore(); ui->fc_grid_binary_path->onRestore(); - ui->sb_elmer_num_cores->onRestore(); - ui->cb_elmer_filtering->onRestore(); - ui->ckb_elmer_format->onRestore(); - ui->ckb_elmer_geom_id->onRestore(); + ui->sb_num_processes->onRestore(); + + ui->cb_filtering->onRestore(); + ui->ckb_binary_format->onRestore(); + ui->ckb_geom_id->onRestore(); } /** @@ -105,55 +89,10 @@ void DlgSettingsFemElmerImp::changeEvent(QEvent* e) } } -void DlgSettingsFemElmerImp::onfileNameChanged(QString FileName) +void DlgSettingsFemElmerImp::onfileNameSelected(const QString& fileName) { - if (!QFileInfo::exists(FileName)) { - QMessageBox::critical(this, - tr("File does not exist"), - tr("The specified executable\n'%1'\n does not exist!\n" - "Specify another file.") - .arg(FileName)); - } -} - -void DlgSettingsFemElmerImp::onfileNameChangedMT(QString FileName) -{ - ui->sb_elmer_num_cores->setMaximum(processor_count); - - if (ui->sb_elmer_num_cores->value() == 1) { - return; - } - -#if defined(FC_OS_WIN32) - // name ends with "_mpi.exe" - if (!FileName.endsWith(QLatin1String("_mpi.exe"))) { - QMessageBox::warning(this, - tr("FEM Elmer: Not suitable for multithreading"), - tr("Wrong Elmer setting: You use more than one CPU core.\n" - "Therefore an executable with the suffix '_mpi.exe' is required.")); - ui->sb_elmer_num_cores->setValue(1); - ui->sb_elmer_num_cores->setMaximum(1); - return; - } -#elif defined(FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) - // name ends with "_mpi" - if (!FileName.endsWith(QLatin1String("_mpi"))) { - QMessageBox::warning(this, - tr("FEM Elmer: Not suitable for multithreading"), - tr("Wrong Elmer setting: You use more than one CPU core.\n" - "Therefore an executable with the suffix '_mpi' is required.")); - ui->sb_elmer_num_cores->setValue(1); - ui->sb_elmer_num_cores->setMaximum(1); - return; - } -#endif -} - -void DlgSettingsFemElmerImp::onCoresValueChanged(int cores) -{ - if (cores > 1) { - // check if the right executable is loaded - onfileNameChangedMT(ui->fc_elmer_binary_path->fileName()); + if (!fileName.isEmpty() && QStandardPaths::findExecutable(fileName).isEmpty()) { + QMessageBox::critical(this, tr("Elmer"), tr("Executable '%1' not found").arg(fileName)); } } diff --git a/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.h b/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.h index a5b5e11a9b..827dcfe136 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.h +++ b/src/Mod/Fem/Gui/DlgSettingsFemElmerImp.h @@ -41,9 +41,7 @@ public: ~DlgSettingsFemElmerImp() override; protected Q_SLOTS: - void onfileNameChanged(QString FileName); - void onfileNameChangedMT(QString FileName); - void onCoresValueChanged(int cores); + void onfileNameSelected(const QString& fileName); protected: void saveSettings() override;