FEM: ccx tools unit tests, rename some methods and change base name retrieving
This commit is contained in:
@@ -26,6 +26,7 @@ __author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
@@ -70,6 +71,11 @@ def fcc_print(
|
||||
FreeCAD.Console.PrintMessage("{} \n".format(message))
|
||||
|
||||
|
||||
def get_namefromdef(strdel="", stradd=""):
|
||||
# https://code.activestate.com/recipes/66062-determining-current-function-name/
|
||||
return (sys._getframe(1).f_code.co_name).replace(strdel, stradd)
|
||||
|
||||
|
||||
def get_defmake_count(
|
||||
fem_vtk_post=True
|
||||
):
|
||||
|
||||
@@ -34,6 +34,7 @@ import FreeCAD
|
||||
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
from .support_utils import get_namefromdef
|
||||
from femtools import ccxtools
|
||||
|
||||
|
||||
@@ -80,13 +81,13 @@ class TestCcxTools(unittest.TestCase):
|
||||
))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_freq_analysis(
|
||||
def test_box_frequency(
|
||||
self
|
||||
):
|
||||
# set up
|
||||
from femexamples.boxanalysis_frequency import setup
|
||||
setup(self.document, "ccxtools")
|
||||
base_name = "cube_frequency"
|
||||
base_name = get_namefromdef("test_box", "cube")
|
||||
res_obj_name = "CCX_Mode1_Results"
|
||||
analysis_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)
|
||||
|
||||
@@ -108,13 +109,13 @@ class TestCcxTools(unittest.TestCase):
|
||||
)
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_analysis(
|
||||
def test_box_static(
|
||||
self
|
||||
):
|
||||
# set up
|
||||
from femexamples.boxanalysis_static import setup
|
||||
setup(self.document, "ccxtools")
|
||||
base_name = "cube_static"
|
||||
base_name = get_namefromdef("test_box", "cube")
|
||||
res_obj_name = "CCX_Results"
|
||||
analysis_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)
|
||||
|
||||
@@ -136,23 +137,23 @@ class TestCcxTools(unittest.TestCase):
|
||||
)
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_constraint_force_faceload_hexa20(
|
||||
def test_ccxcantilever_hexa20(
|
||||
self
|
||||
):
|
||||
from femexamples.ccx_cantilever_hexa20faceload import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "canti_ccx_faceload_hexa20")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_ccxcantilever", "canti_ccx_faceload"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_constraint_contact_shell_shell(
|
||||
def test_constraint_contact_shell_shell(
|
||||
self
|
||||
):
|
||||
from femexamples.constraint_contact_shell_shell import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "constraint_contact_shell_shell")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_constraint_contact_solid_solid(
|
||||
def test_constraint_contact_solid_solid(
|
||||
self
|
||||
):
|
||||
# does not pass on travis, but on my local system it does, Bernd
|
||||
@@ -163,39 +164,39 @@ class TestCcxTools(unittest.TestCase):
|
||||
|
||||
from femexamples.constraint_contact_solid_solid import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "constraint_contact_solid_solid")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_constraint_sectionprint(
|
||||
def test_constraint_sectionprint(
|
||||
self
|
||||
):
|
||||
from femexamples.constraint_section_print import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "constraint_sectionprint")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_constraint_tie(
|
||||
def test_constraint_tie(
|
||||
self
|
||||
):
|
||||
from femexamples.constraint_tie import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "constraint_tie")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_material_multiple(
|
||||
def test_material_multiple(
|
||||
self
|
||||
):
|
||||
from femexamples.material_multiple_twoboxes import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "mat_multiple")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_material", "mat"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_static_material_nonlinar(
|
||||
def test_material_nonlinear(
|
||||
self
|
||||
):
|
||||
from femexamples.material_nl_platewithhole import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "mat_nonlinear")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_material", "mat"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_thermomech_bimetall(
|
||||
@@ -203,16 +204,16 @@ class TestCcxTools(unittest.TestCase):
|
||||
):
|
||||
from femexamples.thermomech_bimetall import setup
|
||||
setup(self.document, "ccxtools")
|
||||
self.input_file_writing_test(None, "thermomech_bimetall")
|
||||
self.input_file_writing_test(None, get_namefromdef("test_"))
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_thermomech_flow1D_analysis(
|
||||
def test_thermomech_flow1D(
|
||||
self
|
||||
):
|
||||
# set up
|
||||
from femexamples.thermomech_flow1d import setup
|
||||
setup(self.document, "ccxtools")
|
||||
base_name = "Flow1D_thermomech"
|
||||
base_name = get_namefromdef("test_thermomech_flow1D", "Flow1D_thermomech")
|
||||
res_obj_name = "CCX_Time1_0_Results"
|
||||
analysis_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)
|
||||
|
||||
@@ -234,13 +235,13 @@ class TestCcxTools(unittest.TestCase):
|
||||
)
|
||||
|
||||
# ********************************************************************************************
|
||||
def test_thermomech_spine_analysis(
|
||||
def test_thermomech_spine(
|
||||
self
|
||||
):
|
||||
# set up
|
||||
from femexamples.thermomech_spine import setup
|
||||
setup(self.document, "ccxtools")
|
||||
base_name = "spine_thermomech"
|
||||
base_name = get_namefromdef("test_thermomech_spine", "spine_thermomech")
|
||||
res_obj_name = "CCX_Results"
|
||||
analysis_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)
|
||||
|
||||
|
||||
@@ -37,18 +37,18 @@ make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer
|
||||
|
||||
|
||||
# methods
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_freq_analysis
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_analysis
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_force_faceload_hexa20
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_contact_shell_shell
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_contact_solid_solid
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_sectionprint
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_tie
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_material_multiple
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_static_material_nonlinar
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_box_frequency
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_box_static
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_ccxcantilever_faceload_hexa20
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_contact_shell_shell
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_contact_solid_solid
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_sectionprint
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_constraint_tie
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_material_multiple
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_material_nonlinear
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_thermomech_bimetall
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_thermomech_flow1D_analysis
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_thermomech_spine_analysis
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_thermomech_flow1D
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_ccxtools.TestCcxTools.test_thermomech_spine
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_common.TestFemCommon.test_adding_refshaps
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_common.TestFemCommon.test_pyimport_all_FEM_modules
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_femimport.TestFemImport.test_import_fem
|
||||
@@ -83,55 +83,55 @@ make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_result.TestResult.test_rho
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_result.TestResult.test_disp_abs
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_calculix.TestSolverCalculix.test_solver_calculix
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_solver_elmer
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_nodeload
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_faceload
|
||||
make -j 4 && ./bin/FreeCADCmd -t femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_nodeload
|
||||
|
||||
|
||||
# methods in FreeCAD
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_freq_analysis'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_box_frequency'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_analysis'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_box_static'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_force_faceload_hexa20'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_ccxcantilever_faceload_hexa20'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_contact_shell_shell'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_constraint_contact_shell_shell'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_contact_solid_solid'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_constraint_contact_solid_solid'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_sectionprint'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_constraint_sectionprint'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_constraint_tie'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_constraint_tie'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_material_multiple'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_material_multiple'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_static_material_nonlinar'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_material_nonlinear'
|
||||
))
|
||||
|
||||
import unittest
|
||||
@@ -141,12 +141,12 @@ unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_thermomech_flow1D_analysis'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_thermomech_flow1D'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_thermomech_spine_analysis'
|
||||
'femtest.app.test_ccxtools.TestCcxTools.test_thermomech_spine'
|
||||
))
|
||||
|
||||
import unittest
|
||||
@@ -321,10 +321,10 @@ unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_nodeload'
|
||||
'femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_faceload'
|
||||
))
|
||||
|
||||
import unittest
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(
|
||||
'femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_faceload'
|
||||
'femtest.app.test_solver_elmer.TestSolverElmer.test_elmer_ccxcanti_nodeload'
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user