[FEM] improve new default solver setting

- fix bug if no solver should be default
- only provide solvers that are available to be the default
- also add commit opened transactions
- also remove unused include and correct an include
This commit is contained in:
Uwe
2023-03-24 19:29:25 +01:00
parent 9a77379b37
commit 05d675364c
6 changed files with 77 additions and 43 deletions

View File

@@ -24,6 +24,8 @@
#include "PreCompiled.h"
#include <App/Application.h>
#include "DlgSettingsFemGeneralImp.h"
#include "ui_DlgSettingsFemGeneral.h"
@@ -35,6 +37,37 @@ DlgSettingsFemGeneralImp::DlgSettingsFemGeneralImp(QWidget* parent)
, ui(new Ui_DlgSettingsFemGeneralImp)
{
ui->setupUi(this);
// fill solvers combo with available solvers
ui->cmb_def_solver->clear();
std::vector<std::string> Solvers = {"None"};
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Ccx");
auto ccxBinaryPath = hGrp->GetASCII("ccxBinaryPath", "");
if (!ccxBinaryPath.empty())
Solvers.push_back("CalculiX");
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Elmer");
auto elmerBinaryPath = hGrp->GetASCII("elmerBinaryPath", "");
if (!elmerBinaryPath.empty())
Solvers.push_back("Elmer");
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/mystran");
auto MystranBinaryPath = hGrp->GetASCII("MystranBinaryPath", "");
if (!MystranBinaryPath.empty())
Solvers.push_back("Mystran");
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Fem/Z88");
auto z88BinaryPath = hGrp->GetASCII("z88BinaryPath", "");
if (!z88BinaryPath.empty())
Solvers.push_back("Z88");
QStringList solversList;
for (auto item : Solvers) {
solversList << QLatin1String(item.c_str());
}
ui->cmb_def_solver->addItems(solversList);
}
DlgSettingsFemGeneralImp::~DlgSettingsFemGeneralImp()