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

Function main

scripts/add_element_attribute.py:73–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71 return parser.parse_args();
72
73def main():
74 args = parse_args();
75 mesh = pymesh.load_mesh(args.input_mesh);
76
77 formula = Formula(mesh);
78 values = formula.eval_formula(args.formula);
79 if isinstance(values, list):
80 values = np.array(values, dtype=float);
81 elif isinstance(values, (int, float)):
82 values = np.ones(mesh.num_elements, dtype=float) * values;
83 mesh.add_attribute(args.name);
84 mesh.set_attribute(args.name, values);
85
86 pymesh.save_mesh(args.output_mesh, mesh, *mesh.get_attribute_names());
87
88if __name__ == "__main__":
89 main();

Callers 1

Calls 8

eval_formulaMethod · 0.95
FormulaClass · 0.85
parse_argsFunction · 0.70
load_meshMethod · 0.45
add_attributeMethod · 0.45
set_attributeMethod · 0.45
save_meshMethod · 0.45
get_attribute_namesMethod · 0.45

Tested by

no test coverage detected