FEM: result package, move result tools module in new result package

This commit is contained in:
Bernd Hahnebach
2017-12-06 23:47:12 +01:00
parent 23d735c2a5
commit 8599dd59ba
7 changed files with 24 additions and 13 deletions

View File

@@ -72,7 +72,6 @@ SET(FemScripts_SRCS
Init.py
InitGui.py
FemInputWriter.py
FemResultTools.py
FemToolsCcx.py
ObjectsFem.py
FemUtils.py
@@ -126,6 +125,11 @@ SET(FemMesh_SRCS
femmesh/meshtools.py
)
SET(FemResult_SRCS
femresult/__init__.py
femresult/resulttools.py
)
SET(FemSolver_SRCS
femsolver/__init__.py
femsolver/solverbase.py
@@ -381,7 +385,6 @@ SET(Fem_SRCS
${FemBase_SRCS}
${FemSet_SRCS}
${FemConstraints_SRCS}
${FemResult_SRCS}
${FemPost_SRCS}
${Mod_SRCS}
${Python_SRCS}
@@ -399,6 +402,7 @@ fc_target_copy_resource(Fem
${FemObjectsScripts_SRCS}
${FemInterfaces_SRCS}
${FemMesh_SRCS}
${FemResult_SRCS}
${FemGuiScripts_SRCS}
${FemTests_SRCS}
${FemTestsCCx_SRCS}

View File

@@ -20,7 +20,6 @@ INSTALL(
Init.py
InitGui.py
FemInputWriter.py
FemResultTools.py
FemToolsCcx.py
ObjectsFem.py
FemUtils.py
@@ -84,6 +83,14 @@ INSTALL(
Mod/Fem/femmesh
)
INSTALL(
FILES
femresult/__init__.py
femresult/resulttools.py
DESTINATION
Mod/Fem/femresult
)
INSTALL(
FILES
femsolver/__init__.py

View File

@@ -28,7 +28,7 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
from .FemCommands import FemCommands
import FemResultTools
import femresult.resulttools as resulttools
import FreeCADGui
import FemGui
from PySide import QtCore
@@ -45,7 +45,7 @@ class _CommandFemResultsPurge(FemCommands):
self.is_active = 'with_results'
def Activated(self):
FemResultTools.purge_results(FemGui.getActiveAnalysis())
resulttools.purge_results(FemGui.getActiveAnalysis())
FreeCADGui.addCommand('FEM_ResultsPurge', _CommandFemResultsPurge())

View File

@@ -32,7 +32,7 @@ import numpy as np
import FreeCADGui
import FemGui
import FemResultTools
import femresult.resulttools as resulttools
from PySide import QtCore, QtGui
from PySide.QtCore import Qt
from PySide.QtGui import QApplication
@@ -148,7 +148,7 @@ class _TaskPanelFemResultShow:
return int(QtGui.QDialogButtonBox.Close)
def get_result_stats(self, type_name):
return FemResultTools.get_stats(self.result_obj, type_name)
return resulttools.get_stats(self.result_obj, type_name)
def none_selected(self, state):
FreeCAD.FEM_dialog["results_type"] = "None"

View File

View File

@@ -26,7 +26,7 @@
import Fem
import FemToolsCcx
import FemResultTools
import femresult.resulttools as resulttools
import FreeCAD
import ObjectsFem
import femsolver.run
@@ -1150,7 +1150,7 @@ def compare_stats(fea, stat_file=None, loc_stat_types=None, res_obj_name=None):
stats = []
for s in loc_stat_types:
if res_obj_name:
statval = FemResultTools.get_stats(FreeCAD.ActiveDocument.getObject(res_obj_name), s)
statval = resulttools.get_stats(FreeCAD.ActiveDocument.getObject(res_obj_name), s)
else:
print('No result object name given')
return False
@@ -1217,7 +1217,7 @@ def create_test_results():
fea.load_results()
stats_static = []
for s in stat_types:
statval = FemResultTools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_static_results'), s)
statval = resulttools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_static_results'), s)
stats_static.append("{0}: ({1:.14g}, {2:.14g}, {3:.14g})\n".format(s, statval[0], statval[1], statval[2]))
static_expected_values_file = static_analysis_dir + 'cube_static_expected_values'
f = open(static_expected_values_file, 'w')
@@ -1239,7 +1239,7 @@ def create_test_results():
fea.load_results()
stats_frequency = []
for s in stat_types:
statval = FemResultTools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_static_mode_1_results'), s) # FIXME for some reason result obj name has static
statval = resulttools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_static_mode_1_results'), s) # FIXME for some reason result obj name has static
stats_frequency.append("{0}: ({1:.14g}, {2:.14g}, {3:.14g})\n".format(s, statval[0], statval[1], statval[2]))
frequency_expected_values_file = frequency_analysis_dir + 'cube_frequency_expected_values'
f = open(frequency_expected_values_file, 'w')
@@ -1260,7 +1260,7 @@ def create_test_results():
fea.load_results()
stats_thermomech = []
for s in stat_types:
statval = FemResultTools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_thermomech_results'), s)
statval = resulttools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_thermomech_results'), s)
stats_thermomech.append("{0}: ({1:.14g}, {2:.14g}, {3:.14g})\n".format(s, statval[0], statval[1], statval[2]))
thermomech_expected_values_file = thermomech_analysis_dir + 'spine_thermomech_expected_values'
f = open(thermomech_expected_values_file, 'w')
@@ -1284,7 +1284,7 @@ def create_test_results():
fea.load_results()
stats_flow1D = []
for s in stat_types:
statval = FemResultTools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_thermomech_time_1_0_results'), s)
statval = resulttools.get_stats(FreeCAD.ActiveDocument.getObject('CalculiX_thermomech_time_1_0_results'), s)
stats_flow1D.append("{0}: ({1:.14g}, {2:.14g}, {3:.14g})\n".format(s, statval[0], statval[1], statval[2]))
Flow1D_thermomech_expected_values_file = Flow1D_thermomech_analysis_dir + 'Flow1D_thermomech_expected_values'
f = open(Flow1D_thermomech_expected_values_file, 'w')