From 91d7e0b8960bca0d7d13694b93cdac7c1c1c5ff6 Mon Sep 17 00:00:00 2001 From: Uwe Date: Sun, 10 Jul 2022 17:14:45 +0200 Subject: [PATCH] [FEM] fix CCX multi-threading bug - in the preferences one could specify more CPU cores than available - also correct a label sine the number of cores are since FC 0.20 used for all CCX solver runs - also remove unnecessary (doubled) slots from the UI file --- src/Mod/Fem/Gui/DlgSettingsFemCcx.ui | 71 ++---------------------- src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp | 8 +++ 2 files changed, 13 insertions(+), 66 deletions(-) diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui index b469faff1d..5c746a293f 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui @@ -7,7 +7,7 @@ 0 0 425 - 640 + 642 @@ -291,7 +291,7 @@ - Number of CPU's to use (Spooles only) + Number of CPU's to use @@ -434,6 +434,9 @@ + + Qt::DefaultContextMenu + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -786,38 +789,6 @@ - - cb_int_editor - toggled(bool) - l_ext_editor - setEnabled(bool) - - - 406 - 65 - - - 148 - 88 - - - - - cb_int_editor - toggled(bool) - fc_ext_editor - setEnabled(bool) - - - 406 - 65 - - - 406 - 88 - - - cb_int_editor toggled(bool) @@ -850,38 +821,6 @@ - - cb_ccx_binary_std - toggled(bool) - l_ccx_binary_path - setEnabled(bool) - - - 406 - 45 - - - 148 - 68 - - - - - cb_ccx_binary_std - toggled(bool) - fc_ccx_binary_path - setEnabled(bool) - - - 406 - 45 - - - 406 - 68 - - - cb_ccx_binary_std toggled(bool) diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp index defb261e8a..f3f5b5ff30 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp @@ -24,6 +24,9 @@ ***************************************************************************/ #include "PreCompiled.h" +#ifndef _PreComp_ +# include +#endif #include @@ -41,6 +44,11 @@ DlgSettingsFemCcxImp::DlgSettingsFemCcxImp(QWidget* parent) // set ranges ui->dsb_ccx_analysis_time->setMaximum(FLOAT_MAX); ui->dsb_ccx_initial_time_step->setMaximum(FLOAT_MAX); + // determine number of CPU cores + auto processor_count = std::thread::hardware_concurrency(); + // hardware check might fail and then returns 0 + if (processor_count > 0) + ui->sb_ccx_numcpu->setMaximum(processor_count); } DlgSettingsFemCcxImp::~DlgSettingsFemCcxImp()