-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
91 lines (77 loc) · 2.85 KB
/
test.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
'''
11/12/2018
Author@Dedao
This is the main control function for post processing
'''
import sys
import os
para_path = os.getcwd()+'/../'
sys.path.insert(0, para_path)
import parameters
import utilities.logger
import utilities.abaqus.inp_reader_v2
import utilities.abaqus.inp_tree_processor_v2
import geometry.boundary_extractor
import numpy
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
def get_desired_part(parts_list,ap):
part_name_requested = ap['part_name']
for part in parts_list:
if part.label == part_name_requested:
return part
# This is reached if the requested part was never found.
raise Exception("Could not find the part: " + part_name_requested +
" as requested in the input file.")
# def scatter_plot(coords_list, plt_title):
#
#
# tr_list = list(numpy.transpose(list(coords_list)))
# fig = plt.figure()
# ax = fig.add_subplot(111, projection='3d')
# ax.scatter(tr_list[0],tr_list[1],tr_list[2], c='r', marker='.', s=[1, 1, 1])
# plt.title(plt_title)
# plt.show()
# from matplotlib import pyplot as plt
# x,y = poly.exterior.xy
# fig = plt.figure()
# ax = fig.add_subplot(111)
# ax.scatter(x,y)
# ax.set_title('Polygon')
# plt.show()
if __name__ == '__main__':
main_log = utilities.logger.main_log
main_log.info("Post-processing starts.")
ap = parameters.ap
parsed_inp_file = utilities.abaqus.inp_reader_v2.parse_inp_file(ap['inp_path'])
parts_list = utilities.abaqus.inp_tree_processor_v2.process_tree(parsed_inp_file)
part = get_desired_part(parts_list,ap)
## delete parsed parts to release memory
del parsed_inp_file
del parts_list
##------------ The boundary output should be list of node instances
(inside_boundary,outside_boundary,original_outside_boundary) = geometry.boundary_extractor.get_all_boundary_nodes(ap,part)
# print("inside: ",inside_boundary)
# inside_plot = []
# for cluster in inside_boundary:
# for node in cluster.values():
# inside_plot.append(node.coordinates)
# tr_list = list(numpy.transpose(inside_plot))
# fig = plt.figure()
# ax = fig.add_subplot(111, projection='3d')
# ax.scatter(tr_list[0],tr_list[1],tr_list[2], c='r', marker='.', s=[2, 2, 2])
# ax.set_title("Inside boundary nodes")
# plt.show()
#
# print("outside: ",outside_boundary)
# outside_plot = []
# for node in outside_boundary.values():
# outside_plot.append(node.coordinates)
# tr_list = list(numpy.transpose(outside_plot))
# fig = plt.figure()
# ax = fig.add_subplot(111, projection='3d')
# ax.scatter(tr_list[0],tr_list[1],tr_list[2], c='r', marker='.', s=[2, 2, 2])
# ax.set_title("outside boundary nodes")
# plt.show()
# print("original: ",original_outside_boundary)
# scatter_plot(outside_boundary, 'outside nodes')