diff --git a/src/Mod/Fem/femtest/testccxtools.py b/src/Mod/Fem/femtest/testccxtools.py index 1932830d54..0c49c2ad7f 100644 --- a/src/Mod/Fem/femtest/testccxtools.py +++ b/src/Mod/Fem/femtest/testccxtools.py @@ -35,7 +35,7 @@ from os.path import join class TestCcxTools(unittest.TestCase): - fcc_print('import TestCcxTools') + fcc_print("import TestCcxTools") # ******************************************************************************************** def setUp( @@ -53,11 +53,11 @@ class TestCcxTools(unittest.TestCase): self.active_doc = FreeCAD.ActiveDocument # more inits - self.mesh_name = 'Mesh' + self.mesh_name = "Mesh" self.temp_dir = testtools.get_fem_test_tmp_dir() self.test_file_dir = join( testtools.get_fem_test_home_dir(), - 'ccx' + "ccx" ) def test_00print( @@ -73,29 +73,29 @@ class TestCcxTools(unittest.TestCase): def test_1_static_analysis( self ): - fcc_print('--------------- Start of FEM tests ---------------') + fcc_print("--------------- Start of FEM tests ---------------") box = self.active_doc.addObject("Part::Box", "Box") - fcc_print('Checking FEM new analysis...') + fcc_print("Checking FEM new analysis...") analysis = ObjectsFem.makeAnalysis( self.active_doc, - 'Analysis' + "Analysis" ) self.assertTrue( analysis, "FemTest of new analysis failed" ) - fcc_print('Checking FEM new solver...') + fcc_print("Checking FEM new solver...") solver_object = ObjectsFem.makeSolverCalculixCcxTools( self.active_doc, - 'CalculiX' + "CalculiX" ) - solver_object.AnalysisType = 'static' - solver_object.GeometricalNonlinearity = 'linear' + solver_object.AnalysisType = "static" + solver_object.GeometricalNonlinearity = "linear" solver_object.ThermoMechSteadyState = False - solver_object.MatrixSolverType = 'default' + solver_object.MatrixSolverType = "default" solver_object.IterationsControlParameterTimeUse = False solver_object.EigenmodesCount = 10 solver_object.EigenmodeHighLimit = 1000000.0 @@ -106,16 +106,16 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(solver_object) - fcc_print('Checking FEM new material...') + fcc_print("Checking FEM new material...") material_object = ObjectsFem.makeMaterialSolid( self.active_doc, - 'MechanicalMaterial' + "MechanicalMaterial" ) mat = material_object.Material - mat['Name'] = "Steel-Generic" - mat['YoungsModulus'] = "200000 MPa" - mat['PoissonRatio'] = "0.30" - mat['Density'] = "7900 kg/m^3" + mat["Name"] = "Steel-Generic" + mat["YoungsModulus"] = "200000 MPa" + mat["PoissonRatio"] = "0.30" + mat["Density"] = "7900 kg/m^3" material_object.Material = mat self.assertTrue( material_object, @@ -123,7 +123,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(material_object) - fcc_print('Checking FEM new fixed constraint...') + fcc_print("Checking FEM new fixed constraint...") fixed_constraint = self.active_doc.addObject( "Fem::ConstraintFixed", "FemConstraintFixed" @@ -135,7 +135,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(fixed_constraint) - fcc_print('Checking FEM new force constraint...') + fcc_print("Checking FEM new force constraint...") force_constraint = self.active_doc.addObject( "Fem::ConstraintForce", "FemConstraintForce" @@ -152,7 +152,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(force_constraint) - fcc_print('Checking FEM new pressure constraint...') + fcc_print("Checking FEM new pressure constraint...") pressure_constraint = self.active_doc.addObject( "Fem::ConstraintPressure", "FemConstraintPressure" @@ -166,7 +166,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(pressure_constraint) - fcc_print('Checking FEM new mesh...') + fcc_print("Checking FEM new mesh...") from .testfiles.ccx.cube_mesh import create_nodes_cube from .testfiles.ccx.cube_mesh import create_elements_cube mesh = Fem.FemMesh() @@ -181,7 +181,7 @@ class TestCcxTools(unittest.TestCase): "Import of mesh volumes failed" ) mesh_object = self.active_doc.addObject( - 'Fem::FemMeshObject', + "Fem::FemMeshObject", self.mesh_name ) mesh_object.FemMesh = mesh @@ -195,37 +195,37 @@ class TestCcxTools(unittest.TestCase): static_analysis_dir = testtools.get_unit_test_tmp_dir( self.temp_dir, - 'FEM_ccx_static' + "FEM_ccx_static" ) fea = ccxtools.FemToolsCcx(analysis, solver_object, test_mode=True) fea.update_objects() - fcc_print('Setting up working directory {}'.format(static_analysis_dir)) + fcc_print("Setting up working directory {}".format(static_analysis_dir)) fea.setup_working_dir(static_analysis_dir) self.assertTrue( True if fea.working_dir == static_analysis_dir else False, "Setting working directory {} failed".format(static_analysis_dir) ) - fcc_print('Checking FEM inp file prerequisites for static analysis...') + fcc_print("Checking FEM inp file prerequisites for static analysis...") error = fea.check_prerequisites() self.assertFalse( error, "ccxtools check_prerequisites returned error message: {}".format(error) ) - static_base_name = 'cube_static' - inpfile_given = join(self.test_file_dir, (static_base_name + '.inp')) - inpfile_totest = join(static_analysis_dir, (self.mesh_name + '.inp')) - fcc_print('Checking FEM inp file write...') - fcc_print('Writing {} for static analysis'.format(inpfile_totest)) + static_base_name = "cube_static" + inpfile_given = join(self.test_file_dir, (static_base_name + ".inp")) + inpfile_totest = join(static_analysis_dir, (self.mesh_name + ".inp")) + fcc_print("Checking FEM inp file write...") + fcc_print("Writing {} for static analysis".format(inpfile_totest)) error = fea.write_inp_file() self.assertFalse( error, "Writing failed" ) - fcc_print('Comparing {} to {}'.format(inpfile_given, inpfile_totest)) + fcc_print("Comparing {} to {}".format(inpfile_given, inpfile_totest)) ret = testtools.compare_inp_files(inpfile_given, inpfile_totest) self.assertFalse( ret, @@ -233,7 +233,7 @@ class TestCcxTools(unittest.TestCase): ) fcc_print( - 'Setting up working directory to {} in order to read simulated calculations' + "Setting up working directory to {} in order to read simulated calculations" .format(self.test_file_dir) ) fea.setup_working_dir(self.test_file_dir) @@ -244,49 +244,49 @@ class TestCcxTools(unittest.TestCase): "Setting working directory {} failed".format(self.test_file_dir) ) - fcc_print('Setting base name to read test {}.frd file...'.format('cube_static')) + fcc_print("Setting base name to read test {}.frd file...".format("cube_static")) fea.set_base_name(static_base_name) self.assertTrue( True if fea.base_name == static_base_name else False, "Setting base name to {} failed".format(static_base_name) ) - fcc_print('Setting inp file name to read test {}.frd file...'.format('cube_static')) + fcc_print("Setting inp file name to read test {}.frd file...".format("cube_static")) fea.set_inp_file_name() self.assertTrue( True if fea.inp_file_name == inpfile_given else False, "Setting inp file name to {} failed".format(inpfile_given) ) - fcc_print('Checking FEM frd file read from static analysis...') + fcc_print("Checking FEM frd file read from static analysis...") fea.load_results() self.assertTrue( fea.results_present, "Cannot read results from {}.frd frd file".format(fea.base_name) ) - fcc_print('Reading stats from result object for static analysis...') + fcc_print("Reading stats from result object for static analysis...") static_expected_values = join(self.test_file_dir, "cube_static_expected_values") ret = testtools.compare_stats( fea, static_expected_values, - 'CCX_Results' + "CCX_Results" ) self.assertFalse( ret, "Invalid results read from .frd file" ) - static_save_fc_file = static_analysis_dir + static_base_name + '.FCStd' - fcc_print('Save FreeCAD file for static analysis to {}...'.format(static_save_fc_file)) + static_save_fc_file = static_analysis_dir + static_base_name + ".FCStd" + fcc_print("Save FreeCAD file for static analysis to {}...".format(static_save_fc_file)) self.active_doc.saveAs(static_save_fc_file) - fcc_print('--------------- End of FEM tests static and analysis ---------------') + fcc_print("--------------- End of FEM tests static and analysis ---------------") # ******************************************************************************************** def test_2_static_multiple_material( self ): - fcc_print('--------------- Start of FEM ccxtools multiple material test ---------------') + fcc_print("--------------- Start of FEM ccxtools multiple material test ---------------") # create a CompSolid of two Boxes extract the CompSolid # we are able to remesh if needed @@ -295,9 +295,9 @@ class TestCcxTools(unittest.TestCase): boxupp.Placement.Base = (0, 0, 10) # for BooleanFragments Occt >=6.9 is needed - ''' + """ import BOPTools.SplitFeatures - bf = BOPTools.SplitFeatures.makeBooleanFragments(name='BooleanFragments') + bf = BOPTools.SplitFeatures.makeBooleanFragments(name="BooleanFragments") bf.Objects = [boxlow, boxupp] bf.Mode = "CompSolid" self.active_doc.recompute() @@ -307,13 +307,13 @@ class TestCcxTools(unittest.TestCase): obj.ViewObject.hide() self.active_doc.recompute() import CompoundTools.CompoundFilter - cf = CompoundTools.CompoundFilter.makeCompoundFilter(name='MultiMatCompSolid') + cf = CompoundTools.CompoundFilter.makeCompoundFilter(name="MultiMatCompSolid") cf.Base = bf - cf.FilterType = 'window-volume' + cf.FilterType = "window-volume" cf.Proxy.execute(cf) cf.purgeTouched() cf.Base.ViewObject.hide() - ''' + """ self.active_doc.recompute() if FreeCAD.GuiUp: import FreeCADGui @@ -322,43 +322,43 @@ class TestCcxTools(unittest.TestCase): analysis = ObjectsFem.makeAnalysis( self.active_doc, - 'Analysis' + "Analysis" ) solver_object = ObjectsFem.makeSolverCalculixCcxTools( self.active_doc, - 'CalculiXccxTools' + "CalculiXccxTools" ) - solver_object.AnalysisType = 'static' - solver_object.GeometricalNonlinearity = 'linear' + solver_object.AnalysisType = "static" + solver_object.GeometricalNonlinearity = "linear" solver_object.ThermoMechSteadyState = False - solver_object.MatrixSolverType = 'default' + solver_object.MatrixSolverType = "default" solver_object.IterationsControlParameterTimeUse = False analysis.addObject(solver_object) material_object_low = ObjectsFem.makeMaterialSolid( self.active_doc, - 'MechanicalMaterialLow' + "MechanicalMaterialLow" ) mat = material_object_low.Material - mat['Name'] = "Aluminium-Generic" - mat['YoungsModulus'] = "70000 MPa" - mat['PoissonRatio'] = "0.35" - mat['Density'] = "2700 kg/m^3" + mat["Name"] = "Aluminium-Generic" + mat["YoungsModulus"] = "70000 MPa" + mat["PoissonRatio"] = "0.35" + mat["Density"] = "2700 kg/m^3" material_object_low.Material = mat - material_object_low.References = [(boxlow, 'Solid1')] + material_object_low.References = [(boxlow, "Solid1")] analysis.addObject(material_object_low) material_object_upp = ObjectsFem.makeMaterialSolid( self.active_doc, - 'MechanicalMaterialUpp' + "MechanicalMaterialUpp" ) mat = material_object_upp.Material - mat['Name'] = "Steel-Generic" - mat['YoungsModulus'] = "200000 MPa" - mat['PoissonRatio'] = "0.30" - mat['Density'] = "7980 kg/m^3" + mat["Name"] = "Steel-Generic" + mat["YoungsModulus"] = "200000 MPa" + mat["PoissonRatio"] = "0.30" + mat["Density"] = "7980 kg/m^3" material_object_upp.Material = mat - material_object_upp.References = [(boxupp, 'Solid1')] + material_object_upp.References = [(boxupp, "Solid1")] analysis.addObject(material_object_upp) fixed_constraint = self.active_doc.addObject( @@ -383,76 +383,76 @@ class TestCcxTools(unittest.TestCase): import femtest.testfiles.ccx.multimat_mesh as multimatmesh multimatmesh.create_nodes(mesh) multimatmesh.create_elements(mesh) - mesh_object = self.active_doc.addObject('Fem::FemMeshObject', self.mesh_name) + mesh_object = self.active_doc.addObject("Fem::FemMeshObject", self.mesh_name) mesh_object.FemMesh = mesh analysis.addObject(mesh_object) self.active_doc.recompute() static_multiplemat_dir = testtools.get_unit_test_tmp_dir( self.temp_dir, - 'FEM_ccx_multimat/' + "FEM_ccx_multimat/" ) fea = ccxtools.FemToolsCcx(analysis, solver_object, test_mode=True) fea.update_objects() fea.setup_working_dir(static_multiplemat_dir) - fcc_print('Checking FEM inp file prerequisites for ccxtools multimat analysis...') + fcc_print("Checking FEM inp file prerequisites for ccxtools multimat analysis...") error = fea.check_prerequisites() self.assertFalse( error, "ccxtools check_prerequisites returned error message: {}".format(error) ) - static_base_name = 'multimat' - inpfile_given = join(self.test_file_dir, (static_base_name + '.inp')) - inpfile_totest = join(static_multiplemat_dir, (self.mesh_name + '.inp')) - fcc_print('Checking FEM inp file write...') - fcc_print('Writing {} for static multiple material'.format(inpfile_totest)) + static_base_name = "multimat" + inpfile_given = join(self.test_file_dir, (static_base_name + ".inp")) + inpfile_totest = join(static_multiplemat_dir, (self.mesh_name + ".inp")) + fcc_print("Checking FEM inp file write...") + fcc_print("Writing {} for static multiple material".format(inpfile_totest)) error = fea.write_inp_file() self.assertFalse( error, "Writing failed" ) - fcc_print('Comparing {} to {}'.format(inpfile_given, inpfile_totest)) + fcc_print("Comparing {} to {}".format(inpfile_given, inpfile_totest)) ret = testtools.compare_inp_files(inpfile_given, inpfile_totest) self.assertFalse( ret, "ccxtools write_inp_file test failed.\n{}".format(ret) ) - static_save_fc_file = static_multiplemat_dir + static_base_name + '.FCStd' - fcc_print('Save FreeCAD file for static analysis to {}...'.format(static_save_fc_file)) + static_save_fc_file = static_multiplemat_dir + static_base_name + ".FCStd" + fcc_print("Save FreeCAD file for static analysis to {}...".format(static_save_fc_file)) self.active_doc.saveAs(static_save_fc_file) - fcc_print('--------------- End of FEM ccxtools multiple material test ---------------') + fcc_print("--------------- End of FEM ccxtools multiple material test ---------------") # ******************************************************************************************** def test_3_freq_analysis( self ): - fcc_print('--------------- Start of FEM tests ---------------') + fcc_print("--------------- Start of FEM tests ---------------") self.active_doc.addObject("Part::Box", "Box") - fcc_print('Checking FEM new analysis...') + fcc_print("Checking FEM new analysis...") analysis = ObjectsFem.makeAnalysis( self.active_doc, - 'Analysis' + "Analysis" ) self.assertTrue( analysis, "FemTest of new analysis failed" ) - fcc_print('Checking FEM new solver...') + fcc_print("Checking FEM new solver...") solver_object = ObjectsFem.makeSolverCalculixCcxTools( self.active_doc, - 'CalculiX' + "CalculiX" ) - solver_object.AnalysisType = 'frequency' - solver_object.GeometricalNonlinearity = 'linear' + solver_object.AnalysisType = "frequency" + solver_object.GeometricalNonlinearity = "linear" solver_object.ThermoMechSteadyState = False - solver_object.MatrixSolverType = 'default' + solver_object.MatrixSolverType = "default" solver_object.IterationsControlParameterTimeUse = False solver_object.EigenmodesCount = 10 solver_object.EigenmodeHighLimit = 1000000.0 @@ -463,16 +463,16 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(solver_object) - fcc_print('Checking FEM new material...') + fcc_print("Checking FEM new material...") material_object = ObjectsFem.makeMaterialSolid( self.active_doc, - 'MechanicalMaterial' + "MechanicalMaterial" ) mat = material_object.Material - mat['Name'] = "Steel-Generic" - mat['YoungsModulus'] = "200000 MPa" - mat['PoissonRatio'] = "0.30" - mat['Density'] = "7900 kg/m^3" + mat["Name"] = "Steel-Generic" + mat["YoungsModulus"] = "200000 MPa" + mat["PoissonRatio"] = "0.30" + mat["Density"] = "7900 kg/m^3" material_object.Material = mat self.assertTrue( material_object, @@ -480,7 +480,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(material_object) - fcc_print('Checking FEM new mesh...') + fcc_print("Checking FEM new mesh...") from .testfiles.ccx.cube_mesh import create_nodes_cube from .testfiles.ccx.cube_mesh import create_elements_cube mesh = Fem.FemMesh() @@ -489,7 +489,7 @@ class TestCcxTools(unittest.TestCase): ret = create_elements_cube(mesh) self.assertTrue(ret, "Import of mesh volumes failed") mesh_object = self.active_doc.addObject( - 'Fem::FemMeshObject', + "Fem::FemMeshObject", self.mesh_name ) mesh_object.FemMesh = mesh @@ -500,37 +500,37 @@ class TestCcxTools(unittest.TestCase): frequency_analysis_dir = testtools.get_unit_test_tmp_dir( self.temp_dir, - 'FEM_ccx_frequency' + "FEM_ccx_frequency" ) fea = ccxtools.FemToolsCcx(analysis, solver_object, test_mode=True) fea.update_objects() - fcc_print('Setting up working directory {}'.format(frequency_analysis_dir)) + fcc_print("Setting up working directory {}".format(frequency_analysis_dir)) fea.setup_working_dir(frequency_analysis_dir) self.assertTrue( True if fea.working_dir == frequency_analysis_dir else False, "Setting working directory {} failed".format(frequency_analysis_dir) ) - fcc_print('Checking FEM inp file prerequisites for frequency analysis...') + fcc_print("Checking FEM inp file prerequisites for frequency analysis...") error = fea.check_prerequisites() self.assertFalse( error, "ccxtools check_prerequisites returned error message: {}".format(error) ) - frequency_base_name = 'cube_frequency' - inpfile_given = join(self.test_file_dir, (frequency_base_name + '.inp')) - inpfile_totest = join(frequency_analysis_dir, (self.mesh_name + '.inp')) - fcc_print('Checking FEM inp file write...') - fcc_print('Writing {} for frequency analysis'.format(inpfile_totest)) + frequency_base_name = "cube_frequency" + inpfile_given = join(self.test_file_dir, (frequency_base_name + ".inp")) + inpfile_totest = join(frequency_analysis_dir, (self.mesh_name + ".inp")) + fcc_print("Checking FEM inp file write...") + fcc_print("Writing {} for frequency analysis".format(inpfile_totest)) error = fea.write_inp_file() self.assertFalse( error, "Writing failed" ) - fcc_print('Comparing {} to {}'.format(inpfile_given, inpfile_totest)) + fcc_print("Comparing {} to {}".format(inpfile_given, inpfile_totest)) ret = testtools.compare_inp_files(inpfile_given, inpfile_totest) self.assertFalse( ret, @@ -538,7 +538,7 @@ class TestCcxTools(unittest.TestCase): ) fcc_print( - 'Setting up working directory to {} in order to read simulated calculations'. + "Setting up working directory to {} in order to read simulated calculations". format(self.test_file_dir) ) fea.setup_working_dir(self.test_file_dir) @@ -547,78 +547,78 @@ class TestCcxTools(unittest.TestCase): "Setting working directory {} failed".format(self.test_file_dir) ) - fcc_print('Setting base name to read test {}.frd file...'.format(frequency_base_name)) + fcc_print("Setting base name to read test {}.frd file...".format(frequency_base_name)) fea.set_base_name(frequency_base_name) self.assertTrue( True if fea.base_name == frequency_base_name else False, "Setting base name to {} failed".format(frequency_base_name) ) - fcc_print('Setting inp file name to read test {}.frd file...'.format('cube_frequency')) + fcc_print("Setting inp file name to read test {}.frd file...".format("cube_frequency")) fea.set_inp_file_name() self.assertTrue( True if fea.inp_file_name == inpfile_given else False, "Setting inp file name to {} failed".format(inpfile_given) ) - fcc_print('Checking FEM frd file read from frequency analysis...') + fcc_print("Checking FEM frd file read from frequency analysis...") fea.load_results() self.assertTrue( fea.results_present, "Cannot read results from {}.frd frd file".format(fea.base_name) ) - fcc_print('Reading stats from result object for frequency analysis...') + fcc_print("Reading stats from result object for frequency analysis...") frequency_expected_values = join(self.test_file_dir, "cube_frequency_expected_values") ret = testtools.compare_stats( fea, frequency_expected_values, - 'CCX_Mode1_Results' + "CCX_Mode1_Results" ) self.assertFalse( ret, "Invalid results read from .frd file" ) - frequency_save_fc_file = frequency_analysis_dir + frequency_base_name + '.FCStd' + frequency_save_fc_file = frequency_analysis_dir + frequency_base_name + ".FCStd" fcc_print( - 'Save FreeCAD file for frequency analysis to {}...' + "Save FreeCAD file for frequency analysis to {}..." .format(frequency_save_fc_file) ) self.active_doc.saveAs(frequency_save_fc_file) - fcc_print('--------------- End of FEM tests frequency analysis ---------------') + fcc_print("--------------- End of FEM tests frequency analysis ---------------") # ******************************************************************************************** def test_4_thermomech_analysis( self ): - fcc_print('--------------- Start of FEM tests ---------------') + fcc_print("--------------- Start of FEM tests ---------------") box = self.active_doc.addObject("Part::Box", "Box") box.Height = 25.4 box.Width = 25.4 box.Length = 203.2 - fcc_print('Checking FEM new analysis...') + fcc_print("Checking FEM new analysis...") analysis = ObjectsFem.makeAnalysis( self.active_doc, - 'Analysis' + "Analysis" ) self.assertTrue( analysis, "FemTest of new analysis failed" ) - fcc_print('Checking FEM new solver...') + fcc_print("Checking FEM new solver...") solver_object = ObjectsFem.makeSolverCalculixCcxTools( self.active_doc, - 'CalculiX' + "CalculiX" ) - solver_object.AnalysisType = 'thermomech' - solver_object.GeometricalNonlinearity = 'linear' + solver_object.AnalysisType = "thermomech" + solver_object.GeometricalNonlinearity = "linear" solver_object.ThermoMechSteadyState = True - solver_object.MatrixSolverType = 'default' + solver_object.MatrixSolverType = "default" solver_object.IterationsThermoMechMaximum = 2000 solver_object.IterationsControlParameterTimeUse = True self.assertTrue( @@ -627,19 +627,19 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(solver_object) - fcc_print('Checking FEM new material...') + fcc_print("Checking FEM new material...") material_object = ObjectsFem.makeMaterialSolid( self.active_doc, - 'MechanicalMaterial' + "MechanicalMaterial" ) mat = material_object.Material - mat['Name'] = "Steel-Generic" - mat['YoungsModulus'] = "200000 MPa" - mat['PoissonRatio'] = "0.30" - mat['Density'] = "7900 kg/m^3" - mat['ThermalConductivity'] = "43.27 W/m/K" # SvdW: Change to Ansys model values - mat['ThermalExpansionCoefficient'] = "12 um/m/K" - mat['SpecificHeat'] = "500 J/kg/K" # SvdW: Change to Ansys model values + mat["Name"] = "Steel-Generic" + mat["YoungsModulus"] = "200000 MPa" + mat["PoissonRatio"] = "0.30" + mat["Density"] = "7900 kg/m^3" + mat["ThermalConductivity"] = "43.27 W/m/K" # SvdW: Change to Ansys model values + mat["ThermalExpansionCoefficient"] = "12 um/m/K" + mat["SpecificHeat"] = "500 J/kg/K" # SvdW: Change to Ansys model values material_object.Material = mat self.assertTrue( material_object, @@ -647,7 +647,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(material_object) - fcc_print('Checking FEM new fixed constraint...') + fcc_print("Checking FEM new fixed constraint...") fixed_constraint = self.active_doc.addObject( "Fem::ConstraintFixed", "FemConstraintFixed" @@ -659,7 +659,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(fixed_constraint) - fcc_print('Checking FEM new initial temperature constraint...') + fcc_print("Checking FEM new initial temperature constraint...") initialtemperature_constraint = self.active_doc.addObject( "Fem::ConstraintInitialTemperature", "FemConstraintInitialTemperature" @@ -671,7 +671,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(initialtemperature_constraint) - fcc_print('Checking FEM new temperature constraint...') + fcc_print("Checking FEM new temperature constraint...") temperature_constraint = self.active_doc.addObject( "Fem::ConstraintTemperature", "FemConstraintTemperature" @@ -684,7 +684,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(temperature_constraint) - fcc_print('Checking FEM new heatflux constraint...') + fcc_print("Checking FEM new heatflux constraint...") heatflux_constraint = self.active_doc.addObject( "Fem::ConstraintHeatflux", "FemConstraintHeatflux" @@ -703,7 +703,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(heatflux_constraint) - fcc_print('Checking FEM new mesh...') + fcc_print("Checking FEM new mesh...") from .testfiles.ccx.spine_mesh import create_nodes_spine from .testfiles.ccx.spine_mesh import create_elements_spine mesh = Fem.FemMesh() @@ -718,7 +718,7 @@ class TestCcxTools(unittest.TestCase): "Import of mesh volumes failed" ) mesh_object = self.active_doc.addObject( - 'Fem::FemMeshObject', + "Fem::FemMeshObject", self.mesh_name ) mesh_object.FemMesh = mesh @@ -732,37 +732,37 @@ class TestCcxTools(unittest.TestCase): thermomech_analysis_dir = testtools.get_unit_test_tmp_dir( self.temp_dir, - 'FEM_ccx_thermomech' + "FEM_ccx_thermomech" ) fea = ccxtools.FemToolsCcx(analysis, test_mode=True) fea.update_objects() - fcc_print('Setting up working directory {}'.format(thermomech_analysis_dir)) + fcc_print("Setting up working directory {}".format(thermomech_analysis_dir)) fea.setup_working_dir(thermomech_analysis_dir) self.assertTrue( True if fea.working_dir == thermomech_analysis_dir else False, "Setting working directory {} failed".format(thermomech_analysis_dir) ) - fcc_print('Checking FEM inp file prerequisites for thermo-mechanical analysis...') + fcc_print("Checking FEM inp file prerequisites for thermo-mechanical analysis...") error = fea.check_prerequisites() self.assertFalse( error, "ccxtools check_prerequisites returned error message: {}".format(error) ) - thermomech_base_name = 'spine_thermomech' - inpfile_given = join(self.test_file_dir, (thermomech_base_name + '.inp')) - inpfile_totest = join(thermomech_analysis_dir, (self.mesh_name + '.inp')) - fcc_print('Checking FEM inp file write...') - fcc_print('Writing {} for thermomech analysis'.format(inpfile_totest)) + thermomech_base_name = "spine_thermomech" + inpfile_given = join(self.test_file_dir, (thermomech_base_name + ".inp")) + inpfile_totest = join(thermomech_analysis_dir, (self.mesh_name + ".inp")) + fcc_print("Checking FEM inp file write...") + fcc_print("Writing {} for thermomech analysis".format(inpfile_totest)) error = fea.write_inp_file() self.assertFalse( error, "Writing failed" ) - fcc_print('Comparing {} to {}'.format(inpfile_given, inpfile_totest)) + fcc_print("Comparing {} to {}".format(inpfile_given, inpfile_totest)) ret = testtools.compare_inp_files(inpfile_given, inpfile_totest) self.assertFalse( ret, @@ -770,7 +770,7 @@ class TestCcxTools(unittest.TestCase): ) fcc_print( - 'Setting up working directory to {} in order to read simulated calculations' + "Setting up working directory to {} in order to read simulated calculations" .format(self.test_file_dir) ) fea.setup_working_dir(self.test_file_dir) @@ -779,28 +779,28 @@ class TestCcxTools(unittest.TestCase): "Setting working directory {} failed".format(self.test_file_dir) ) - fcc_print('Setting base name to read test {}.frd file...'.format('spine_thermomech')) + fcc_print("Setting base name to read test {}.frd file...".format("spine_thermomech")) fea.set_base_name(thermomech_base_name) self.assertTrue( True if fea.base_name == thermomech_base_name else False, "Setting base name to {} failed".format(thermomech_base_name) ) - fcc_print('Setting inp file name to read test {}.frd file...'.format('spine_thermomech')) + fcc_print("Setting inp file name to read test {}.frd file...".format("spine_thermomech")) fea.set_inp_file_name() self.assertTrue( True if fea.inp_file_name == inpfile_given else False, "Setting inp file name to {} failed".format(inpfile_given) ) - fcc_print('Checking FEM frd file read from thermomech analysis...') + fcc_print("Checking FEM frd file read from thermomech analysis...") fea.load_results() self.assertTrue( fea.results_present, "Cannot read results from {}.frd frd file".format(fea.base_name) ) - fcc_print('Reading stats from result object for thermomech analysis...') + fcc_print("Reading stats from result object for thermomech analysis...") thermomech_expected_values = join( self.test_file_dir, "spine_thermomech_expected_values" @@ -808,27 +808,27 @@ class TestCcxTools(unittest.TestCase): ret = testtools.compare_stats( fea, thermomech_expected_values, - 'CCX_Results' + "CCX_Results" ) self.assertFalse( ret, "Invalid results read from .frd file" ) - thermomech_save_fc_file = thermomech_analysis_dir + thermomech_base_name + '.FCStd' + thermomech_save_fc_file = thermomech_analysis_dir + thermomech_base_name + ".FCStd" fcc_print( - 'Save FreeCAD file for thermomech analysis to {}...' + "Save FreeCAD file for thermomech analysis to {}..." .format(thermomech_save_fc_file) ) self.active_doc.saveAs(thermomech_save_fc_file) - fcc_print('--------------- End of FEM tests thermomech analysis ---------------') + fcc_print("--------------- End of FEM tests thermomech analysis ---------------") # ******************************************************************************************** def test_5_Flow1D_thermomech_analysis( self ): - fcc_print('--------------- Start of 1D Flow FEM tests ---------------') + fcc_print("--------------- Start of 1D Flow FEM tests ---------------") p1 = FreeCAD.Vector(0, 0, 50) p2 = FreeCAD.Vector(0, 0, -50) @@ -870,22 +870,22 @@ class TestCcxTools(unittest.TestCase): support=None ) - fcc_print('Checking FEM new analysis...') + fcc_print("Checking FEM new analysis...") analysis = ObjectsFem.makeAnalysis( self.active_doc, - 'Analysis' + "Analysis" ) self.assertTrue(analysis, "FemTest of new analysis failed") - fcc_print('Checking FEM new solver...') + fcc_print("Checking FEM new solver...") solver_object = ObjectsFem.makeSolverCalculixCcxTools( self.active_doc, - 'CalculiX' + "CalculiX" ) - solver_object.AnalysisType = 'thermomech' - solver_object.GeometricalNonlinearity = 'linear' + solver_object.AnalysisType = "thermomech" + solver_object.GeometricalNonlinearity = "linear" solver_object.ThermoMechSteadyState = True - solver_object.MatrixSolverType = 'default' + solver_object.MatrixSolverType = "default" solver_object.IterationsThermoMechMaximum = 2000 solver_object.IterationsControlParameterTimeUse = False self.assertTrue( @@ -894,18 +894,18 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(solver_object) - fcc_print('Checking FEM new material...') + fcc_print("Checking FEM new material...") material_object = ObjectsFem.makeMaterialFluid( self.active_doc, - 'FluidMaterial' + "FluidMaterial" ) mat = material_object.Material - mat['Name'] = "Water" - mat['Density'] = "998 kg/m^3" - mat['SpecificHeat'] = "4.182 J/kg/K" - mat['DynamicViscosity'] = "1.003e-3 kg/m/s" - mat['VolumetricThermalExpansionCoefficient'] = "2.07e-4 m/m/K" - mat['ThermalConductivity'] = "0.591 W/m/K" + mat["Name"] = "Water" + mat["Density"] = "998 kg/m^3" + mat["SpecificHeat"] = "4.182 J/kg/K" + mat["DynamicViscosity"] = "1.003e-3 kg/m/s" + mat["VolumetricThermalExpansionCoefficient"] = "2.07e-4 m/m/K" + mat["ThermalConductivity"] = "0.591 W/m/K" material_object.Material = mat self.assertTrue( material_object, @@ -913,13 +913,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(material_object) - fcc_print('Checking FEM Flow1D inlet constraint...') + fcc_print("Checking FEM Flow1D inlet constraint...") Flow1d_inlet = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_inlet.SectionType = 'Liquid' - Flow1d_inlet.LiquidSectionType = 'PIPE INLET' + Flow1d_inlet.SectionType = "Liquid" + Flow1d_inlet.LiquidSectionType = "PIPE INLET" Flow1d_inlet.InletPressure = 0.1 Flow1d_inlet.References = [(line, "Edge1")] self.assertTrue( @@ -928,13 +928,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_inlet) - fcc_print('Checking FEM new Flow1D entrance constraint...') + fcc_print("Checking FEM new Flow1D entrance constraint...") Flow1d_entrance = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_entrance.SectionType = 'Liquid' - Flow1d_entrance.LiquidSectionType = 'PIPE ENTRANCE' + Flow1d_entrance.SectionType = "Liquid" + Flow1d_entrance.LiquidSectionType = "PIPE ENTRANCE" Flow1d_entrance.EntrancePipeArea = 31416.00 Flow1d_entrance.EntranceArea = 25133.00 Flow1d_entrance.References = [(line, "Edge2")] @@ -943,13 +943,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_entrance) - fcc_print('Checking FEM new Flow1D manning constraint...') + fcc_print("Checking FEM new Flow1D manning constraint...") Flow1d_manning = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_manning.SectionType = 'Liquid' - Flow1d_manning.LiquidSectionType = 'PIPE MANNING' + Flow1d_manning.SectionType = "Liquid" + Flow1d_manning.LiquidSectionType = "PIPE MANNING" Flow1d_manning.ManningArea = 31416 Flow1d_manning.ManningRadius = 50 Flow1d_manning.ManningCoefficient = 0.002 @@ -960,13 +960,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_manning) - fcc_print('Checking FEM new Flow1D bend constraint...') + fcc_print("Checking FEM new Flow1D bend constraint...") Flow1d_bend = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_bend.SectionType = 'Liquid' - Flow1d_bend.LiquidSectionType = 'PIPE BEND' + Flow1d_bend.SectionType = "Liquid" + Flow1d_bend.LiquidSectionType = "PIPE BEND" Flow1d_bend.BendPipeArea = 31416 Flow1d_bend.BendRadiusDiameter = 1.5 Flow1d_bend.BendAngle = 45 @@ -978,13 +978,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_bend) - fcc_print('Checking FEM new Flow1D enlargement constraint...') + fcc_print("Checking FEM new Flow1D enlargement constraint...") Flow1d_enlargement = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_enlargement.SectionType = 'Liquid' - Flow1d_enlargement.LiquidSectionType = 'PIPE ENLARGEMENT' + Flow1d_enlargement.SectionType = "Liquid" + Flow1d_enlargement.LiquidSectionType = "PIPE ENLARGEMENT" Flow1d_enlargement.EnlargeArea1 = 31416.00 Flow1d_enlargement.EnlargeArea2 = 70686.00 Flow1d_enlargement.References = [(line, "Edge6")] @@ -994,13 +994,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_enlargement) - fcc_print('Checking FEM new Flow1D manning constraint...') + fcc_print("Checking FEM new Flow1D manning constraint...") Flow1d_manning1 = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_manning1.SectionType = 'Liquid' - Flow1d_manning1.LiquidSectionType = 'PIPE MANNING' + Flow1d_manning1.SectionType = "Liquid" + Flow1d_manning1.LiquidSectionType = "PIPE MANNING" Flow1d_manning1.ManningArea = 70686.00 Flow1d_manning1.ManningRadius = 75 Flow1d_manning1.ManningCoefficient = 0.002 @@ -1011,13 +1011,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_manning1) - fcc_print('Checking FEM new Flow1D contraction constraint...') + fcc_print("Checking FEM new Flow1D contraction constraint...") Flow1d_contraction = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_contraction.SectionType = 'Liquid' - Flow1d_contraction.LiquidSectionType = 'PIPE CONTRACTION' + Flow1d_contraction.SectionType = "Liquid" + Flow1d_contraction.LiquidSectionType = "PIPE CONTRACTION" Flow1d_contraction.ContractArea1 = 70686 Flow1d_contraction.ContractArea2 = 17671 Flow1d_contraction.References = [(line, "Edge8")] @@ -1027,13 +1027,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_contraction) - fcc_print('Checking FEM new Flow1D manning constraint...') + fcc_print("Checking FEM new Flow1D manning constraint...") Flow1d_manning2 = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_manning2.SectionType = 'Liquid' - Flow1d_manning2.LiquidSectionType = 'PIPE MANNING' + Flow1d_manning2.SectionType = "Liquid" + Flow1d_manning2.LiquidSectionType = "PIPE MANNING" Flow1d_manning2.ManningArea = 17671.00 Flow1d_manning2.ManningRadius = 37.5 Flow1d_manning2.ManningCoefficient = 0.002 @@ -1044,13 +1044,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_manning2) - fcc_print('Checking FEM new Flow1D gate valve constraint...') + fcc_print("Checking FEM new Flow1D gate valve constraint...") Flow1d_gate_valve = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_gate_valve.SectionType = 'Liquid' - Flow1d_gate_valve.LiquidSectionType = 'PIPE GATE VALVE' + Flow1d_gate_valve.SectionType = "Liquid" + Flow1d_gate_valve.LiquidSectionType = "PIPE GATE VALVE" Flow1d_gate_valve.GateValvePipeArea = 17671 Flow1d_gate_valve.GateValveClosingCoeff = 0.5 Flow1d_gate_valve.References = [(line, "Edge10")] @@ -1060,13 +1060,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_gate_valve) - fcc_print('Checking FEM new Flow1D enlargement constraint...') + fcc_print("Checking FEM new Flow1D enlargement constraint...") Flow1d_enlargement1 = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_enlargement1.SectionType = 'Liquid' - Flow1d_enlargement1.LiquidSectionType = 'PIPE ENLARGEMENT' + Flow1d_enlargement1.SectionType = "Liquid" + Flow1d_enlargement1.LiquidSectionType = "PIPE ENLARGEMENT" Flow1d_enlargement1.EnlargeArea1 = 17671 Flow1d_enlargement1.EnlargeArea2 = 1e12 Flow1d_enlargement1.References = [(line, "Edge12")] @@ -1076,13 +1076,13 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_enlargement1) - fcc_print('Checking FEM Flow1D outlet constraint...') + fcc_print("Checking FEM Flow1D outlet constraint...") Flow1d_outlet = ObjectsFem.makeElementFluid1D( self.active_doc, "ElementFluid1D" ) - Flow1d_outlet.SectionType = 'Liquid' - Flow1d_outlet.LiquidSectionType = 'PIPE OUTLET' + Flow1d_outlet.SectionType = "Liquid" + Flow1d_outlet.LiquidSectionType = "PIPE OUTLET" Flow1d_outlet.OutletPressure = 0.1 Flow1d_outlet.References = [(line, "Edge13")] self.assertTrue( @@ -1091,7 +1091,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_outlet) - fcc_print('Checking FEM self weight constraint...') + fcc_print("Checking FEM self weight constraint...") Flow1d_self_weight = ObjectsFem.makeConstraintSelfWeight( self.active_doc, "ConstraintSelfWeight" @@ -1105,7 +1105,7 @@ class TestCcxTools(unittest.TestCase): ) analysis.addObject(Flow1d_self_weight) - fcc_print('Checking FEM new mesh...') + fcc_print("Checking FEM new mesh...") from .testfiles.ccx.Flow1D_mesh import create_nodes_Flow1D from .testfiles.ccx.Flow1D_mesh import create_elements_Flow1D mesh = Fem.FemMesh() @@ -1114,7 +1114,7 @@ class TestCcxTools(unittest.TestCase): ret = create_elements_Flow1D(mesh) self.assertTrue(ret, "Import of mesh volumes failed") mesh_object = self.active_doc.addObject( - 'Fem::FemMeshObject', + "Fem::FemMeshObject", self.mesh_name ) mesh_object.FemMesh = mesh @@ -1125,37 +1125,37 @@ class TestCcxTools(unittest.TestCase): Flow1D_thermomech_analysis_dir = testtools.get_unit_test_tmp_dir( self.temp_dir, - 'FEM_ccx_Flow1D_thermomech' + "FEM_ccx_Flow1D_thermomech" ) fea = ccxtools.FemToolsCcx(analysis, test_mode=True) fea.update_objects() - fcc_print('Setting up working directory {}'.format(Flow1D_thermomech_analysis_dir)) + fcc_print("Setting up working directory {}".format(Flow1D_thermomech_analysis_dir)) fea.setup_working_dir(Flow1D_thermomech_analysis_dir) self.assertTrue( True if fea.working_dir == Flow1D_thermomech_analysis_dir else False, "Setting working directory {} failed".format(Flow1D_thermomech_analysis_dir) ) - fcc_print('Checking FEM inp file prerequisites for thermo-mechanical analysis...') + fcc_print("Checking FEM inp file prerequisites for thermo-mechanical analysis...") error = fea.check_prerequisites() self.assertFalse( error, "ccxtools check_prerequisites returned error message: {}".format(error) ) - Flow1D_thermomech_base_name = 'Flow1D_thermomech' - inpfile_given = join(self.test_file_dir, (Flow1D_thermomech_base_name + '.inp')) - inpfile_totest = join(Flow1D_thermomech_analysis_dir, (self.mesh_name + '.inp')) - fcc_print('Checking FEM inp file write...') - fcc_print('Writing {} for thermomech analysis'.format(inpfile_totest)) + Flow1D_thermomech_base_name = "Flow1D_thermomech" + inpfile_given = join(self.test_file_dir, (Flow1D_thermomech_base_name + ".inp")) + inpfile_totest = join(Flow1D_thermomech_analysis_dir, (self.mesh_name + ".inp")) + fcc_print("Checking FEM inp file write...") + fcc_print("Writing {} for thermomech analysis".format(inpfile_totest)) error = fea.write_inp_file() self.assertFalse( error, "Writing failed" ) - fcc_print('Comparing {} to {}'.format(inpfile_given, inpfile_totest)) + fcc_print("Comparing {} to {}".format(inpfile_given, inpfile_totest)) ret = testtools.compare_inp_files(inpfile_given, inpfile_totest) self.assertFalse( ret, @@ -1163,7 +1163,7 @@ class TestCcxTools(unittest.TestCase): ) fcc_print( - 'Setting up working directory to {} in order to read simulated calculations' + "Setting up working directory to {} in order to read simulated calculations" .format(self.test_file_dir) ) fea.setup_working_dir(self.test_file_dir) @@ -1172,28 +1172,28 @@ class TestCcxTools(unittest.TestCase): "Setting working directory {} failed".format(self.test_file_dir) ) - fcc_print('Setting base name to read test {}.frd file...'.format('Flow1D_thermomech')) + fcc_print("Setting base name to read test {}.frd file...".format("Flow1D_thermomech")) fea.set_base_name(Flow1D_thermomech_base_name) self.assertTrue( True if fea.base_name == Flow1D_thermomech_base_name else False, "Setting base name to {} failed".format(Flow1D_thermomech_base_name) ) - fcc_print('Setting inp file name to read test {}.frd file...'.format('Flow1D_thermomech')) + fcc_print("Setting inp file name to read test {}.frd file...".format("Flow1D_thermomech")) fea.set_inp_file_name() self.assertTrue( True if fea.inp_file_name == inpfile_given else False, "Setting inp file name to {} failed".format(inpfile_given) ) - fcc_print('Checking FEM frd file read from Flow1D thermomech analysis...') + fcc_print("Checking FEM frd file read from Flow1D thermomech analysis...") fea.load_results() self.assertTrue( fea.results_present, "Cannot read results from {}.frd frd file".format(fea.base_name) ) - fcc_print('Reading stats from result object for Flow1D thermomech analysis...') + fcc_print("Reading stats from result object for Flow1D thermomech analysis...") Flow1D_thermomech_expected_values = join( self.test_file_dir, "Flow1D_thermomech_expected_values" @@ -1201,7 +1201,7 @@ class TestCcxTools(unittest.TestCase): ret = testtools.compare_stats( fea, Flow1D_thermomech_expected_values, - 'CCX_Time1_0_Results' + "CCX_Time1_0_Results" ) self.assertFalse( ret, @@ -1210,15 +1210,15 @@ class TestCcxTools(unittest.TestCase): Flow1D_thermomech_save_fc_file = join( Flow1D_thermomech_analysis_dir, - (Flow1D_thermomech_base_name + '.FCStd') + (Flow1D_thermomech_base_name + ".FCStd") ) fcc_print( - 'Save FreeCAD file for thermomech analysis to {}...' + "Save FreeCAD file for thermomech analysis to {}..." .format(Flow1D_thermomech_save_fc_file) ) self.active_doc.saveAs(Flow1D_thermomech_save_fc_file) - fcc_print('--------------- End of FEM tests FLow 1D thermomech analysis ---------------') + fcc_print("--------------- End of FEM tests FLow 1D thermomech analysis ---------------") # ******************************************************************************************** def tearDown( @@ -1244,10 +1244,10 @@ def create_test_results(): "Peeq", "Temp", "MFlow", "NPress" ] temp_dir = testtools.get_fem_test_tmp_dir() - static_analysis_dir = temp_dir + 'FEM_ccx_static/' - frequency_analysis_dir = temp_dir + 'FEM_ccx_frequency/' - thermomech_analysis_dir = temp_dir + 'FEM_ccx_thermomech/' - Flow1D_thermomech_analysis_dir = temp_dir + 'FEM_ccx_Flow1D_thermomech/' + static_analysis_dir = temp_dir + "FEM_ccx_static/" + frequency_analysis_dir = temp_dir + "FEM_ccx_frequency/" + thermomech_analysis_dir = temp_dir + "FEM_ccx_thermomech/" + Flow1D_thermomech_analysis_dir = temp_dir + "FEM_ccx_Flow1D_thermomech/" # run all unit tests from this module import Test @@ -1256,7 +1256,7 @@ def create_test_results(): Test.runTestsFromModule(current_module) # static cube - FreeCAD.open(static_analysis_dir + 'cube_static.FCStd') + FreeCAD.open(static_analysis_dir + "cube_static.FCStd") FemGui.setActiveAnalysis(FreeCAD.ActiveDocument.Analysis) fea = ccxtools.FemToolsCcx() fea.update_objects() @@ -1268,7 +1268,7 @@ def create_test_results(): stats_static = [] for s in stat_types: statval = resulttools.get_stats( - FreeCAD.ActiveDocument.getObject('CalculiX_static_results'), + FreeCAD.ActiveDocument.getObject("CalculiX_static_results"), s ) stats_static.append( @@ -1277,21 +1277,21 @@ def create_test_results(): ) static_expected_values_file = join( static_analysis_dir, - 'cube_static_expected_values' + "cube_static_expected_values" ) - f = open(static_expected_values_file, 'w') + f = open(static_expected_values_file, "w") for s in stats_static: f.write(s) f.close() - frd_result_file = os.path.splitext(fea.inp_file_name)[0] + '.frd' - dat_result_file = os.path.splitext(fea.inp_file_name)[0] + '.dat' - frd_static_test_result_file = static_analysis_dir + 'cube_static.frd' - dat_static_test_result_file = static_analysis_dir + 'cube_static.dat' + frd_result_file = os.path.splitext(fea.inp_file_name)[0] + ".frd" + dat_result_file = os.path.splitext(fea.inp_file_name)[0] + ".dat" + frd_static_test_result_file = static_analysis_dir + "cube_static.frd" + dat_static_test_result_file = static_analysis_dir + "cube_static.dat" shutil.copyfile(frd_result_file, frd_static_test_result_file) shutil.copyfile(dat_result_file, dat_static_test_result_file) # frequency cube - FreeCAD.open(frequency_analysis_dir + 'cube_frequency.FCStd') + FreeCAD.open(frequency_analysis_dir + "cube_frequency.FCStd") FemGui.setActiveAnalysis(FreeCAD.ActiveDocument.Analysis) fea = ccxtools.FemToolsCcx() fea.update_objects() @@ -1304,7 +1304,7 @@ def create_test_results(): stats_frequency = [] for s in stat_types: statval = resulttools.get_stats( - FreeCAD.ActiveDocument.getObject('CalculiX_frequency_mode_1_results'), + FreeCAD.ActiveDocument.getObject("CalculiX_frequency_mode_1_results"), s ) stats_frequency.append( @@ -1313,20 +1313,20 @@ def create_test_results(): ) frequency_expected_values_file = join( frequency_analysis_dir, - 'cube_frequency_expected_values' + "cube_frequency_expected_values" ) - f = open(frequency_expected_values_file, 'w') + f = open(frequency_expected_values_file, "w") for s in stats_frequency: f.write(s) f.close() - frd_frequency_test_result_file = frequency_analysis_dir + 'cube_frequency.frd' - dat_frequency_test_result_file = frequency_analysis_dir + 'cube_frequency.dat' + frd_frequency_test_result_file = frequency_analysis_dir + "cube_frequency.frd" + dat_frequency_test_result_file = frequency_analysis_dir + "cube_frequency.dat" shutil.copyfile(frd_result_file, frd_frequency_test_result_file) shutil.copyfile(dat_result_file, dat_frequency_test_result_file) # thermomech print("create thermomech result files") - FreeCAD.open(thermomech_analysis_dir + 'spine_thermomech.FCStd') + FreeCAD.open(thermomech_analysis_dir + "spine_thermomech.FCStd") FemGui.setActiveAnalysis(FreeCAD.ActiveDocument.Analysis) fea = ccxtools.FemToolsCcx() fea.reset_all() @@ -1335,7 +1335,7 @@ def create_test_results(): stats_thermomech = [] for s in stat_types: statval = resulttools.get_stats( - FreeCAD.ActiveDocument.getObject('CalculiX_thermomech_results'), + FreeCAD.ActiveDocument.getObject("CalculiX_thermomech_results"), s ) stats_thermomech.append( @@ -1344,23 +1344,23 @@ def create_test_results(): ) thermomech_expected_values_file = join( thermomech_analysis_dir, - 'spine_thermomech_expected_values' + "spine_thermomech_expected_values" ) - f = open(thermomech_expected_values_file, 'w') + f = open(thermomech_expected_values_file, "w") for s in stats_thermomech: f.write(s) f.close() - frd_result_file = os.path.splitext(fea.inp_file_name)[0] + '.frd' - dat_result_file = os.path.splitext(fea.inp_file_name)[0] + '.dat' - frd_thermomech_test_result_file = thermomech_analysis_dir + 'spine_thermomech.frd' - dat_thermomech_test_result_file = thermomech_analysis_dir + 'spine_thermomech.dat' + frd_result_file = os.path.splitext(fea.inp_file_name)[0] + ".frd" + dat_result_file = os.path.splitext(fea.inp_file_name)[0] + ".dat" + frd_thermomech_test_result_file = thermomech_analysis_dir + "spine_thermomech.frd" + dat_thermomech_test_result_file = thermomech_analysis_dir + "spine_thermomech.dat" shutil.copyfile(frd_result_file, frd_thermomech_test_result_file) shutil.copyfile(dat_result_file, dat_thermomech_test_result_file) - print('Results copied to the appropriate FEM test dirs in: ' + temp_dir) + print("Results copied to the appropriate FEM test dirs in: " + temp_dir) # Flow1D print("create Flow1D result files") - FreeCAD.open(Flow1D_thermomech_analysis_dir + 'Flow1D_thermomech.FCStd') + FreeCAD.open(Flow1D_thermomech_analysis_dir + "Flow1D_thermomech.FCStd") FemGui.setActiveAnalysis(FreeCAD.ActiveDocument.Analysis) fea = ccxtools.FemToolsCcx() fea.reset_all() @@ -1369,7 +1369,7 @@ def create_test_results(): stats_flow1D = [] for s in stat_types: statval = resulttools.get_stats( - FreeCAD.ActiveDocument.getObject('CalculiX_thermomech_time_1_0_results'), + FreeCAD.ActiveDocument.getObject("CalculiX_thermomech_time_1_0_results"), s ) stats_flow1D.append( @@ -1378,28 +1378,28 @@ def create_test_results(): ) Flow1D_thermomech_expected_values_file = join( Flow1D_thermomech_analysis_dir, - 'Flow1D_thermomech_expected_values' + "Flow1D_thermomech_expected_values" ) - f = open(Flow1D_thermomech_expected_values_file, 'w') + f = open(Flow1D_thermomech_expected_values_file, "w") for s in stats_flow1D: f.write(s) f.close() - frd_result_file = os.path.splitext(fea.inp_file_name)[0] + '.frd' - dat_result_file = os.path.splitext(fea.inp_file_name)[0] + '.dat' + frd_result_file = os.path.splitext(fea.inp_file_name)[0] + ".frd" + dat_result_file = os.path.splitext(fea.inp_file_name)[0] + ".dat" frd_Flow1D_thermomech_test_result_file = join( Flow1D_thermomech_analysis_dir, - 'Flow1D_thermomech.frd' + "Flow1D_thermomech.frd" ) dat_Flow1D_thermomech_test_result_file = join( Flow1D_thermomech_analysis_dir, - 'Flow1D_thermomech.dat' + "Flow1D_thermomech.dat" ) shutil.copyfile(frd_result_file, frd_Flow1D_thermomech_test_result_file) shutil.copyfile(dat_result_file, dat_Flow1D_thermomech_test_result_file) - print('Flow1D thermomech results copied to the appropriate FEM test dirs in: ' + temp_dir) + print("Flow1D thermomech results copied to the appropriate FEM test dirs in: " + temp_dir) -''' +""" update the results of FEM ccxtools unit tests: from femtest.testccxtools import create_test_results @@ -1414,4 +1414,4 @@ if FEM unit test is fine --> commit new FEM unit test results TODO compare the inp file of the helper with the inp file of FEM unit tests TODO the better way: move the result creation inside the TestFem and add some preference to deactivate this because it needs ccx -''' +""" diff --git a/src/Mod/Fem/femtest/testcommon.py b/src/Mod/Fem/femtest/testcommon.py index 23cbd68d74..4f5334253c 100644 --- a/src/Mod/Fem/femtest/testcommon.py +++ b/src/Mod/Fem/femtest/testcommon.py @@ -31,7 +31,7 @@ from .utilstest import fcc_print class TestFemCommon(unittest.TestCase): - fcc_print('import TestFemCommon') + fcc_print("import TestFemCommon") # ******************************************************************************************** def setUp( @@ -74,9 +74,9 @@ class TestFemCommon(unittest.TestCase): ref_eles.append("Edge%d" % (i + 1)) cf.References = [(slab, ref_eles)] doc.recompute() - expected_reflist = [(slab, ('Edge1', 'Edge2', 'Edge3', 'Edge4'))] + expected_reflist = [(slab, ("Edge1", "Edge2", "Edge3", "Edge4"))] assert_err_message = ( - 'Adding reference shapes did not result in expected list {} != {}' + "Adding reference shapes did not result in expected list {} != {}" .format(cf.References, expected_reflist) ) self.assertEqual(cf.References, expected_reflist, assert_err_message) @@ -89,37 +89,37 @@ class TestFemCommon(unittest.TestCase): pymodules = [] # collect all Python modules in FEM - pymodules += testtools.collect_python_modules('') # FEM main dir - pymodules += testtools.collect_python_modules('femexamples') - pymodules += testtools.collect_python_modules('feminout') - pymodules += testtools.collect_python_modules('femmesh') - pymodules += testtools.collect_python_modules('femobjects') - pymodules += testtools.collect_python_modules('femresult') - pymodules += testtools.collect_python_modules('femtest') - pymodules += testtools.collect_python_modules('femtools') - pymodules += testtools.collect_python_modules('femsolver') + pymodules += testtools.collect_python_modules("") # FEM main dir + pymodules += testtools.collect_python_modules("femexamples") + pymodules += testtools.collect_python_modules("feminout") + pymodules += testtools.collect_python_modules("femmesh") + pymodules += testtools.collect_python_modules("femobjects") + pymodules += testtools.collect_python_modules("femresult") + pymodules += testtools.collect_python_modules("femtest") + pymodules += testtools.collect_python_modules("femtools") + pymodules += testtools.collect_python_modules("femsolver") # TODO test with join on Windows, the use of os.path.join # in the following code seems to create problems on Windows OS - pymodules += testtools.collect_python_modules('femsolver/elmer') - pymodules += testtools.collect_python_modules('femsolver/elmer/equations') - pymodules += testtools.collect_python_modules('femsolver/z88') - pymodules += testtools.collect_python_modules('femsolver/calculix') + pymodules += testtools.collect_python_modules("femsolver/elmer") + pymodules += testtools.collect_python_modules("femsolver/elmer/equations") + pymodules += testtools.collect_python_modules("femsolver/z88") + pymodules += testtools.collect_python_modules("femsolver/calculix") if FreeCAD.GuiUp: - pymodules += testtools.collect_python_modules('femcommands') - pymodules += testtools.collect_python_modules('femguiobjects') + pymodules += testtools.collect_python_modules("femcommands") + pymodules += testtools.collect_python_modules("femguiobjects") # import all collected modules # fcc_print(pymodules) for mod in pymodules: - fcc_print('Try importing {0} ...'.format(mod)) + fcc_print("Try importing {0} ...".format(mod)) try: - im = __import__('{0}'.format(mod)) + im = __import__("{0}".format(mod)) except ImportError: im = False if not im: # to get an error message what was going wrong - __import__('{0}'.format(mod)) - self.assertTrue(im, 'Problem importing {0}'.format(mod)) + __import__("{0}".format(mod)) + self.assertTrue(im, "Problem importing {0}".format(mod)) # ******************************************************************************************** def tearDown( diff --git a/src/Mod/Fem/femtest/testfemimport.py b/src/Mod/Fem/femtest/testfemimport.py index e91949c4c0..35ff9d9639 100644 --- a/src/Mod/Fem/femtest/testfemimport.py +++ b/src/Mod/Fem/femtest/testfemimport.py @@ -78,7 +78,7 @@ class TestFemImport(unittest.TestCase): # ************************************************************************************************ # to be sure this is run on very first of FEM test this is here and not in objects class TestObjectExistance(unittest.TestCase): - fcc_print('import TestObjectExistance') + fcc_print("import TestObjectExistance") # ******************************************************************************************** def setUp( diff --git a/src/Mod/Fem/femtest/testmaterial.py b/src/Mod/Fem/femtest/testmaterial.py index 9a907650ae..47c43317e8 100644 --- a/src/Mod/Fem/femtest/testmaterial.py +++ b/src/Mod/Fem/femtest/testmaterial.py @@ -31,7 +31,7 @@ from os.path import join class TestMaterialUnits(unittest.TestCase): - fcc_print('import TestMaterialUnits') + fcc_print("import TestMaterialUnits") # ******************************************************************************************** def setUp( @@ -65,11 +65,11 @@ class TestMaterialUnits(unittest.TestCase): known_quantity_parameter = knownquant() from materialtools.cardutils import check_parm_unit as checkparamunit for param in known_quantity_parameter: - fcc_print('{}'.format(param)) + fcc_print("{}".format(param)) self.assertTrue( checkparamunit(param), - 'Unit of quantity material parameter {} ' - 'is not known by FreeCAD unit system.' + "Unit of quantity material parameter {} " + "is not known by FreeCAD unit system." .format(param) ) @@ -89,9 +89,9 @@ class TestMaterialUnits(unittest.TestCase): "Material", "StandardMaterial" ) - fcc_print('{}'.format(builtin_solid_mat_dir)) + fcc_print("{}".format(builtin_solid_mat_dir)) from materialtools.cardutils import add_cards_from_a_dir as addmats - materials, cards, icons = addmats({}, {}, {}, builtin_solid_mat_dir, '') + materials, cards, icons = addmats({}, {}, {}, builtin_solid_mat_dir, "") # get known material quantity parameter from materialtools.cardutils import get_known_material_quantity_parameter as knownquant @@ -100,13 +100,13 @@ class TestMaterialUnits(unittest.TestCase): # check param, value pairs from materialtools.cardutils import check_value_unit as checkvalueunit for mat in materials: - fcc_print('{}'.format(mat)) + fcc_print("{}".format(mat)) for param, value in materials[mat].items(): if param in known_quantities: - # fcc_print(' {} --> {}'.format(param, value)) + # fcc_print(" {} --> {}".format(param, value)) self.assertTrue( checkvalueunit(param, value), - 'Unit of quantity {} from material parameter {} is wrong.' + "Unit of quantity {} from material parameter {} is wrong." .format(value, param) ) diff --git a/src/Mod/Fem/femtest/testmesh.py b/src/Mod/Fem/femtest/testmesh.py index 44357e6227..28dad0c37f 100644 --- a/src/Mod/Fem/femtest/testmesh.py +++ b/src/Mod/Fem/femtest/testmesh.py @@ -33,7 +33,7 @@ from os.path import join class TestMeshCommon(unittest.TestCase): - fcc_print('import TestMeshCommon') + fcc_print("import TestMeshCommon") # ******************************************************************************************** def setUp( @@ -161,7 +161,7 @@ class TestMeshCommon(unittest.TestCase): tetra10.addNode(9, 3, 9, 10) tetra10.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) - unv_file = testtools.get_fem_test_tmp_dir() + '/tetra10_mesh.unv' + unv_file = testtools.get_fem_test_tmp_dir() + "/tetra10_mesh.unv" tetra10.write(unv_file) newmesh = Fem.read(unv_file) expected = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) @@ -189,20 +189,20 @@ class TestMeshCommon(unittest.TestCase): ) seg2.addEdge([1, 2]) - inp_file = testtools.get_fem_test_tmp_dir() + '/seg2_mesh.inp' + inp_file = testtools.get_fem_test_tmp_dir() + "/seg2_mesh.inp" seg2.writeABAQUS(inp_file, 1, False) - read_file = open(inp_file, 'r') - read_node_line = 'line was not found' + read_file = open(inp_file, "r") + read_node_line = "line was not found" for ln in read_file: ln = ln.strip() - if ln.startswith('2, -5'): + if ln.startswith("2, -5"): read_node_line = ln read_file.close() # 1234567 12345678901234567890 12345678901234567890 - expected_win = '2, -5e+018, -1.123456789123e-014, -1.234567890123e-102' - expected_lin = '2, -5e+18, -1.123456789123e-14, -1.234567890123e-102' + expected_win = "2, -5e+018, -1.123456789123e-014, -1.234567890123e-102" + expected_lin = "2, -5e+18, -1.123456789123e-14, -1.234567890123e-102" expected = [expected_lin, expected_win] self.assertTrue( True if read_node_line in expected else False, @@ -222,7 +222,7 @@ class TestMeshCommon(unittest.TestCase): # ************************************************************************************************ # ************************************************************************************************ class TestMeshEleTetra10(unittest.TestCase): - fcc_print('import TestMeshEleTetra10') + fcc_print("import TestMeshEleTetra10") # ******************************************************************************************** def setUp( @@ -240,15 +240,15 @@ class TestMeshEleTetra10(unittest.TestCase): self.active_doc = FreeCAD.ActiveDocument # more inits - self.elem = 'tetra10' + self.elem = "tetra10" self.base_testfile = join( testtools.get_fem_test_home_dir(), - 'mesh', - (self.elem + '_mesh.') + "mesh", + (self.elem + "_mesh.") ) self.base_outfile = join( testtools.get_fem_test_tmp_dir(), - (self.elem + '_mesh.') + (self.elem + "_mesh.") ) # 10 node tetrahedron --> tetra10 femmesh = Fem.FemMesh() @@ -265,8 +265,8 @@ class TestMeshEleTetra10(unittest.TestCase): femmesh.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) self.femmesh = femmesh self.expected_nodes = { - 'count': 10, - 'nodes': { + "count": 10, + "nodes": { 1: FreeCAD.Vector(6.0, 12.0, 18.0), 2: FreeCAD.Vector(0.0, 0.0, 18.0), 3: FreeCAD.Vector(12.0, 0.0, 18.0), @@ -280,16 +280,16 @@ class TestMeshEleTetra10(unittest.TestCase): } } self.expected_elem = { - 'volcount': 1, - 'tetcount': 1, - 'volumes': [1, (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)] + "volcount": 1, + "tetcount": 1, + "volumes": [1, (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)] } - ''' - fcc_print('\n') + """ + fcc_print("\n") fcc_print(expected_nodes) fcc_print(expected_elem) - fcc_print('\n') - ''' + fcc_print("\n") + """ def test_00print( self @@ -319,17 +319,17 @@ class TestMeshEleTetra10(unittest.TestCase): filetyp ): - # ''' + # """ fcc_print([ femmesh_testfile.Volumes[0], femmesh_testfile.getElementNodes(femmesh_outfile.Volumes[0]) ]) - # ''' + # """ # test reading the test mesh self.assertEqual( femmesh_testfile.Nodes, - self.expected_nodes['nodes'], + self.expected_nodes["nodes"], "Test reading {} mesh to {} file failed. Nodes are different.\n".format( self.elem, filetyp @@ -340,7 +340,7 @@ class TestMeshEleTetra10(unittest.TestCase): femmesh_testfile.Volumes[0], femmesh_testfile.getElementNodes(femmesh_outfile.Volumes[0]) ], - self.expected_elem['volumes'], + self.expected_elem["volumes"], "Test reading {} mesh to {} file failed. Volumes are different.\n".format( self.elem, filetyp @@ -349,7 +349,7 @@ class TestMeshEleTetra10(unittest.TestCase): # test reading the written mesh self.assertEqual( femmesh_outfile.Nodes, - self.expected_nodes['nodes'], + self.expected_nodes["nodes"], "Test reading {} mesh to {} file failed. Nodes are different.\n".format( self.elem, filetyp @@ -360,7 +360,7 @@ class TestMeshEleTetra10(unittest.TestCase): femmesh_outfile.Volumes[0], femmesh_outfile.getElementNodes(femmesh_outfile.Volumes[0]) ], - self.expected_elem['volumes'], + self.expected_elem["volumes"], "Test reading {} mesh to {} file failed. Volumes are different.\n".format( self.elem, filetyp @@ -390,13 +390,13 @@ class TestMeshEleTetra10(unittest.TestCase): ): # tetra10 element: creating by Python node_data = { - 'count': self.femmesh.NodeCount, - 'nodes': self.femmesh.Nodes + "count": self.femmesh.NodeCount, + "nodes": self.femmesh.Nodes } elem_data = { - 'volcount': self.femmesh.VolumeCount, - 'tetcount': self.femmesh.TetraCount, - 'volumes': [ + "volcount": self.femmesh.VolumeCount, + "tetcount": self.femmesh.TetraCount, + "volumes": [ self.femmesh.Volumes[0], self.femmesh.getElementNodes(self.femmesh.Volumes[0]) ] @@ -411,12 +411,12 @@ class TestMeshEleTetra10(unittest.TestCase): self.expected_elem, "Elements of Python created " + self.elem + "mesh element are unexpected" ) - ''' + """ obj = doc.addObject("Fem::FemMeshObject" , elem) obj.FemMesh = femmesh obj.Placement.Base = (30,50,0) obj.ViewObject.DisplayMode = "Faces, Wireframe & Nodes" - ''' + """ # ******************************************************************************************** def test_tetra10_inp( @@ -424,7 +424,7 @@ class TestMeshEleTetra10(unittest.TestCase): ): # tetra10 element: reading from and writing to inp mesh file format - file_extension = 'inp' + file_extension = "inp" outfile, testfile = self.get_file_paths(file_extension) self.femmesh.writeABAQUS(outfile, 1, False) # write the mesh @@ -443,7 +443,7 @@ class TestMeshEleTetra10(unittest.TestCase): ): # tetra10 element: reading from and writing to unv mesh file format - file_extension = 'unv' + file_extension = "unv" outfile, testfile = self.get_file_paths(file_extension) self.femmesh.write(outfile) # write the mesh @@ -462,7 +462,7 @@ class TestMeshEleTetra10(unittest.TestCase): ): # tetra10 element: reading from and writing to unv mesh file format - file_extension = 'vtk' + file_extension = "vtk" outfile, testfile = self.get_file_paths(file_extension) if "BUILD_FEM_VTK" in FreeCAD.__cmake__: @@ -476,7 +476,7 @@ class TestMeshEleTetra10(unittest.TestCase): file_extension ) else: - fcc_print('FEM_VTK post processing is disabled.') + fcc_print("FEM_VTK post processing is disabled.") # ******************************************************************************************** def test_tetra10_yml( @@ -484,7 +484,7 @@ class TestMeshEleTetra10(unittest.TestCase): ): # tetra10 element: reading from and writing to yaml/json mesh file format - file_extension = 'yml' + file_extension = "yml" outfile, testfile = self.get_file_paths(file_extension) # TODO: implement yaml/json mesh reader writer method calls in C++ @@ -510,7 +510,7 @@ class TestMeshEleTetra10(unittest.TestCase): ): # tetra10 element: reading from and writing to z88 mesh file format - file_extension = 'z88' + file_extension = "z88" outfile, testfile = self.get_file_paths(file_extension) self.femmesh.write(outfile) # write the mesh diff --git a/src/Mod/Fem/femtest/testobject.py b/src/Mod/Fem/femtest/testobject.py index ab9f25f705..a24aba05ab 100644 --- a/src/Mod/Fem/femtest/testobject.py +++ b/src/Mod/Fem/femtest/testobject.py @@ -31,7 +31,7 @@ from .utilstest import fcc_print class TestObjectCreate(unittest.TestCase): - fcc_print('import TestObjectCreate') + fcc_print("import TestObjectCreate") # ******************************************************************************************** def setUp( @@ -147,7 +147,7 @@ class TestObjectCreate(unittest.TestCase): # ************************************************************************************************ # ************************************************************************************************ class TestObjectType(unittest.TestCase): - fcc_print('import TestObjectType') + fcc_print("import TestObjectType") # ******************************************************************************************** def setUp( @@ -172,180 +172,180 @@ class TestObjectType(unittest.TestCase): from femtools.femutils import type_of_obj self.assertEqual( - 'Fem::FemAnalysis', + "Fem::FemAnalysis", type_of_obj(ObjectsFem.makeAnalysis(doc)) ) self.assertEqual( - 'Fem::ConstraintBearing', + "Fem::ConstraintBearing", type_of_obj(ObjectsFem.makeConstraintBearing(doc)) ) self.assertEqual( - 'Fem::ConstraintBodyHeatSource', + "Fem::ConstraintBodyHeatSource", type_of_obj(ObjectsFem.makeConstraintBodyHeatSource(doc)) ) self.assertEqual( - 'Fem::ConstraintContact', + "Fem::ConstraintContact", type_of_obj(ObjectsFem.makeConstraintContact(doc)) ) self.assertEqual( - 'Fem::ConstraintDisplacement', + "Fem::ConstraintDisplacement", type_of_obj(ObjectsFem.makeConstraintDisplacement(doc)) ) self.assertEqual( - 'Fem::ConstraintElectrostaticPotential', + "Fem::ConstraintElectrostaticPotential", type_of_obj(ObjectsFem.makeConstraintElectrostaticPotential(doc)) ) self.assertEqual( - 'Fem::ConstraintFixed', + "Fem::ConstraintFixed", type_of_obj(ObjectsFem.makeConstraintFixed(doc)) ) self.assertEqual( - 'Fem::ConstraintFlowVelocity', + "Fem::ConstraintFlowVelocity", type_of_obj(ObjectsFem.makeConstraintFlowVelocity(doc)) ) self.assertEqual( - 'Fem::ConstraintFluidBoundary', + "Fem::ConstraintFluidBoundary", type_of_obj(ObjectsFem.makeConstraintFluidBoundary(doc)) ) self.assertEqual( - 'Fem::ConstraintForce', + "Fem::ConstraintForce", type_of_obj(ObjectsFem.makeConstraintForce(doc)) ) self.assertEqual( - 'Fem::ConstraintGear', + "Fem::ConstraintGear", type_of_obj(ObjectsFem.makeConstraintGear(doc)) ) self.assertEqual( - 'Fem::ConstraintHeatflux', + "Fem::ConstraintHeatflux", type_of_obj(ObjectsFem.makeConstraintHeatflux(doc)) ) self.assertEqual( - 'Fem::ConstraintInitialFlowVelocity', + "Fem::ConstraintInitialFlowVelocity", type_of_obj(ObjectsFem.makeConstraintInitialFlowVelocity(doc)) ) self.assertEqual( - 'Fem::ConstraintInitialTemperature', + "Fem::ConstraintInitialTemperature", type_of_obj(ObjectsFem.makeConstraintInitialTemperature(doc)) ) self.assertEqual( - 'Fem::ConstraintPlaneRotation', + "Fem::ConstraintPlaneRotation", type_of_obj(ObjectsFem.makeConstraintPlaneRotation(doc)) ) self.assertEqual( - 'Fem::ConstraintPressure', + "Fem::ConstraintPressure", type_of_obj(ObjectsFem.makeConstraintPressure(doc)) ) self.assertEqual( - 'Fem::ConstraintPulley', + "Fem::ConstraintPulley", type_of_obj(ObjectsFem.makeConstraintPulley(doc)) ) self.assertEqual( - 'Fem::ConstraintSelfWeight', + "Fem::ConstraintSelfWeight", type_of_obj(ObjectsFem.makeConstraintSelfWeight(doc)) ) self.assertEqual( - 'Fem::ConstraintTemperature', + "Fem::ConstraintTemperature", type_of_obj(ObjectsFem.makeConstraintTemperature(doc)) ) self.assertEqual( - 'Fem::ConstraintTransform', + "Fem::ConstraintTransform", type_of_obj(ObjectsFem.makeConstraintTransform(doc)) ) self.assertEqual( - 'Fem::FemElementFluid1D', + "Fem::FemElementFluid1D", type_of_obj(ObjectsFem.makeElementFluid1D(doc)) ) self.assertEqual( - 'Fem::FemElementGeometry1D', + "Fem::FemElementGeometry1D", type_of_obj(ObjectsFem.makeElementGeometry1D(doc)) ) self.assertEqual( - 'Fem::FemElementGeometry2D', + "Fem::FemElementGeometry2D", type_of_obj(ObjectsFem.makeElementGeometry2D(doc)) ) self.assertEqual( - 'Fem::FemElementRotation1D', + "Fem::FemElementRotation1D", type_of_obj(ObjectsFem.makeElementRotation1D(doc)) ) materialsolid = ObjectsFem.makeMaterialSolid(doc) self.assertEqual( - 'Fem::Material', + "Fem::Material", type_of_obj(ObjectsFem.makeMaterialFluid(doc)) ) self.assertEqual( - 'Fem::Material', + "Fem::Material", type_of_obj(materialsolid)) self.assertEqual( - 'Fem::MaterialMechanicalNonlinear', + "Fem::MaterialMechanicalNonlinear", type_of_obj(ObjectsFem.makeMaterialMechanicalNonlinear(doc, materialsolid)) ) self.assertEqual( - 'Fem::MaterialReinforced', + "Fem::MaterialReinforced", type_of_obj(ObjectsFem.makeMaterialReinforced(doc)) ) mesh = ObjectsFem.makeMeshGmsh(doc) self.assertEqual( - 'Fem::FemMeshGmsh', + "Fem::FemMeshGmsh", type_of_obj(mesh)) self.assertEqual( - 'Fem::FemMeshBoundaryLayer', + "Fem::FemMeshBoundaryLayer", type_of_obj(ObjectsFem.makeMeshBoundaryLayer(doc, mesh)) ) self.assertEqual( - 'Fem::FemMeshGroup', + "Fem::FemMeshGroup", type_of_obj(ObjectsFem.makeMeshGroup(doc, mesh)) ) self.assertEqual( - 'Fem::FemMeshRegion', + "Fem::FemMeshRegion", type_of_obj(ObjectsFem.makeMeshRegion(doc, mesh)) ) self.assertEqual( - 'Fem::FemMeshShapeNetgenObject', + "Fem::FemMeshShapeNetgenObject", type_of_obj(ObjectsFem.makeMeshNetgen(doc)) ) self.assertEqual( - 'Fem::FemMeshResult', + "Fem::FemMeshResult", type_of_obj(ObjectsFem.makeMeshResult(doc)) ) self.assertEqual( - 'Fem::FemResultMechanical', + "Fem::FemResultMechanical", type_of_obj(ObjectsFem.makeResultMechanical(doc)) ) solverelmer = ObjectsFem.makeSolverElmer(doc) self.assertEqual( - 'Fem::FemSolverCalculixCcxTools', + "Fem::FemSolverCalculixCcxTools", type_of_obj(ObjectsFem.makeSolverCalculixCcxTools(doc)) ) self.assertEqual( - 'Fem::FemSolverObjectCalculix', + "Fem::FemSolverObjectCalculix", type_of_obj(ObjectsFem.makeSolverCalculix(doc)) ) self.assertEqual( - 'Fem::FemSolverObjectElmer', + "Fem::FemSolverObjectElmer", type_of_obj(solverelmer) ) self.assertEqual( - 'Fem::FemSolverObjectZ88', + "Fem::FemSolverObjectZ88", type_of_obj(ObjectsFem.makeSolverZ88(doc)) ) self.assertEqual( - 'Fem::FemEquationElmerElasticity', + "Fem::FemEquationElmerElasticity", type_of_obj(ObjectsFem.makeEquationElasticity(doc, solverelmer)) ) self.assertEqual( - 'Fem::FemEquationElmerElectrostatic', + "Fem::FemEquationElmerElectrostatic", type_of_obj(ObjectsFem.makeEquationElectrostatic(doc, solverelmer)) ) self.assertEqual( - 'Fem::FemEquationElmerFlow', + "Fem::FemEquationElmerFlow", type_of_obj(ObjectsFem.makeEquationFlow(doc, solverelmer)) ) self.assertEqual( - 'Fem::FemEquationElmerFluxsolver', + "Fem::FemEquationElmerFluxsolver", type_of_obj(ObjectsFem.makeEquationFluxsolver(doc, solverelmer)) ) self.assertEqual( - 'Fem::FemEquationElmerHeat', + "Fem::FemEquationElmerHeat", type_of_obj(ObjectsFem.makeEquationHeat(doc, solverelmer)) ) # is = 44 tests (just copy in empty file to test) @@ -361,182 +361,182 @@ class TestObjectType(unittest.TestCase): from femtools.femutils import is_of_type self.assertTrue(is_of_type( ObjectsFem.makeAnalysis(doc), - 'Fem::FemAnalysis' + "Fem::FemAnalysis" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintBearing(doc), - 'Fem::ConstraintBearing' + "Fem::ConstraintBearing" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintBodyHeatSource(doc), - 'Fem::ConstraintBodyHeatSource' + "Fem::ConstraintBodyHeatSource" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintContact(doc), - 'Fem::ConstraintContact' + "Fem::ConstraintContact" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintDisplacement(doc), - 'Fem::ConstraintDisplacement' + "Fem::ConstraintDisplacement" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintElectrostaticPotential(doc), - 'Fem::ConstraintElectrostaticPotential' + "Fem::ConstraintElectrostaticPotential" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintFixed(doc), - 'Fem::ConstraintFixed' + "Fem::ConstraintFixed" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintFlowVelocity(doc), - 'Fem::ConstraintFlowVelocity' + "Fem::ConstraintFlowVelocity" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintFluidBoundary(doc), - 'Fem::ConstraintFluidBoundary' + "Fem::ConstraintFluidBoundary" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintForce(doc), - 'Fem::ConstraintForce' + "Fem::ConstraintForce" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintGear(doc), - 'Fem::ConstraintGear' + "Fem::ConstraintGear" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintHeatflux(doc), - 'Fem::ConstraintHeatflux' + "Fem::ConstraintHeatflux" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintInitialFlowVelocity(doc), - 'Fem::ConstraintInitialFlowVelocity' + "Fem::ConstraintInitialFlowVelocity" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintInitialTemperature(doc), - 'Fem::ConstraintInitialTemperature' + "Fem::ConstraintInitialTemperature" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintPlaneRotation(doc), - 'Fem::ConstraintPlaneRotation' + "Fem::ConstraintPlaneRotation" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintPressure(doc), - 'Fem::ConstraintPressure' + "Fem::ConstraintPressure" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintPulley(doc), - 'Fem::ConstraintPulley' + "Fem::ConstraintPulley" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintSelfWeight(doc), - 'Fem::ConstraintSelfWeight' + "Fem::ConstraintSelfWeight" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintTemperature(doc), - 'Fem::ConstraintTemperature' + "Fem::ConstraintTemperature" )) self.assertTrue(is_of_type( ObjectsFem.makeConstraintTransform(doc), - 'Fem::ConstraintTransform' + "Fem::ConstraintTransform" )) self.assertTrue(is_of_type( ObjectsFem.makeElementFluid1D(doc), - 'Fem::FemElementFluid1D' + "Fem::FemElementFluid1D" )) self.assertTrue(is_of_type( ObjectsFem.makeElementGeometry1D(doc), - 'Fem::FemElementGeometry1D' + "Fem::FemElementGeometry1D" )) self.assertTrue(is_of_type( ObjectsFem.makeElementGeometry2D(doc), - 'Fem::FemElementGeometry2D' + "Fem::FemElementGeometry2D" )) self.assertTrue(is_of_type( ObjectsFem.makeElementRotation1D(doc), - 'Fem::FemElementRotation1D' + "Fem::FemElementRotation1D" )) materialsolid = ObjectsFem.makeMaterialSolid(doc) self.assertTrue(is_of_type( ObjectsFem.makeMaterialFluid(doc), - 'Fem::Material' + "Fem::Material" )) self.assertTrue(is_of_type( materialsolid, - 'Fem::Material' + "Fem::Material" )) self.assertTrue(is_of_type( ObjectsFem.makeMaterialMechanicalNonlinear(doc, materialsolid), - 'Fem::MaterialMechanicalNonlinear' + "Fem::MaterialMechanicalNonlinear" )) self.assertTrue(is_of_type( ObjectsFem.makeMaterialReinforced(doc), - 'Fem::MaterialReinforced' + "Fem::MaterialReinforced" )) mesh = ObjectsFem.makeMeshGmsh(doc) self.assertTrue(is_of_type( mesh, - 'Fem::FemMeshGmsh' + "Fem::FemMeshGmsh" )) self.assertTrue(is_of_type( ObjectsFem.makeMeshBoundaryLayer(doc, mesh), - 'Fem::FemMeshBoundaryLayer' + "Fem::FemMeshBoundaryLayer" )) self.assertTrue(is_of_type( ObjectsFem.makeMeshGroup(doc, mesh), - 'Fem::FemMeshGroup' + "Fem::FemMeshGroup" )) self.assertTrue(is_of_type( ObjectsFem.makeMeshRegion(doc, mesh), - 'Fem::FemMeshRegion' + "Fem::FemMeshRegion" )) self.assertTrue(is_of_type( ObjectsFem.makeMeshNetgen(doc), - 'Fem::FemMeshShapeNetgenObject' + "Fem::FemMeshShapeNetgenObject" )) self.assertTrue(is_of_type( ObjectsFem.makeMeshResult(doc), - 'Fem::FemMeshResult' + "Fem::FemMeshResult" )) self.assertTrue(is_of_type( ObjectsFem.makeResultMechanical(doc), - 'Fem::FemResultMechanical' + "Fem::FemResultMechanical" )) solverelmer = ObjectsFem.makeSolverElmer(doc) self.assertTrue(is_of_type( ObjectsFem.makeSolverCalculixCcxTools(doc), - 'Fem::FemSolverCalculixCcxTools' + "Fem::FemSolverCalculixCcxTools" )) self.assertTrue(is_of_type( ObjectsFem.makeSolverCalculix(doc), - 'Fem::FemSolverObjectCalculix' + "Fem::FemSolverObjectCalculix" )) self.assertTrue(is_of_type( solverelmer, - 'Fem::FemSolverObjectElmer' + "Fem::FemSolverObjectElmer" )) self.assertTrue(is_of_type( ObjectsFem.makeSolverZ88(doc), - 'Fem::FemSolverObjectZ88' + "Fem::FemSolverObjectZ88" )) self.assertTrue(is_of_type( ObjectsFem.makeEquationElasticity(doc, solverelmer), - 'Fem::FemEquationElmerElasticity' + "Fem::FemEquationElmerElasticity" )) self.assertTrue(is_of_type( ObjectsFem.makeEquationElectrostatic(doc, solverelmer), - 'Fem::FemEquationElmerElectrostatic' + "Fem::FemEquationElmerElectrostatic" )) self.assertTrue(is_of_type( ObjectsFem.makeEquationFlow(doc, solverelmer), - 'Fem::FemEquationElmerFlow' + "Fem::FemEquationElmerFlow" )) self.assertTrue(is_of_type( ObjectsFem.makeEquationFluxsolver(doc, solverelmer), - 'Fem::FemEquationElmerFluxsolver' + "Fem::FemEquationElmerFluxsolver" )) self.assertTrue(is_of_type( ObjectsFem.makeEquationHeat(doc, solverelmer), - 'Fem::FemEquationElmerHeat' + "Fem::FemEquationElmerHeat" )) # is = 44 tests (just copy in empty file to test) @@ -557,615 +557,615 @@ class TestObjectType(unittest.TestCase): # FemAnalysis self.assertTrue(is_derived_from( ObjectsFem.makeAnalysis(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeAnalysis(doc), - 'Fem::FemAnalysis' + "Fem::FemAnalysis" )) # ConstraintBearing self.assertTrue(is_derived_from( ObjectsFem.makeConstraintBearing(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintBearing(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintBearing(doc), - 'Fem::ConstraintBearing' + "Fem::ConstraintBearing" )) # ConstraintBodyHeatSource self.assertTrue(is_derived_from( ObjectsFem.makeConstraintBodyHeatSource(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintBodyHeatSource(doc), - 'Fem::ConstraintPython' + "Fem::ConstraintPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintBodyHeatSource(doc), - 'Fem::ConstraintBodyHeatSource' + "Fem::ConstraintBodyHeatSource" )) # ConstraintContact self.assertTrue(is_derived_from( ObjectsFem.makeConstraintContact(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintContact(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintContact(doc), - 'Fem::ConstraintContact' + "Fem::ConstraintContact" )) # ConstraintDisplacement self.assertTrue(is_derived_from( ObjectsFem.makeConstraintDisplacement(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintDisplacement(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintDisplacement(doc), - 'Fem::ConstraintDisplacement' + "Fem::ConstraintDisplacement" )) # ConstraintElectrostaticPotential self.assertTrue(is_derived_from( ObjectsFem.makeConstraintElectrostaticPotential(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintElectrostaticPotential(doc), - 'Fem::ConstraintPython' + "Fem::ConstraintPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintElectrostaticPotential(doc), - 'Fem::ConstraintElectrostaticPotential' + "Fem::ConstraintElectrostaticPotential" )) # ConstraintFixed self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFixed(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFixed(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFixed(doc), - 'Fem::ConstraintFixed' + "Fem::ConstraintFixed" )) # ConstraintFlowVelocity self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFlowVelocity(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFlowVelocity(doc), - 'Fem::ConstraintPython' + "Fem::ConstraintPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFlowVelocity(doc), - 'Fem::ConstraintFlowVelocity' + "Fem::ConstraintFlowVelocity" )) # ConstraintFluidBoundary self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFluidBoundary(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFluidBoundary(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintFluidBoundary(doc), - 'Fem::ConstraintFluidBoundary' + "Fem::ConstraintFluidBoundary" )) # ConstraintForce self.assertTrue(is_derived_from( ObjectsFem.makeConstraintForce(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintForce(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintForce(doc), - 'Fem::ConstraintForce' + "Fem::ConstraintForce" )) # ConstraintGear self.assertTrue(is_derived_from( ObjectsFem.makeConstraintGear(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintGear(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintGear(doc), - 'Fem::ConstraintGear' + "Fem::ConstraintGear" )) # ConstraintHeatflux self.assertTrue(is_derived_from( ObjectsFem.makeConstraintHeatflux(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintHeatflux(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintHeatflux(doc), - 'Fem::ConstraintHeatflux' + "Fem::ConstraintHeatflux" )) # ConstraintInitialFlowVelocity self.assertTrue(is_derived_from( ObjectsFem.makeConstraintInitialFlowVelocity(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintInitialFlowVelocity(doc), - 'Fem::ConstraintPython' + "Fem::ConstraintPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintInitialFlowVelocity(doc), - 'Fem::ConstraintInitialFlowVelocity' + "Fem::ConstraintInitialFlowVelocity" )) # ConstraintInitialTemperature self.assertTrue(is_derived_from( ObjectsFem.makeConstraintInitialTemperature(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintInitialTemperature(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintInitialTemperature(doc), - 'Fem::ConstraintInitialTemperature' + "Fem::ConstraintInitialTemperature" )) # ConstraintPlaneRotation self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPlaneRotation(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPlaneRotation(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPlaneRotation(doc), - 'Fem::ConstraintPlaneRotation' + "Fem::ConstraintPlaneRotation" )) # ConstraintPressure self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPressure(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPressure(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPressure(doc), - 'Fem::ConstraintPressure' + "Fem::ConstraintPressure" )) # ConstraintPulley self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPulley(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPulley(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintPulley(doc), - 'Fem::ConstraintPulley' + "Fem::ConstraintPulley" )) # ConstraintSelfWeight self.assertTrue(is_derived_from( ObjectsFem.makeConstraintSelfWeight(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintSelfWeight(doc), - 'Fem::ConstraintPython' + "Fem::ConstraintPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintSelfWeight(doc), - 'Fem::ConstraintSelfWeight' + "Fem::ConstraintSelfWeight" )) # ConstraintTemperature self.assertTrue(is_derived_from( ObjectsFem.makeConstraintTemperature(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintTemperature(doc), - 'Fem::Constraint' + "Fem::Constraint" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintTemperature(doc), - 'Fem::ConstraintTemperature' + "Fem::ConstraintTemperature" )) # ConstraintTransform self.assertTrue(is_derived_from( ObjectsFem.makeConstraintTransform(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeConstraintTransform(doc), - 'Fem::ConstraintTransform' + "Fem::ConstraintTransform" )) # FemElementFluid1D self.assertTrue(is_derived_from( ObjectsFem.makeElementFluid1D(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementFluid1D(doc), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementFluid1D(doc), - 'Fem::FemElementFluid1D' + "Fem::FemElementFluid1D" )) # FemElementGeometry1D self.assertTrue(is_derived_from( ObjectsFem.makeElementGeometry1D(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementGeometry1D(doc), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementGeometry1D(doc), - 'Fem::FemElementGeometry1D' + "Fem::FemElementGeometry1D" )) # FemElementGeometry2D self.assertTrue(is_derived_from( ObjectsFem.makeElementGeometry2D(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementGeometry2D(doc), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementGeometry2D(doc), - 'Fem::FemElementGeometry2D' + "Fem::FemElementGeometry2D" )) # FemElementRotation1D self.assertTrue(is_derived_from( ObjectsFem.makeElementRotation1D(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementRotation1D(doc), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeElementRotation1D(doc), - 'Fem::FemElementRotation1D' + "Fem::FemElementRotation1D" )) # Material self.assertTrue(is_derived_from( ObjectsFem.makeMaterialFluid(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMaterialFluid(doc), - 'App::MaterialObjectPython' + "App::MaterialObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMaterialFluid(doc), - 'Fem::Material' + "Fem::Material" )) # Material self.assertTrue(is_derived_from( - materialsolid, 'App::DocumentObject' + materialsolid, "App::DocumentObject" )) self.assertTrue(is_derived_from( - materialsolid, 'App::MaterialObjectPython' + materialsolid, "App::MaterialObjectPython" )) self.assertTrue(is_derived_from( - materialsolid, 'Fem::Material' + materialsolid, "Fem::Material" )) # MaterialMechanicalNonlinear self.assertTrue(is_derived_from( ObjectsFem.makeMaterialMechanicalNonlinear(doc, materialsolid), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMaterialMechanicalNonlinear(doc, materialsolid), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMaterialMechanicalNonlinear(doc, materialsolid), - 'Fem::MaterialMechanicalNonlinear' + "Fem::MaterialMechanicalNonlinear" )) # MaterialReinforced self.assertTrue(is_derived_from( ObjectsFem.makeMaterialReinforced(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMaterialReinforced(doc), - 'App::MaterialObjectPython' + "App::MaterialObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMaterialReinforced(doc), - 'Fem::MaterialReinforced' + "Fem::MaterialReinforced" )) # FemMeshGmsh self.assertTrue(is_derived_from( - mesh, 'App::DocumentObject' + mesh, "App::DocumentObject" )) self.assertTrue(is_derived_from( - mesh, 'Fem::FemMeshObjectPython' + mesh, "Fem::FemMeshObjectPython" )) self.assertTrue(is_derived_from( - mesh, 'Fem::FemMeshGmsh' + mesh, "Fem::FemMeshGmsh" )) # FemMeshBoundaryLayer self.assertTrue(is_derived_from( ObjectsFem.makeMeshBoundaryLayer(doc, mesh), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshBoundaryLayer(doc, mesh), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshBoundaryLayer(doc, mesh), - 'Fem::FemMeshBoundaryLayer' + "Fem::FemMeshBoundaryLayer" )) # FemMeshGroup self.assertTrue(is_derived_from( ObjectsFem.makeMeshGroup(doc, mesh), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshGroup(doc, mesh), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshGroup(doc, mesh), - 'Fem::FemMeshGroup' + "Fem::FemMeshGroup" )) # FemMeshRegion self.assertTrue(is_derived_from( ObjectsFem.makeMeshRegion(doc, mesh), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshRegion(doc, mesh), - 'Fem::FeaturePython' + "Fem::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshRegion(doc, mesh), - 'Fem::FemMeshRegion' + "Fem::FemMeshRegion" )) # FemMeshShapeNetgenObject self.assertTrue(is_derived_from( ObjectsFem.makeMeshNetgen(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshNetgen(doc), - 'Fem::FemMeshShapeNetgenObject' + "Fem::FemMeshShapeNetgenObject" )) # FemMeshResult self.assertTrue(is_derived_from( ObjectsFem.makeMeshResult(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshResult(doc), - 'Fem::FemMeshObjectPython' + "Fem::FemMeshObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeMeshResult(doc), - 'Fem::FemMeshResult' + "Fem::FemMeshResult" )) # FemResultMechanical self.assertTrue(is_derived_from( ObjectsFem.makeResultMechanical(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeResultMechanical(doc), - 'Fem::FemResultObjectPython' + "Fem::FemResultObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeResultMechanical(doc), - 'Fem::FemResultMechanical' + "Fem::FemResultMechanical" )) # FemSolverCalculixCcxTools self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculixCcxTools(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculixCcxTools(doc), - 'Fem::FemSolverObject' + "Fem::FemSolverObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculixCcxTools(doc), - 'Fem::FemSolverObjectPython' + "Fem::FemSolverObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculixCcxTools(doc), - 'Fem::FemSolverCalculixCcxTools' + "Fem::FemSolverCalculixCcxTools" )) # FemSolverObjectCalculix self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculix(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculix(doc), - 'Fem::FemSolverObject' + "Fem::FemSolverObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculix(doc), - 'Fem::FemSolverObjectPython' + "Fem::FemSolverObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverCalculix(doc), - 'Fem::FemSolverObjectCalculix' + "Fem::FemSolverObjectCalculix" )) # FemSolverObjectElmer self.assertTrue(is_derived_from( solverelmer, - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( solverelmer, - 'Fem::FemSolverObject' + "Fem::FemSolverObject" )) self.assertTrue(is_derived_from( solverelmer, - 'Fem::FemSolverObjectPython' + "Fem::FemSolverObjectPython" )) self.assertTrue(is_derived_from( solverelmer, - 'Fem::FemSolverObjectElmer' + "Fem::FemSolverObjectElmer" )) # FemSolverObjectZ88 self.assertTrue(is_derived_from( ObjectsFem.makeSolverZ88(doc), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverZ88(doc), - 'Fem::FemSolverObject' + "Fem::FemSolverObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverZ88(doc), - 'Fem::FemSolverObjectPython' + "Fem::FemSolverObjectPython" )) self.assertTrue(is_derived_from( ObjectsFem.makeSolverZ88(doc), - 'Fem::FemSolverObjectZ88' + "Fem::FemSolverObjectZ88" )) # FemEquationElmerElasticity self.assertTrue(is_derived_from( ObjectsFem.makeEquationElasticity(doc, solverelmer), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationElasticity(doc, solverelmer), - 'App::FeaturePython' + "App::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationElasticity(doc, solverelmer), - 'Fem::FemEquationElmerElasticity' + "Fem::FemEquationElmerElasticity" )) # FemEquationElmerElectrostatic self.assertTrue(is_derived_from( ObjectsFem.makeEquationElectrostatic(doc, solverelmer), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationElectrostatic(doc, solverelmer), - 'App::FeaturePython' + "App::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationElectrostatic(doc, solverelmer), - 'Fem::FemEquationElmerElectrostatic' + "Fem::FemEquationElmerElectrostatic" )) # FemEquationElmerFlow self.assertTrue(is_derived_from( ObjectsFem.makeEquationFlow(doc, solverelmer), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationFlow(doc, solverelmer), - 'App::FeaturePython' + "App::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationFlow(doc, solverelmer), - 'Fem::FemEquationElmerFlow' + "Fem::FemEquationElmerFlow" )) # FemEquationElmerFluxsolver self.assertTrue(is_derived_from( ObjectsFem.makeEquationFluxsolver(doc, solverelmer), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationFluxsolver(doc, solverelmer), - 'App::FeaturePython' + "App::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationFluxsolver(doc, solverelmer), - 'Fem::FemEquationElmerFluxsolver' + "Fem::FemEquationElmerFluxsolver" )) # FemEquationElmerHeat self.assertTrue(is_derived_from( ObjectsFem.makeEquationHeat(doc, solverelmer), - 'App::DocumentObject' + "App::DocumentObject" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationHeat(doc, solverelmer), - 'App::FeaturePython' + "App::FeaturePython" )) self.assertTrue(is_derived_from( ObjectsFem.makeEquationHeat(doc, solverelmer), - 'Fem::FemEquationElmerHeat' + "Fem::FemEquationElmerHeat" )) # ******************************************************************************************** @@ -1178,224 +1178,224 @@ class TestObjectType(unittest.TestCase): self.assertTrue( ObjectsFem.makeAnalysis( doc - ).isDerivedFrom('Fem::FemAnalysis') + ).isDerivedFrom("Fem::FemAnalysis") ) self.assertTrue( ObjectsFem.makeConstraintBearing( doc - ).isDerivedFrom('Fem::ConstraintBearing') + ).isDerivedFrom("Fem::ConstraintBearing") ) self.assertTrue( ObjectsFem.makeConstraintBodyHeatSource( - doc).isDerivedFrom('Fem::ConstraintPython') + doc).isDerivedFrom("Fem::ConstraintPython") ) self.assertTrue( ObjectsFem.makeConstraintContact( doc - ).isDerivedFrom('Fem::ConstraintContact') + ).isDerivedFrom("Fem::ConstraintContact") ) self.assertTrue( ObjectsFem.makeConstraintDisplacement( doc - ).isDerivedFrom('Fem::ConstraintDisplacement') + ).isDerivedFrom("Fem::ConstraintDisplacement") ) self.assertTrue( ObjectsFem.makeConstraintElectrostaticPotential( doc - ).isDerivedFrom('Fem::ConstraintPython') + ).isDerivedFrom("Fem::ConstraintPython") ) self.assertTrue( ObjectsFem.makeConstraintFixed( - doc).isDerivedFrom('Fem::ConstraintFixed') + doc).isDerivedFrom("Fem::ConstraintFixed") ) self.assertTrue( ObjectsFem.makeConstraintFlowVelocity( - doc).isDerivedFrom('Fem::ConstraintPython') + doc).isDerivedFrom("Fem::ConstraintPython") ) self.assertTrue( ObjectsFem.makeConstraintFluidBoundary( doc - ).isDerivedFrom('Fem::ConstraintFluidBoundary') + ).isDerivedFrom("Fem::ConstraintFluidBoundary") ) self.assertTrue( ObjectsFem.makeConstraintForce( doc - ).isDerivedFrom('Fem::ConstraintForce') + ).isDerivedFrom("Fem::ConstraintForce") ) self.assertTrue( ObjectsFem.makeConstraintGear( doc - ).isDerivedFrom('Fem::ConstraintGear') + ).isDerivedFrom("Fem::ConstraintGear") ) self.assertTrue( ObjectsFem.makeConstraintHeatflux( doc - ).isDerivedFrom('Fem::ConstraintHeatflux') + ).isDerivedFrom("Fem::ConstraintHeatflux") ) self.assertTrue( ObjectsFem.makeConstraintInitialFlowVelocity( doc - ).isDerivedFrom('Fem::ConstraintPython') + ).isDerivedFrom("Fem::ConstraintPython") ) self.assertTrue( ObjectsFem.makeConstraintInitialTemperature( doc - ).isDerivedFrom('Fem::ConstraintInitialTemperature') + ).isDerivedFrom("Fem::ConstraintInitialTemperature") ) self.assertTrue( ObjectsFem.makeConstraintPlaneRotation( doc - ).isDerivedFrom('Fem::ConstraintPlaneRotation') + ).isDerivedFrom("Fem::ConstraintPlaneRotation") ) self.assertTrue( ObjectsFem.makeConstraintPressure( doc - ).isDerivedFrom('Fem::ConstraintPressure') + ).isDerivedFrom("Fem::ConstraintPressure") ) self.assertTrue( ObjectsFem.makeConstraintPulley( doc - ).isDerivedFrom('Fem::ConstraintPulley') + ).isDerivedFrom("Fem::ConstraintPulley") ) self.assertTrue( ObjectsFem.makeConstraintSelfWeight( doc - ).isDerivedFrom('Fem::ConstraintPython') + ).isDerivedFrom("Fem::ConstraintPython") ) self.assertTrue( ObjectsFem.makeConstraintTemperature( doc - ).isDerivedFrom('Fem::ConstraintTemperature') + ).isDerivedFrom("Fem::ConstraintTemperature") ) self.assertTrue( ObjectsFem.makeConstraintTransform( - doc).isDerivedFrom('Fem::ConstraintTransform') + doc).isDerivedFrom("Fem::ConstraintTransform") ) self.assertTrue( ObjectsFem.makeElementFluid1D( doc - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeElementGeometry1D( doc - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeElementGeometry2D( doc - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeElementRotation1D( doc - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) materialsolid = ObjectsFem.makeMaterialSolid(doc) self.assertTrue( ObjectsFem.makeMaterialFluid( doc - ).isDerivedFrom('App::MaterialObjectPython') + ).isDerivedFrom("App::MaterialObjectPython") ) self.assertTrue( - materialsolid.isDerivedFrom('App::MaterialObjectPython') + materialsolid.isDerivedFrom("App::MaterialObjectPython") ) self.assertTrue( ObjectsFem.makeMaterialMechanicalNonlinear( doc, materialsolid - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeMaterialReinforced( doc - ).isDerivedFrom('App::MaterialObjectPython') + ).isDerivedFrom("App::MaterialObjectPython") ) mesh = ObjectsFem.makeMeshGmsh(doc) self.assertTrue( - mesh.isDerivedFrom('Fem::FemMeshObjectPython') + mesh.isDerivedFrom("Fem::FemMeshObjectPython") ) self.assertTrue( ObjectsFem.makeMeshBoundaryLayer( doc, mesh - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeMeshGroup( doc, mesh - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeMeshRegion( doc, mesh - ).isDerivedFrom('Fem::FeaturePython') + ).isDerivedFrom("Fem::FeaturePython") ) self.assertTrue( ObjectsFem.makeMeshNetgen( doc - ).isDerivedFrom('Fem::FemMeshShapeNetgenObject') + ).isDerivedFrom("Fem::FemMeshShapeNetgenObject") ) self.assertTrue( ObjectsFem.makeMeshResult( doc - ).isDerivedFrom('Fem::FemMeshObjectPython') + ).isDerivedFrom("Fem::FemMeshObjectPython") ) self.assertTrue( ObjectsFem.makeResultMechanical( doc - ).isDerivedFrom('Fem::FemResultObjectPython') + ).isDerivedFrom("Fem::FemResultObjectPython") ) solverelmer = ObjectsFem.makeSolverElmer(doc) self.assertTrue( ObjectsFem.makeSolverCalculixCcxTools( doc - ).isDerivedFrom('Fem::FemSolverObjectPython') + ).isDerivedFrom("Fem::FemSolverObjectPython") ) self.assertTrue( ObjectsFem.makeSolverCalculix( doc - ).isDerivedFrom('Fem::FemSolverObjectPython') + ).isDerivedFrom("Fem::FemSolverObjectPython") ) self.assertTrue( - solverelmer.isDerivedFrom('Fem::FemSolverObjectPython') + solverelmer.isDerivedFrom("Fem::FemSolverObjectPython") ) self.assertTrue( ObjectsFem.makeSolverZ88( doc - ).isDerivedFrom('Fem::FemSolverObjectPython') + ).isDerivedFrom("Fem::FemSolverObjectPython") ) self.assertTrue( ObjectsFem.makeEquationElasticity( doc, solverelmer - ).isDerivedFrom('App::FeaturePython') + ).isDerivedFrom("App::FeaturePython") ) self.assertTrue( ObjectsFem.makeEquationElectrostatic( doc, solverelmer - ).isDerivedFrom('App::FeaturePython') + ).isDerivedFrom("App::FeaturePython") ) self.assertTrue( ObjectsFem.makeEquationFlow( doc, solverelmer - ).isDerivedFrom('App::FeaturePython') + ).isDerivedFrom("App::FeaturePython") ) self.assertTrue( ObjectsFem.makeEquationFluxsolver( doc, solverelmer - ).isDerivedFrom('App::FeaturePython') + ).isDerivedFrom("App::FeaturePython") ) self.assertTrue( ObjectsFem.makeEquationHeat( doc, solverelmer - ).isDerivedFrom('App::FeaturePython') + ).isDerivedFrom("App::FeaturePython") ) # is = 44 tests (just copy in empty file to test) diff --git a/src/Mod/Fem/femtest/testresult.py b/src/Mod/Fem/femtest/testresult.py index b3bf91b73c..b4f94e0543 100644 --- a/src/Mod/Fem/femtest/testresult.py +++ b/src/Mod/Fem/femtest/testresult.py @@ -32,7 +32,7 @@ from os.path import join class TestResult(unittest.TestCase): - fcc_print('import TestResult') + fcc_print("import TestResult") # ******************************************************************************************** def setUp( @@ -65,8 +65,8 @@ class TestResult(unittest.TestCase): # read data from frd file frd_file = join( testtools.get_fem_test_home_dir(), - 'ccx', - 'Flow1D_thermomech.frd' + "ccx", + "Flow1D_thermomech.frd" ) from feminout.importCcxFrdResults import read_frd_result as read_frd frd_content = read_frd(frd_file) @@ -75,12 +75,12 @@ class TestResult(unittest.TestCase): frd_content_len = [] for key in sorted(frd_content.keys()): frd_content_len.append(len(frd_content[key])) - print('read data') + print("read data") print(frd_content_len) print(sorted(frd_content.keys())) # print(frd_content) - read_mflow = frd_content['Results'][12]['mflow'] - read_npressure = frd_content['Results'][12]['npressure'] + read_mflow = frd_content["Results"][12]["mflow"] + read_npressure = frd_content["Results"][12]["npressure"] res_len = [ len(read_mflow), len(read_npressure) @@ -90,9 +90,9 @@ class TestResult(unittest.TestCase): print(read_npressure) # create the expected data - print('\nexpected data') + print("\nexpected data") efc = {} # expected frd content - efc['Nodes'] = { + efc["Nodes"] = { 2: FreeCAD.Vector(0.0, 0.0, -50.0), 3: FreeCAD.Vector(0.0, 0.0, -4300.0), 4: FreeCAD.Vector(4950.0, 0.0, -4300.0), @@ -119,13 +119,13 @@ class TestResult(unittest.TestCase): 26: FreeCAD.Vector(15047.0, 0.0, -11148.0), 27: FreeCAD.Vector(15047.0, 0.0, -7897.97) } - efc['Seg2Elem'] = { + efc["Seg2Elem"] = { 1: (15, 2), 13: (13, 27) } - efc['Seg3Elem'] = {} - ''' deleted during reading because of the inout file - efc['Seg3Elem'] = { + efc["Seg3Elem"] = {} + """ deleted during reading because of the inout file + efc["Seg3Elem"] = { 2: (2, 16, 3), 3: (3, 17, 4), 4: (4, 18, 5), @@ -138,32 +138,32 @@ class TestResult(unittest.TestCase): 11: (11, 25, 12), 12: (12, 26, 13) } - ''' + """ # faces - efc['Tria3Elem'] = efc['Tria6Elem'] = {} - efc['Quad4Elem'] = efc['Quad8Elem'] = {} + efc["Tria3Elem"] = efc["Tria6Elem"] = {} + efc["Quad4Elem"] = efc["Quad8Elem"] = {} # volumes - efc['Tetra4Elem'] = efc['Tetra10Elem'] = {} - efc['Hexa8Elem'] = efc['Hexa20Elem'] = {} - efc['Penta6Elem'] = efc['Penta15Elem'] = {} + efc["Tetra4Elem"] = efc["Tetra10Elem"] = {} + efc["Hexa8Elem"] = efc["Hexa20Elem"] = {} + efc["Penta6Elem"] = efc["Penta15Elem"] = {} - efc['Results'] = [ - {'time': 0.00390625}, - {'time': 0.0078125}, - {'time': 0.0136719}, - {'time': 0.0224609}, - {'time': 0.0356445}, - {'time': 0.0554199}, - {'time': 0.085083}, - {'time': 0.129578}, - {'time': 0.19632}, - {'time': 0.296432}, - {'time': 0.446602}, - {'time': 0.671856}, + efc["Results"] = [ + {"time": 0.00390625}, + {"time": 0.0078125}, + {"time": 0.0136719}, + {"time": 0.0224609}, + {"time": 0.0356445}, + {"time": 0.0554199}, + {"time": 0.085083}, + {"time": 0.129578}, + {"time": 0.19632}, + {"time": 0.296432}, + {"time": 0.446602}, + {"time": 0.671856}, { - 'number': 0, - 'time': 1.0, - 'mflow': { + "number": 0, + "time": 1.0, + "mflow": { 1: 78.3918, # added during reading because of the inout file 2: 78.3918, 3: 78.3918, @@ -192,7 +192,7 @@ class TestResult(unittest.TestCase): 27: 78.3918, 28: 78.3918 # added during reading because of the inout file }, - 'npressure': { + "npressure": { 1: 0.1, # added during reading because of the inout file 2: 0.1, 3: 0.134840, @@ -232,8 +232,8 @@ class TestResult(unittest.TestCase): print(expected_frd_content_len) print(sorted(expected_frd_content.keys())) # expected results - expected_mflow = expected_frd_content['Results'][12]['mflow'] - expected_npressure = expected_frd_content['Results'][12]['npressure'] + expected_mflow = expected_frd_content["Results"][12]["mflow"] + expected_npressure = expected_frd_content["Results"][12]["npressure"] expected_res_len = [ len(expected_mflow), len(expected_npressure) @@ -249,18 +249,18 @@ class TestResult(unittest.TestCase): "Length's of read frd data values are unexpected" ) self.assertEqual( - frd_content['Nodes'], - expected_frd_content['Nodes'], + frd_content["Nodes"], + expected_frd_content["Nodes"], "Values of read node data are unexpected" ) self.assertEqual( - frd_content['Seg2Elem'], - expected_frd_content['Seg2Elem'], + frd_content["Seg2Elem"], + expected_frd_content["Seg2Elem"], "Values of read Seg2 data are unexpected" ) self.assertEqual( - frd_content['Seg3Elem'], - expected_frd_content['Seg3Elem'], + frd_content["Seg3Elem"], + expected_frd_content["Seg3Elem"], "Values of read Seg3 data are unexpected" ) self.assertEqual( @@ -285,7 +285,7 @@ class TestResult(unittest.TestCase): ): # node 5 von calculix cantilver 3D example # doc = FreeCAD.open( - # FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D.FCStd' + # FreeCAD.ConfigGet("AppHomePath") + "data/examples/FemCalculixCantilever3D.FCStd" # ) # doc.Box_Mesh.FemMesh.Nodes[5] # Vector (0.0, 1000.0, 0.0) @@ -431,7 +431,7 @@ class TestResult(unittest.TestCase): round(res[1], 5), round(res[2], 5) ) - # fcc_print('Case{}: {}'.format(i + 1 , rhores)) + # fcc_print("Case{}: {}".format(i + 1 , rhores)) self.assertEqual( rhores, case[1], "Calculated rho are not the expected Case{}." diff --git a/src/Mod/Fem/femtest/testsolverframework.py b/src/Mod/Fem/femtest/testsolverframework.py index 072f16e0fe..b7ea497659 100644 --- a/src/Mod/Fem/femtest/testsolverframework.py +++ b/src/Mod/Fem/femtest/testsolverframework.py @@ -34,7 +34,7 @@ from os.path import join class TestSolverFrameWork(unittest.TestCase): - fcc_print('import TestSolverFrameWork') + fcc_print("import TestSolverFrameWork") # ******************************************************************************************** def setUp( @@ -52,9 +52,9 @@ class TestSolverFrameWork(unittest.TestCase): self.active_doc = FreeCAD.ActiveDocument # more inits - self.mesh_name = 'Mesh' + self.mesh_name = "Mesh" self.temp_dir = testtools.get_fem_test_tmp_dir() - self.test_file_dir = join(testtools.get_fem_test_home_dir(), 'ccx') + self.test_file_dir = join(testtools.get_fem_test_home_dir(), "ccx") def test_00print( self @@ -69,30 +69,30 @@ class TestSolverFrameWork(unittest.TestCase): def test_solver_framework( self ): - fcc_print('\n--------------- Start of FEM tests solver frame work ---------------') + fcc_print("\n--------------- Start of FEM tests solver frame work ---------------") box = self.active_doc.addObject("Part::Box", "Box") - fcc_print('Checking FEM new analysis...') + fcc_print("Checking FEM new analysis...") analysis = ObjectsFem.makeAnalysis( self.active_doc, - 'Analysis' + "Analysis" ) self.assertTrue(analysis, "FemTest of new analysis failed") - fcc_print('Checking FEM new material...') + fcc_print("Checking FEM new material...") material_object = ObjectsFem.makeMaterialSolid( self.active_doc, - 'MechanicalMaterial' + "MechanicalMaterial" ) mat = material_object.Material - mat['Name'] = "Steel-Generic" - mat['YoungsModulus'] = "200000 MPa" - mat['PoissonRatio'] = "0.30" - mat['Density'] = "7900 kg/m^3" + mat["Name"] = "Steel-Generic" + mat["YoungsModulus"] = "200000 MPa" + mat["PoissonRatio"] = "0.30" + mat["Density"] = "7900 kg/m^3" material_object.Material = mat self.assertTrue(material_object, "FemTest of new material failed") analysis.addObject(material_object) - fcc_print('Checking FEM new fixed constraint...') + fcc_print("Checking FEM new fixed constraint...") fixed_constraint = self.active_doc.addObject( "Fem::ConstraintFixed", "FemConstraintFixed" @@ -101,7 +101,7 @@ class TestSolverFrameWork(unittest.TestCase): self.assertTrue(fixed_constraint, "FemTest of new fixed constraint failed") analysis.addObject(fixed_constraint) - fcc_print('Checking FEM new force constraint...') + fcc_print("Checking FEM new force constraint...") force_constraint = self.active_doc.addObject( "Fem::ConstraintForce", "FemConstraintForce" @@ -115,7 +115,7 @@ class TestSolverFrameWork(unittest.TestCase): self.assertTrue(force_constraint, "FemTest of new force constraint failed") analysis.addObject(force_constraint) - fcc_print('Checking FEM new pressure constraint...') + fcc_print("Checking FEM new pressure constraint...") pressure_constraint = self.active_doc.addObject( "Fem::ConstraintPressure", "FemConstraintPressure" @@ -126,7 +126,7 @@ class TestSolverFrameWork(unittest.TestCase): self.assertTrue(pressure_constraint, "FemTest of new pressure constraint failed") analysis.addObject(pressure_constraint) - fcc_print('Checking FEM new mesh...') + fcc_print("Checking FEM new mesh...") from .testfiles.ccx.cube_mesh import create_nodes_cube from .testfiles.ccx.cube_mesh import create_elements_cube mesh = Fem.FemMesh() @@ -135,7 +135,7 @@ class TestSolverFrameWork(unittest.TestCase): ret = create_elements_cube(mesh) self.assertTrue(ret, "Import of mesh volumes failed") mesh_object = self.active_doc.addObject( - 'Fem::FemMeshObject', + "Fem::FemMeshObject", self.mesh_name ) mesh_object.FemMesh = mesh @@ -146,15 +146,15 @@ class TestSolverFrameWork(unittest.TestCase): # solver frame work ccx solver # calculix solver object - fcc_print('\nChecking FEM CalculiX solver for solver frame work...') + fcc_print("\nChecking FEM CalculiX solver for solver frame work...") solver_ccx_object = ObjectsFem.makeSolverCalculix( self.active_doc, - 'SolverCalculiX' + "SolverCalculiX" ) - solver_ccx_object.AnalysisType = 'static' - solver_ccx_object.GeometricalNonlinearity = 'linear' + solver_ccx_object.AnalysisType = "static" + solver_ccx_object.GeometricalNonlinearity = "linear" solver_ccx_object.ThermoMechSteadyState = False - solver_ccx_object.MatrixSolverType = 'default' + solver_ccx_object.MatrixSolverType = "default" solver_ccx_object.IterationsControlParameterTimeUse = False solver_ccx_object.EigenmodesCount = 10 solver_ccx_object.EigenmodeHighLimit = 1000000.0 @@ -162,15 +162,15 @@ class TestSolverFrameWork(unittest.TestCase): self.assertTrue(solver_ccx_object, "FemTest of new ccx solver failed") analysis.addObject(solver_ccx_object) - static_base_name = 'cube_static' + static_base_name = "cube_static" solverframework_analysis_dir = testtools.get_unit_test_tmp_dir( testtools.get_fem_test_tmp_dir(), - 'FEM_solverframework' + "FEM_solverframework" ) # write input file - fcc_print('Checking FEM ccx solver for solver frame work......') - fcc_print('machine_ccx') + fcc_print("Checking FEM ccx solver for solver frame work......") + fcc_print("machine_ccx") machine_ccx = solver_ccx_object.Proxy.createMachine( solver_ccx_object, solverframework_analysis_dir @@ -181,11 +181,11 @@ class TestSolverFrameWork(unittest.TestCase): infile_given = join( testtools.get_fem_test_home_dir(), - 'ccx', - (static_base_name + '.inp') + "ccx", + (static_base_name + ".inp") ) - inpfile_totest = join(solverframework_analysis_dir, (self.mesh_name + '.inp')) - fcc_print('Comparing {} to {}'.format(infile_given, inpfile_totest)) + inpfile_totest = join(solverframework_analysis_dir, (self.mesh_name + ".inp")) + fcc_print("Comparing {} to {}".format(infile_given, inpfile_totest)) ret = testtools.compare_inp_files(infile_given, inpfile_totest) self.assertFalse(ret, "ccxtools write_inp_file test failed.\n{}".format(ret)) @@ -193,7 +193,7 @@ class TestSolverFrameWork(unittest.TestCase): # elmer solver object solver_elmer_object = ObjectsFem.makeSolverElmer( self.active_doc, - 'SolverElmer' + "SolverElmer" ) self.assertTrue(solver_elmer_object, "FemTest of elmer solver failed") analysis.addObject(solver_elmer_object) @@ -207,7 +207,7 @@ class TestSolverFrameWork(unittest.TestCase): # current elmer seems to need it even on simple elasticity analysis mat = material_object.Material # FIXME elmer elasticity needs the dictionary key, otherwise it fails - mat['ThermalExpansionCoefficient'] = "0 um/m/K" + mat["ThermalExpansionCoefficient"] = "0 um/m/K" material_object.Material = mat mesh_gmsh = ObjectsFem.makeMeshGmsh(self.active_doc) @@ -221,7 +221,7 @@ class TestSolverFrameWork(unittest.TestCase): # solver frame work Elmer solver # write input files - fcc_print('\nChecking FEM Elmer solver for solver frame work...') + fcc_print("\nChecking FEM Elmer solver for solver frame work...") machine_elmer = solver_elmer_object.Proxy.createMachine( solver_elmer_object, solverframework_analysis_dir, @@ -232,33 +232,33 @@ class TestSolverFrameWork(unittest.TestCase): machine_elmer.join() # wait for the machine to finish. # compare startinfo, case and gmsh input files - test_file_dir_elmer = join(testtools.get_fem_test_home_dir(), 'elmer') + test_file_dir_elmer = join(testtools.get_fem_test_home_dir(), "elmer") - fcc_print('Test writing STARTINFO file') - startinfo_given = join(test_file_dir_elmer, 'ELMERSOLVER_STARTINFO') - startinfo_totest = join(solverframework_analysis_dir, 'ELMERSOLVER_STARTINFO') - fcc_print('Comparing {} to {}'.format(startinfo_given, startinfo_totest)) + fcc_print("Test writing STARTINFO file") + startinfo_given = join(test_file_dir_elmer, "ELMERSOLVER_STARTINFO") + startinfo_totest = join(solverframework_analysis_dir, "ELMERSOLVER_STARTINFO") + fcc_print("Comparing {} to {}".format(startinfo_given, startinfo_totest)) ret = testtools.compare_files(startinfo_given, startinfo_totest) self.assertFalse(ret, "STARTINFO write file test failed.\n{}".format(ret)) - fcc_print('Test writing case file') - casefile_given = join(test_file_dir_elmer, 'case.sif') - casefile_totest = join(solverframework_analysis_dir, 'case.sif') - fcc_print('Comparing {} to {}'.format(casefile_given, casefile_totest)) + fcc_print("Test writing case file") + casefile_given = join(test_file_dir_elmer, "case.sif") + casefile_totest = join(solverframework_analysis_dir, "case.sif") + fcc_print("Comparing {} to {}".format(casefile_given, casefile_totest)) ret = testtools.compare_files(casefile_given, casefile_totest) self.assertFalse(ret, "case write file test failed.\n{}".format(ret)) - fcc_print('Test writing GMSH geo file') - gmshgeofile_given = join(test_file_dir_elmer, 'group_mesh.geo') - gmshgeofile_totest = join(solverframework_analysis_dir, 'group_mesh.geo') - fcc_print('Comparing {} to {}'.format(gmshgeofile_given, gmshgeofile_totest)) + fcc_print("Test writing GMSH geo file") + gmshgeofile_given = join(test_file_dir_elmer, "group_mesh.geo") + gmshgeofile_totest = join(solverframework_analysis_dir, "group_mesh.geo") + fcc_print("Comparing {} to {}".format(gmshgeofile_given, gmshgeofile_totest)) ret = testtools.compare_files(gmshgeofile_given, gmshgeofile_totest) self.assertFalse(ret, "GMSH geo write file test failed.\n{}".format(ret)) - save_fc_file = solverframework_analysis_dir + static_base_name + '.FCStd' - fcc_print('Save FreeCAD file for static2 analysis to {}...'.format(save_fc_file)) + save_fc_file = solverframework_analysis_dir + static_base_name + ".FCStd" + fcc_print("Save FreeCAD file for static2 analysis to {}...".format(save_fc_file)) self.active_doc.saveAs(save_fc_file) - fcc_print('--------------- End of FEM tests solver frame work ---------------') + fcc_print("--------------- End of FEM tests solver frame work ---------------") # ******************************************************************************************** def tearDown( diff --git a/src/Mod/Fem/femtest/utilstest.py b/src/Mod/Fem/femtest/utilstest.py index c9ea3525aa..d0deb96fb5 100644 --- a/src/Mod/Fem/femtest/utilstest.py +++ b/src/Mod/Fem/femtest/utilstest.py @@ -36,12 +36,12 @@ from os.path import join def get_fem_test_home_dir( ): - return join(FreeCAD.getHomePath(), 'Mod', 'Fem', 'femtest', 'testfiles') + return join(FreeCAD.getHomePath(), "Mod", "Fem", "femtest", "testfiles") def get_fem_test_tmp_dir( ): - temp_dir = join(tempfile.gettempdir(), 'FEM_unittests') + temp_dir = join(tempfile.gettempdir(), "FEM_unittests") if not os.path.exists(temp_dir): os.makedirs(temp_dir) return(temp_dir) @@ -60,22 +60,22 @@ def get_unit_test_tmp_dir( def fcc_print( message ): - FreeCAD.Console.PrintMessage('{} \n'.format(message)) + FreeCAD.Console.PrintMessage("{} \n".format(message)) def get_defmake_count( fem_vtk_post=True ): - ''' + """ count the def make in module ObjectsFem could also be done in bash with grep -c "def make" src/Mod/Fem/ObjectsFem.py - ''' - name_modfile = join(FreeCAD.getHomePath(), 'Mod', 'Fem', 'ObjectsFem.py') - modfile = open(name_modfile, 'r') + """ + name_modfile = join(FreeCAD.getHomePath(), "Mod", "Fem", "ObjectsFem.py") + modfile = open(name_modfile, "r") lines_modefile = modfile.readlines() modfile.close() - lines_defmake = [l for l in lines_modefile if l.startswith('def make')] + lines_defmake = [l for l in lines_modefile if l.startswith("def make")] if not fem_vtk_post: # FEM VTK post processing is disabled # we are not able to create VTK post objects @@ -88,41 +88,41 @@ def get_defmake_count( def get_fem_test_defs( - inout='out' + inout="out" ): - test_path = join(FreeCAD.getHomePath(), 'Mod', 'Fem', 'femtest') + test_path = join(FreeCAD.getHomePath(), "Mod", "Fem", "femtest") collected_test_modules = [] collected_test_methods = [] for tfile in sorted(os.listdir(test_path)): if tfile.startswith("test") and tfile.endswith(".py"): collected_test_modules.append(join(test_path, tfile)) for f in collected_test_modules: - tfile = open(f, 'r') + tfile = open(f, "r") module_name = os.path.splitext(os.path.basename(f))[0] - class_name = '' + class_name = "" for ln in tfile: ln = ln.lstrip() ln = ln.rstrip() - if ln.startswith('class '): - ln = ln.lstrip('class ') - ln = ln.split('(')[0] + if ln.startswith("class "): + ln = ln.lstrip("class ") + ln = ln.split("(")[0] class_name = ln - if ln.startswith('def test'): - ln = ln.lstrip('def ') - ln = ln.split('(')[0] + if ln.startswith("def test"): + ln = ln.lstrip("def ") + ln = ln.split("(")[0] collected_test_methods.append( - 'femtest.{}.{}.{}'.format(module_name, class_name, ln) + "femtest.{}.{}.{}".format(module_name, class_name, ln) ) tfile.close() - print('') + print("") for m in collected_test_methods: run_outside_fc = './bin/FreeCADCmd --run-test "{}"'.format(m) run_inside_fc = ( - 'unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("{}"))' + "unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName('{}'))" .format(m) ) - if inout == 'in': - print('\nimport unittest') + if inout == "in": + print("\nimport unittest") print(run_inside_fc) else: print(run_outside_fc) @@ -132,28 +132,28 @@ def compare_inp_files( file_name1, file_name2 ): - file1 = open(file_name1, 'r') + file1 = open(file_name1, "r") f1 = file1.readlines() file1.close() - # l.startswith('17671.0,1') is a temporary workaround + # l.startswith("17671.0,1") is a temporary workaround # for python3 problem with 1DFlow input # TODO as soon as the 1DFlow result reading is fixed # this should be triggered in the 1DFlow unit test lf1 = [l for l in f1 if not ( - l.startswith('** written ') or l.startswith('** file ') or l.startswith('17671.0,1') + l.startswith("** written ") or l.startswith("** file ") or l.startswith("17671.0,1") )] lf1 = force_unix_line_ends(lf1) - file2 = open(file_name2, 'r') + file2 = open(file_name2, "r") f2 = file2.readlines() file2.close() # TODO see comment on file1 lf2 = [l for l in f2 if not ( - l.startswith('** written ') or l.startswith('** file ') or l.startswith('17671.0,1') + l.startswith("** written ") or l.startswith("** file ") or l.startswith("17671.0,1") )] lf2 = force_unix_line_ends(lf2) import difflib diff = difflib.unified_diff(lf1, lf2, n=0) - result = '' + result = "" for l in diff: result += l if result: @@ -168,25 +168,25 @@ def compare_files( file_name1, file_name2 ): - file1 = open(file_name1, 'r') + file1 = open(file_name1, "r") f1 = file1.readlines() file1.close() # workaround to compare geos of elmer test and temporary file path # (not only names change, path changes with operating system) lf1 = [l for l in f1 if not ( - l.startswith('Merge "') or l.startswith('Save "') or l.startswith('// ') + l.startswith('Merge "') or l.startswith('Save "') or l.startswith("// ") )] lf1 = force_unix_line_ends(lf1) - file2 = open(file_name2, 'r') + file2 = open(file_name2, "r") f2 = file2.readlines() file2.close() lf2 = [l for l in f2 if not ( - l.startswith('Merge "') or l.startswith('Save "') or l.startswith('// ') + l.startswith('Merge "') or l.startswith('Save "') or l.startswith("// ") )] lf2 = force_unix_line_ends(lf2) import difflib diff = difflib.unified_diff(lf1, lf2, n=0) - result = '' + result = "" for l in diff: result += l if result: @@ -238,7 +238,7 @@ def compare_stats( return True # get stats to compare with, the expected ones - sf = open(stat_file, 'r') + sf = open(stat_file, "r") sf_content = [] for l in sf.readlines(): for st in loc_stat_types: @@ -268,7 +268,7 @@ def force_unix_line_ends( new_line_list = [] for ln in line_list: if ln.endswith("\r\n"): - ln = ln[:-2] + '\n' + ln = ln[:-2] + "\n" new_line_list.append(ln) return new_line_list @@ -277,20 +277,20 @@ def collect_python_modules( femsubdir=None ): if not femsubdir: - pydir = join(FreeCAD.ConfigGet("AppHomePath"), 'Mod', 'Fem') + pydir = join(FreeCAD.ConfigGet("AppHomePath"), "Mod", "Fem") else: - pydir = join(FreeCAD.ConfigGet("AppHomePath"), 'Mod', 'Fem', femsubdir) + pydir = join(FreeCAD.ConfigGet("AppHomePath"), "Mod", "Fem", femsubdir) collected_modules = [] fcc_print(pydir) for pyfile in sorted(os.listdir(pydir)): - if pyfile.endswith(".py") and not pyfile.startswith('Init'): + if pyfile.endswith(".py") and not pyfile.startswith("Init"): if not femsubdir: collected_modules.append( os.path.splitext(os.path.basename(pyfile))[0] ) else: collected_modules.append( - femsubdir.replace('/', '.') + '.' + os.path.splitext( + femsubdir.replace("/", ".") + "." + os.path.splitext( os.path.basename(pyfile) )[0] ) @@ -315,8 +315,8 @@ def cube_frequency( unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname)) doc = FreeCAD.open(join( get_fem_test_tmp_dir(), - 'FEM_ccx_frequency', - 'cube_frequency.FCStd') + "FEM_ccx_frequency", + "cube_frequency.FCStd") ) return doc @@ -327,8 +327,8 @@ def cube_static( unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname)) doc = FreeCAD.open( join(get_fem_test_tmp_dir(), - 'FEM_ccx_static', - 'cube_static.FCStd') + "FEM_ccx_static", + "cube_static.FCStd") ) return doc @@ -339,8 +339,8 @@ def Flow1D_thermomech( unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname)) doc = FreeCAD.open(join( get_fem_test_tmp_dir(), - 'FEM_ccx_Flow1D_thermomech', - 'Flow1D_thermomech.FCStd') + "FEM_ccx_Flow1D_thermomech", + "Flow1D_thermomech.FCStd") ) return doc @@ -351,8 +351,8 @@ def multimat( unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname)) doc = FreeCAD.open(join( get_fem_test_tmp_dir(), - 'FEM_ccx_multimat', - 'multimat.FCStd') + "FEM_ccx_multimat", + "multimat.FCStd") ) return doc @@ -363,7 +363,7 @@ def spine_thermomech( unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname)) doc = FreeCAD.open(join( get_fem_test_tmp_dir(), - 'FEM_ccx_thermomech', - 'spine_thermomech.FCStd') + "FEM_ccx_thermomech", + "spine_thermomech.FCStd") ) return doc