forked from SAP-archive/fedem-solvers
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_fmx.py
More file actions
50 lines (42 loc) · 1.02 KB
/
test_fmx.py
File metadata and controls
50 lines (42 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# SPDX-FileCopyrightText: 2023 SAP SE
#
# SPDX-License-Identifier: Apache-2.0
#
# This file is part of FEDEM - https://openfedem.org
"""
Tests for fmx-writing
"""
from fedempy.write_fmx import write, read
fnam = b"testfil"
data = [1.0, 2.0, 3.0, 4.0]
# Write stiffness matrix
status = write(fnam, 1, data)
# Write masse matrix
status += write(fnam, 2, data)
# Write gravitation forces
status += write(fnam, 3, data)
if status < 0:
exit(status)
# Read in the stiffness matrix
new_data = [0.0, 0.0, 0.0, 0.0]
status += read(fnam, 1, new_data)
for i in range(0, 4):
if data[i] != new_data[i]:
status -= 1
if status < 0:
exit(status)
# Read in the mass matrix
new_data = [0.0, 0.0, 0.0, 0.0]
status += read(fnam, 2, new_data)
for i in range(0, 4):
if data[i] != new_data[i]:
status -= 1
if status < 0:
exit(status)
# Read in the gravitation forces
new_data = [0.0, 0.0, 0.0, 0.0]
status += read(fnam, 3, new_data)
for i in range(0, 4):
if data[i] != new_data[i]:
status -= 1
exit(status)