Reads .node and .ele files created by triangle and returns a dict of nodes and triangular elements.
(base_file)
| 118 | return np.array(elements) |
| 119 | # }}} |
| 120 | def load_model(base_file): # {{{ |
| 121 | """ |
| 122 | Reads <base_file>.node and <base_file>.ele files |
| 123 | created by triangle and returns a dict of |
| 124 | nodes and triangular elements. |
| 125 | """ |
| 126 | |
| 127 | node_file = f'{base_file}.node' |
| 128 | elem_file = f'{base_file}.ele' |
| 129 | |
| 130 | return { |
| 131 | 'vertices' : load_node_file(node_file), |
| 132 | 'triangles' : load_ele_file( elem_file) - 1, # 0-based indexing |
| 133 | 'constrained_x' : np.array([]), |
| 134 | 'constrained_y' : np.array([]), |
| 135 | } |
| 136 | # }}} |
| 137 | def main(): # {{{ |
| 138 | if len(sys.argv) < 2: |
no test coverage detected