diff --git a/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui b/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui index 6261704dd4..f0c80fb5ca 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFemZ88.ui @@ -6,124 +6,170 @@ 0 0 - 400 - 97 + 423 + 128 Z88 - + - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - Z88 binary - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - QLayout::SetNoConstraint - - - - - - - Search in known binary directories - - - true - - - UseStandardZ88Location - - - Mod/Fem/Z88 - - + + + + 0 + 0 + + + + Qt::LeftToRight + + + Z88 binary + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + false + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Leave blank to use default Z88 z88r binary file + + + z88BinaryPath + + + Mod/Fem/Z88 + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + z88r binary path: + + + + + + + Solver method: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Search in known binary directories + + + true + + + UseStandardZ88Location + + + Mod/Fem/Z88 + + + + + + + true + + + solve to be used by Z88 + + + false + + + Solver + + + Mod/Fem/Z88 + + + + Iteration solver with SOR preconditioning (-sorcg) + - - - - z88r - - + + + Iteration solver with SIC preconditioning (-siccg) + - - - - false - - - - 100 - 0 - - - - z88r binary path - - + + + Simple Cholesky solver (-choly) + - - - - false - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - Leave blank to use default Z88 z88r binary file - - - z88BinaryPath - - - Mod/Fem/Z88 - - - - + - - - + + + @@ -157,6 +203,11 @@ Gui::FileChooser
Gui/PrefWidgets.h
+ + Gui::PrefComboBox + QComboBox +
Gui/PrefWidgets.h
+
diff --git a/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp index 2b67a3799d..37a14e0c50 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp +++ b/src/Mod/Fem/Gui/DlgSettingsFemZ88Imp.cpp @@ -24,6 +24,8 @@ #include "PreCompiled.h" +#include + #include "DlgSettingsFemZ88Imp.h" #include "ui_DlgSettingsFemZ88.h" @@ -46,12 +48,23 @@ void DlgSettingsFemZ88Imp::saveSettings() { ui->cb_z88_binary_std->onSave(); ui->fc_z88_binary_path->onSave(); + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Mod/Fem/Z88"); + hGrp->SetInt("Solver", ui->cmb_solver->currentIndex()); + ui->cmb_solver->onSave(); } void DlgSettingsFemZ88Imp::loadSettings() { ui->cb_z88_binary_std->onRestore(); ui->fc_z88_binary_path->onRestore(); + ui->cmb_solver->onRestore(); + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Mod/Fem/Z88"); + int index = hGrp->GetInt("Solver", 0); + if (index > -1) ui->cmb_solver->setCurrentIndex(index); } /** diff --git a/src/Mod/Fem/femsolver/z88/tasks.py b/src/Mod/Fem/femsolver/z88/tasks.py index 15d3279e95..a9a2b3bc7a 100644 --- a/src/Mod/Fem/femsolver/z88/tasks.py +++ b/src/Mod/Fem/femsolver/z88/tasks.py @@ -42,6 +42,7 @@ from femmesh import meshsetsgetter from femtools import femutils from femtools import membertools +SOLVER_TYPES = ["sorcg", "siccg", "choly"] class Check(run.Check): @@ -102,6 +103,12 @@ class Solve(run.Solve): binary = settings.get_binary("Z88") if binary is None: self.fail() # a print has been made in settings module + + prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Z88") + solver = SOLVER_TYPES + solver = prefs.GetInt("Solver", 0) + solver = SOLVER_TYPES[solver] + self.pushStatus("used solver: " + solver + "\n") # run solver test mode # AFAIK: z88r needs to be run twice @@ -111,7 +118,7 @@ class Solve(run.Solve): # may be compare with the used ones self.pushStatus("Executing solver in test mode...\n") self._process = subprocess.Popen( - [binary, "-t", "-choly"], + [binary, "-t", "-" + solver], cwd=self.directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -123,7 +130,7 @@ class Solve(run.Solve): self.pushStatus("Executing solver in real mode...\n") binary = settings.get_binary("Z88") self._process = subprocess.Popen( - [binary, "-c", "-choly"], + [binary, "-c", "-" + solver], cwd=self.directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE)