From 4ea7fc6e894c34c37e10a5a0daf2a41d43bcaa71 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 1 Aug 2016 21:57:01 +0100 Subject: [PATCH] FEM: GUI: pref: add new CalculiX Solver attributes to a new CalculiX tab --- src/Mod/Fem/Gui/AppFemGui.cpp | 4 +- src/Mod/Fem/Gui/CMakeLists.txt | 5 + src/Mod/Fem/Gui/DlgSettingsFem.ui | 9 + src/Mod/Fem/Gui/DlgSettingsFemCcx.ui | 331 +++++++++++++++++++++++ src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp | 94 +++++++ src/Mod/Fem/Gui/DlgSettingsFemCcxImp.h | 50 ++++ 6 files changed, 492 insertions(+), 1 deletion(-) create mode 100644 src/Mod/Fem/Gui/DlgSettingsFemCcx.ui create mode 100644 src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp create mode 100644 src/Mod/Fem/Gui/DlgSettingsFemCcxImp.h diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index 3c6919954..92aa44283 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -34,6 +34,7 @@ #include #include "PropertyFemMeshItem.h" #include "DlgSettingsFemImp.h" +#include "DlgSettingsFemCcxImp.h" #include "ViewProviderFemMesh.h" #include "ViewProviderFemMeshShape.h" #include "ViewProviderFemMeshShapeNetgen.h" @@ -139,7 +140,8 @@ PyMODINIT_FUNC initFemGui() // register preferences pages - new Gui::PrefPageProducer ("FEM"); + new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); + new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","FEM")); // add resources and reloads the translators loadFemResource(); diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index aa22a2ecd..f777aee65 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -52,6 +52,7 @@ SOURCE_GROUP("Python" FILES ${Python_SRCS}) set(FemGui_MOC_HDRS DlgSettingsFemImp.h + DlgSettingsFemCcxImp.h PropertyFemMeshItem.h TaskObjectName.h TaskCreateNodeSet.h @@ -84,6 +85,7 @@ SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS}) set(FemGui_UIC_SRCS DlgSettingsFem.ui + DlgSettingsFemCcx.ui TaskCreateNodeSet.ui TaskObjectName.ui TaskFemConstraint.ui @@ -117,6 +119,9 @@ SET(FemGui_DLG_SRCS DlgSettingsFem.ui DlgSettingsFemImp.cpp DlgSettingsFemImp.h + DlgSettingsFemCcx.ui + DlgSettingsFemCcxImp.cpp + DlgSettingsFemCcxImp.h TaskFemConstraint.ui TaskFemConstraint.cpp TaskFemConstraint.h diff --git a/src/Mod/Fem/Gui/DlgSettingsFem.ui b/src/Mod/Fem/Gui/DlgSettingsFem.ui index c23df5865..d632ec2f4 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFem.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFem.ui @@ -347,6 +347,15 @@ :/icons/fem-frequency-analysis.svg:/icons/fem-frequency-analysis.svg + + + Thermomech + + + + :/icons/fem-new-analysis.svg:/icons/fem-new-analysis.svg + + diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui new file mode 100644 index 000000000..0adb95b99 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui @@ -0,0 +1,331 @@ + + + FemGui::DlgSettingsFemCcxImp + + + + 0 + 0 + 555 + 518 + + + + CalculiX + + + + + + + + Solver preferences + + + + + + + + Number of CPU's to use (Spooles only) + + + + + + + 1 + + + 40 + + + 1 + + + 1 + + + AnalysisNumCPUs + + + Mod/Fem/Ccx + + + + + + + true + + + Matrix Solver + + + + + + + true + + + false + + + Solver + + + Mod/Fem/Ccx + + + + Default + + + + + Spooles + + + + + Iterative Scaling + + + + + Iterative Cholesky + + + + + + + + + + + + + Non-Linear Geometry + + + + + + + Non linear geometry + + + false + + + NonlinearGeometry + + + Mod/Fem/Ccx + + + + + + + Hide Constraints when plotting results + + + + + + + Hide + + + false + + + HideConstraint + + + Mod/Fem/Ccx + + + + + + + + + + + + Thermo mechanical analysis settings + + + + + + + + Analysis type + + + + + + + Steady State + + + true + + + StaticAnalysis + + + Mod/Fem/Ccx + + + + + + + Maximum Number of iterations + + + + + + + 1 + + + 10000000 + + + 10 + + + 2000 + + + AnalysisMaxIterations + + + Mod/Fem/Ccx + + + + + + + Initial time step + + + + + + + 3 + + + 0.010000000000000 + + + 99999999.000000000000000 + + + 0.010000000000000 + + + 0.010000000000000 + + + AnalysisInitialTimeStep + + + Mod/Fem/Ccx + + + + + + + End Time + + + + + + + 3 + + + 0.010000000000000 + + + 99999999.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + AnalysisTime + + + Mod/Fem/Ccx + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
+ + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+ + Gui::PrefComboBox + QComboBox +
Gui/PrefWidgets.h
+
+ + Gui::PrefDoubleSpinBox + QDoubleSpinBox +
Gui/PrefWidgets.h
+
+
+ + + + +
diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp new file mode 100644 index 000000000..a7bb2944e --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp @@ -0,0 +1,94 @@ +/*************************************************************************** + * Copyright (c) 2015 FreeCAD Developers * + * Author: Przemo Firszt * + * Based on src/Mod/Raytracing/Gui/DlgSettingsRayImp.cpp * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#include "Gui/Application.h" +#include "DlgSettingsFemCcxImp.h" +#include + +using namespace FemGui; + +DlgSettingsFemCcxImp::DlgSettingsFemCcxImp( QWidget* parent ) + : PreferencePage( parent ) +{ + this->setupUi(this); +} + +DlgSettingsFemCcxImp::~DlgSettingsFemCcxImp() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgSettingsFemCcxImp::saveSettings() +{ + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Mod/Fem/Ccx"); + hGrp->SetInt("Solver", cmb_solver->currentIndex()); + + //OvG: Solver settings + sb_ccx_numcpu->onSave(); //Number of CPUs + cmb_solver->onSave(); + cb_ccx_non_lin_geom->onSave(); + cb_hide_constraint->onSave(); + + cb_static->onSave(); + sb_ccx_max_iterations->onSave(); //Max number of iterations + dsb_ccx_initial_time_step->onSave(); //Initial time step + dsb_ccx_analysis_time->onSave(); //Analysis time +} + +void DlgSettingsFemCcxImp::loadSettings() +{ + //OvG: Solver settings + sb_ccx_numcpu->onRestore(); //Number of CPUs + cmb_solver->onRestore(); + cb_ccx_non_lin_geom->onRestore(); + cb_hide_constraint->onRestore(); + + cb_static->onRestore(); + sb_ccx_max_iterations->onRestore(); //Max number of iterations + dsb_ccx_initial_time_step->onRestore(); //Initial time step + dsb_ccx_analysis_time->onRestore(); //Analysis time + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Mod/Fem/Ccx"); + int index = hGrp->GetInt("Solver", 0); + if (index > -1) cmb_solver->setCurrentIndex(index); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsFemCcxImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgSettingsFemCcxImp.cpp" diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.h b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.h new file mode 100644 index 000000000..71d1680fb --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.h @@ -0,0 +1,50 @@ + /************************************************************************** + * Copyright (c) 2015 FreeCAD Developers * + * Author: Przemo Firszt * + * Based on src/Mod/Raytracing/Gui/DlgSettingsRayImp.h * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEMGUI_DLGSETTINGSFEMCCXIMP_H +#define FEMGUI_DLGSETTINGSFEMCCXIMP_H + +#include "ui_DlgSettingsFemCcx.h" +#include + +namespace FemGui { + +class DlgSettingsFemCcxImp : public Gui::Dialog::PreferencePage, public Ui_DlgSettingsFemCcxImp +{ + Q_OBJECT + +public: + DlgSettingsFemCcxImp( QWidget* parent = 0 ); + ~DlgSettingsFemCcxImp(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); +}; + +} // namespace FemGui + +#endif // FEMGUI_DLGSETTINGSFEMCCXIMP_H