Skip to content

Commit b8362bb

Browse files
update unittests
1 parent af55634 commit b8362bb

File tree

2 files changed

+49
-8
lines changed

2 files changed

+49
-8
lines changed

UnitTests/test_LineLoads_Test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from RFEM.BasicObjects.thickness import Thickness
1919
from RFEM.BasicObjects.material import Material
2020
from RFEM.initModel import Model
21-
from RFEM.enums import LineLoadDistribution, NodalLoadDirection, StaticAnalysisType
21+
from RFEM.enums import LineLoadDistribution, NodalLoadDirection, StaticAnalysisType, LineSetLoadDistribution, LineSetLoadDirection
2222
from RFEM.Loads.lineLoad import LineLoad
2323

2424
if Model.clientModel is None:
@@ -322,9 +322,11 @@ def test_line_set_loads():
322322
LineSetLoad.Force(2, 1, '1', load_parameter=2500)
323323
LineSetLoad.Mass(3, 1, '1', False, [3100])
324324
LineSetLoad.Moment(4, load_parameter=4000)
325+
LineSetLoad.Force(5, 1, '1', LineSetLoadDistribution.LOAD_DISTRIBUTION_CONCENTRATED_VARYING, LineSetLoadDirection.LOAD_DIRECTION_LOCAL_Z, [[1,1200],[3,2300]])
325326
Model.clientModel.service.finish_modification()
326327

327328
assert Model.clientModel.service.get_line_set_load(1, 1).magnitude == 1200.5
328329
assert Model.clientModel.service.get_line_set_load(2, 1).magnitude == 2500
329330
assert Model.clientModel.service.get_line_set_load(3, 1).mass_global == 3100
330331
assert Model.clientModel.service.get_line_set_load(4, 1).magnitude == 4000
332+
assert Model.clientModel.service.get_line_set_load(5, 1).load_distribution == 'LOAD_DISTRIBUTION_CONCENTRATED_VARYING'

UnitTests/test_MeshTables.py

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
)
77
sys.path.append(PROJECT_ROOT)
88

9-
from RFEM.initModel import Model
9+
from RFEM.initModel import Model, Calculate_all
10+
from RFEM.enums import *
11+
from RFEM.dataTypes import inf
1012
from RFEM.BasicObjects.material import Material
1113
from RFEM.BasicObjects.thickness import Thickness
14+
from RFEM.BasicObjects.section import Section
1215
from RFEM.BasicObjects.node import Node
1316
from RFEM.BasicObjects.line import Line
1417
from RFEM.BasicObjects.surface import Surface
15-
from RFEM.BasicObjects.section import Section
1618
from RFEM.BasicObjects.member import Member
19+
from RFEM.TypesForNodes.nodalSupport import NodalSupport
20+
from RFEM.LoadCasesAndCombinations.staticAnalysisSettings import StaticAnalysisSettings
21+
from RFEM.LoadCasesAndCombinations.loadCase import LoadCase
22+
from RFEM.LoadCasesAndCombinations.designSituation import DesignSituation
23+
from RFEM.LoadCasesAndCombinations.loadCasesAndCombinations import LoadCasesAndCombinations
24+
from RFEM.LoadCasesAndCombinations.loadCombination import LoadCombination
25+
from RFEM.Loads.nodalLoad import NodalLoad
1726
from RFEM.Results.meshTables import MeshTables
1827

1928
if Model.clientModel is None:
@@ -53,17 +62,47 @@ def test_mesh_tables():
5362
allFeNodes = MeshTables.GetAllFENodes()
5463
assert allFeNodes[4]['y'] == 20
5564

56-
customNode = MeshTables.getFENodeOriginalMesh(8)
65+
customNode = MeshTables.GetFENodeOriginalMesh(8)
5766
assert customNode['y'] == 1.5
5867

59-
all1DElements = MeshTables.getAllFE1DElements()
68+
all1DElements = MeshTables.GetAllFE1DElements()
6069
assert all1DElements[12]['FE_node1_no'] == 454
6170

62-
all2DElemets = MeshTables.getAllFE2DElements()
71+
all2DElemets = MeshTables.GetAllFE2DElements()
6372
assert all2DElemets[5]['surface_no'] == 1
6473

65-
custom1DElement = MeshTables.getFE1DElement(5)
74+
custom1DElement = MeshTables.GetFE1DElement(5)
6675
assert custom1DElement['FE_node2_no'] == 447
6776

68-
custom2DElement = MeshTables.getFE2DElement(18)
77+
custom2DElement = MeshTables.GetFE2DElement(18)
6978
assert custom2DElement['FE_node3_no'] == 37
79+
80+
def test_deformed_mesh():
81+
82+
Model.clientModel.service.delete_all()
83+
Model.clientModel.service.begin_modification()
84+
85+
Material(1)
86+
Section(1)
87+
88+
Node(1, 0.0, 0.0, 0.0)
89+
Node(2, 5, 0.0, 0.0)
90+
91+
Member(1, 1, 2, 0.0, 1, 1)
92+
93+
NodalSupport(1, '1', NodalSupportType.HINGED)
94+
NodalSupport(2, '2', [0, inf, inf, inf, 0, inf])
95+
LoadCasesAndCombinations()
96+
LoadCase.StaticAnalysis(1, 'Self-Weight',analysis_settings_no=1,action_category= ActionCategoryType.ACTION_CATEGORY_PERMANENT_G,self_weight=[True, 0.0, 0.0, 1.0])
97+
DesignSituation(1, DesignSituationType.DESIGN_SITUATION_TYPE_EQU_PERMANENT_AND_TRANSIENT, True)
98+
StaticAnalysisSettings.GeometricallyLinear(1, "Linear")
99+
LoadCombination(1, combination_items=[[1,1,0,False]])
100+
LoadCombination(2, combination_items=[[1.5,1,0,False]])
101+
NodalLoad(1, 1, '2', NodalLoadDirection.LOAD_DIRECTION_GLOBAL_Z_OR_USER_DEFINED_W, 1000)
102+
Model.clientModel.service.finish_modification()
103+
104+
Calculate_all()
105+
106+
assert Model.clientModel.service.has_any_results()
107+
assert MeshTables.GetAllFENodesDeformed(CaseObjectType.E_OBJECT_TYPE_LOAD_COMBINATION, 2)
108+
assert MeshTables.GetFENodeDeformed()

0 commit comments

Comments
 (0)