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

Function main

scripts/distortion.py:260–284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

258 orientation[i], ]);
259
260def main():
261 args = parse_args();
262 mesh = pymesh.load_mesh(args.input_mesh, drop_zero_dim=True);
263 if mesh.num_voxels > 0 and mesh.vertex_per_voxel != 4:
264 raise RuntimeError("Only tet mesh is supported for distortion computation");
265 elif mesh.num_voxels == 0 and mesh.num_faces > 0 and mesh.vertex_per_face!=3:
266 raise RuntimeError("Only triangle mesh is supported for distortion computation");
267
268 numeric_level = getattr(logging, args.log, None);
269 if not isinstance(numeric_level, int):
270 raise ValueError('Invalid log level: %s' % loglevel);
271 logging.basicConfig(level=numeric_level);
272
273 if mesh.num_voxels > 0:
274 compute_distortion_energies_3D(mesh);
275 compute_tet_quality_measures(mesh);
276 if args.csv != None:
277 output_to_csv_3D(mesh, args.csv);
278 else:
279 compute_distortion_energies_2D(mesh);
280 compute_tri_quality_measures(mesh);
281 if args.csv != None:
282 output_to_csv_2D(mesh, args.csv);
283
284 pymesh.save_mesh(args.output_mesh, mesh, *mesh.attribute_names);
285
286if __name__ == "__main__":
287 main();

Callers 1

distortion.pyFile · 0.70

Calls 10

RuntimeErrorClass · 0.85
output_to_csv_3DFunction · 0.85
output_to_csv_2DFunction · 0.85
parse_argsFunction · 0.70
load_meshMethod · 0.45
save_meshMethod · 0.45

Tested by

no test coverage detected