MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / compute_cell_labels

Function compute_cell_labels

scripts/svg_to_mesh.py:154–171  ·  view source on GitHub ↗
(wires, mesh, logger)

Source from the content-addressed store, hash-verified

152 return mesh;
153
154def compute_cell_labels(wires, mesh, logger):
155 start_time = time();
156 arrangement = pymesh.Arrangement2();
157 arrangement.points = wires.vertices;
158 arrangement.segments = wires.edges;
159 arrangement.run();
160 mesh.add_attribute("face_centroid");
161 centroids = mesh.get_face_attribute("face_centroid");
162 r = arrangement.query(centroids);
163 finish_time = time();
164 t = finish_time - start_time;
165 logger.info("Arrangement running time: {}".format(t));
166
167 cell_type = np.array([item[0] for item in r]);
168 cell_ids = np.array([item[1] for item in r]);
169 cell_ids[cell_type != pymesh.Arrangement2.ElementType.CELL] = -1;
170 mesh.add_attribute("cell");
171 mesh.set_attribute("cell", cell_ids);
172
173def solve_heat_equation(mesh):
174 cell_ids = mesh.get_attribute("cell").ravel().astype(int);

Callers 1

mainFunction · 0.85

Calls 6

runMethod · 0.95
queryMethod · 0.95
Arrangement2Method · 0.80
get_face_attributeMethod · 0.80
add_attributeMethod · 0.45
set_attributeMethod · 0.45

Tested by

no test coverage detected