[FEM] fix broken Z88 part 3: don't hardcode memory
- we must not hardcode the number of stiffness matrix places, especially not for the Cholesky solver The user must have a chance to change this setting in case of a solver error. This is also according to the Z88 docs that says it is a two step process: - the solver first computed the necessary places - the user must set the value accordingly in case it is too low - also some code style fixes
This commit is contained in:
@@ -50,8 +50,8 @@ DlgSettingsFemCcxImp::~DlgSettingsFemCcxImp()
|
||||
|
||||
void DlgSettingsFemCcxImp::saveSettings()
|
||||
{
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Fem/Ccx");
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Fem/Ccx");
|
||||
hGrp->SetInt("Solver", ui->cmb_solver->currentIndex());
|
||||
hGrp->SetInt("AnalysisType", ui->cb_analysis_type->currentIndex());
|
||||
|
||||
@@ -102,12 +102,14 @@ void DlgSettingsFemCcxImp::loadSettings()
|
||||
ui->fc_ccx_binary_path->onRestore();
|
||||
ui->cb_split_inp_writer->onRestore();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Fem/Ccx");
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Fem/Ccx");
|
||||
int index = hGrp->GetInt("Solver", 0);
|
||||
if (index > -1) ui->cmb_solver->setCurrentIndex(index);
|
||||
if (index > -1)
|
||||
ui->cmb_solver->setCurrentIndex(index);
|
||||
index = hGrp->GetInt("AnalysisType", 0);
|
||||
if (index > -1) ui->cb_analysis_type->setCurrentIndex(index);
|
||||
if (index > -1)
|
||||
ui->cb_analysis_type->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>423</width>
|
||||
<height>128</height>
|
||||
<width>452</width>
|
||||
<height>154</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -74,25 +74,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_z88_binary_path">
|
||||
<property name="enabled">
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_z88_binary_std">
|
||||
<property name="text">
|
||||
<string>Search in known binary directories</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UseStandardZ88Location</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>z88r binary path:</string>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/Z88</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -116,22 +110,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_z88_binary_std">
|
||||
<property name="text">
|
||||
<string>Search in known binary directories</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UseStandardZ88Location</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/Z88</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="Gui::PrefComboBox" name="cmb_solver">
|
||||
<property name="enabled">
|
||||
@@ -166,6 +144,66 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_z88_binary_path">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>z88r binary path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="Gui::PrefSpinBox" name="sb_Z88_MaxGS">
|
||||
<property name="toolTip">
|
||||
<string>Maximal places in stiffnes matrix.
|
||||
You might need to increase this when using the
|
||||
Colesky solver and you get the error message
|
||||
that "MAXGS" needs to be increased.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>6000000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2147483647</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100000000</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>MaxGS</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Fem/Z88</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="l_ccx_max_iterations">
|
||||
<property name="text">
|
||||
<string>Max places in stiffnes matrix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -208,6 +246,11 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefSpinBox</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="Resources/Fem.qrc"/>
|
||||
|
||||
@@ -49,10 +49,12 @@ 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");
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Fem/Z88");
|
||||
hGrp->SetInt("Solver", ui->cmb_solver->currentIndex());
|
||||
ui->cmb_solver->onSave();
|
||||
hGrp->SetInt("MaxGS", ui->sb_Z88_MaxGS->value());
|
||||
ui->sb_Z88_MaxGS->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsFemZ88Imp::loadSettings()
|
||||
@@ -60,11 +62,16 @@ void DlgSettingsFemZ88Imp::loadSettings()
|
||||
ui->cb_z88_binary_std->onRestore();
|
||||
ui->fc_z88_binary_path->onRestore();
|
||||
ui->cmb_solver->onRestore();
|
||||
ui->sb_Z88_MaxGS->onRestore();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Fem/Z88");
|
||||
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);
|
||||
if (index > -1)
|
||||
ui->cmb_solver->setCurrentIndex(index);
|
||||
int places = hGrp->GetInt("MaxGS", 100000000);
|
||||
if (places > -1)
|
||||
ui->sb_Z88_MaxGS->setValue(places);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,7 +108,7 @@ class Solve(run.Solve):
|
||||
solver = SOLVER_TYPES
|
||||
solver = prefs.GetInt("Solver", 0)
|
||||
solver = SOLVER_TYPES[solver]
|
||||
self.pushStatus("used solver: " + solver + "\n")
|
||||
self.pushStatus("Used solver: " + solver + "\n")
|
||||
|
||||
# run solver test mode
|
||||
# AFAIK: z88r needs to be run twice
|
||||
|
||||
@@ -288,16 +288,19 @@ class FemInputWriterZ88(writerbase.FemInputWriter):
|
||||
|
||||
# ********************************************************************************************
|
||||
def write_z88_memory_parameter(self):
|
||||
# self.z88_param_maxgs = 6000000
|
||||
self.z88_param_maxgs = 50000000 # vierkantrohr
|
||||
prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Z88")
|
||||
MaxGS = prefs.GetInt("MaxGS", 100000000)
|
||||
global z88_dyn_template
|
||||
z88_dyn_template = z88_dyn_template.replace(
|
||||
"$z88_param_maxgs",
|
||||
"{}".format(self.z88_param_maxgs)
|
||||
)
|
||||
templateArray = z88_dyn_template.splitlines()
|
||||
output = ""
|
||||
for line in templateArray:
|
||||
if line.find("MAXGS") > -1:
|
||||
line = " MAXGS " + str(MaxGS)
|
||||
output += line + "\n"
|
||||
|
||||
solver_parameter_file_path = self.file_name + ".dyn"
|
||||
f = open(solver_parameter_file_path, "w")
|
||||
f.write(z88_dyn_template)
|
||||
f.write(output)
|
||||
f.close()
|
||||
|
||||
|
||||
@@ -366,7 +369,7 @@ Common entries for all modules gemeinsame Daten fuer alle Module
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
COMMON START
|
||||
MAXGS $z88_param_maxgs
|
||||
MAXGS 100000000
|
||||
MAXKOI 1200000
|
||||
MAXK 60000
|
||||
MAXE 300000
|
||||
|
||||
Reference in New Issue
Block a user