Skip to content

Commit

Permalink
FEM: only define analysis types for calculix solver once
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Mar 1, 2020
1 parent c165edd commit 871d660
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Mod/Fem/femobjects/_FemSolverCalculix.py
Expand Up @@ -28,7 +28,7 @@
# \brief FreeCAD FEM _FemSolverCalculix

import FreeCAD
from femtools import ccxtools
from femsolver.calculix.solver import ANALYSIS_TYPES


class _FemSolverCalculix():
Expand Down Expand Up @@ -58,9 +58,9 @@ def __init__(self, obj):
"Fem",
"Type of the analysis"
)
obj.AnalysisType = ccxtools.FemToolsCcx.known_analysis_types
obj.AnalysisType = ANALYSIS_TYPES
analysis_type = ccx_prefs.GetInt("AnalysisType", 0)
obj.AnalysisType = ccxtools.FemToolsCcx.known_analysis_types[analysis_type]
obj.AnalysisType = ANALYSIS_TYPES[analysis_type]

choices_geom_nonlinear = ["linear", "nonlinear"]
obj.addProperty(
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/calculix/solver.py
Expand Up @@ -39,7 +39,7 @@
if FreeCAD.GuiUp:
import FemGui

ANALYSIS_TYPES = ["static", "frequency", "thermomech"]
ANALYSIS_TYPES = ["static", "frequency", "thermomech", "check"]


def create(doc, name="SolverCalculiX"):
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/femtools/ccxtools.py
Expand Up @@ -34,6 +34,7 @@

import FreeCAD

from femsolver.calculix.solver import ANALYSIS_TYPES
from femtools import femutils
from femtools import membertools

Expand Down Expand Up @@ -66,7 +67,6 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
Updated with update_objects
"""

known_analysis_types = ["static", "frequency", "thermomech", "check"]
finished = QtCore.Signal(int)

def __init__(self, analysis=None, solver=None, test_mode=False):
Expand Down Expand Up @@ -248,7 +248,7 @@ def check_prerequisites(self):
if not self.solver:
message += "No solver object defined in the analysis\n"
else:
if self.solver.AnalysisType not in self.known_analysis_types:
if self.solver.AnalysisType not in ANALYSIS_TYPES:
message += (
"Unknown analysis type: {}\n"
.format(self.solver.AnalysisType)
Expand Down

0 comments on commit 871d660

Please sign in to comment.