| 126 | return wires; |
| 127 | |
| 128 | def triangulate(wires, engine, stage, eps, logger, wire_file, json_file): |
| 129 | if wires.num_vertices == 0: |
| 130 | return pymesh.form_mesh(np.zeros((0, 2)), np.zeros((0,3))); |
| 131 | basename = os.path.splitext(wire_file)[0]; |
| 132 | if engine == "triwild": |
| 133 | out_mesh = "{}_linear.msh".format(basename); |
| 134 | log_file = "{}_triwild.log".format(basename); |
| 135 | if json_file is not None: |
| 136 | command = "TriWild --mute-log --feature-envelope-r {} --stage {} --log-file {} --feature-input {} --output-linear-mesh --skip-eps --input {} --output {}".format( |
| 137 | eps, stage, log_file, json_file, wire_file, basename); |
| 138 | else: |
| 139 | command = "TriWild --mute-log --feature-envelope-r {} --stage {} --log-file {} --output-linear-mesh --skip-eps --input {} --output {}".format( |
| 140 | eps, stage, log_file, wire_file, basename); |
| 141 | print(command); |
| 142 | start_time = time(); |
| 143 | check_call(command.split()); |
| 144 | finish_time = time(); |
| 145 | t = finish_time - start_time; |
| 146 | mesh = pymesh.load_mesh(out_mesh, drop_zero_dim=True); |
| 147 | else: |
| 148 | mesh, t = pymesh.triangulate_beta(wires.vertices, wires.edges, |
| 149 | engine=engine, with_timing=True); |
| 150 | logger.info("Triangulation running time: {}".format(t)); |
| 151 | |
| 152 | return mesh; |
| 153 | |
| 154 | def compute_cell_labels(wires, mesh, logger): |
| 155 | start_time = time(); |