-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpart_segmenter_test.py
More file actions
28 lines (24 loc) · 956 Bytes
/
part_segmenter_test.py
File metadata and controls
28 lines (24 loc) · 956 Bytes
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
import unittest
import matplotlib.pyplot as plt
from shapely.geometry import box
import part_segmenter
import visualization
class PartSegmenterTest(unittest.TestCase):
def test_three_point_bend(self):
part = box(-0.06, -0.0125, 0.06, 0.0125)
fem_result = r'FEM/three_point_bend_stress.vtu'
grid_spacing = 2e-3 # 0.5e-3
min_dist = 6e-3
max_num_lines = 3
streamlines, debug_x, debug_y = part_segmenter.SegmentPart(part, fem_result, grid_spacing,
min_dist, max_num_lines,
debug_mode=True)
# Plot results
ax = plt.figure().add_subplot(111)
ax.set_aspect('equal')
for sl in streamlines:
visualization.plot_streamline(sl, ax)
ax.scatter(debug_x, debug_y)
plt.show()
if __name__ == '__main__':
unittest.main()