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

Method set_attribute

tools/Wires/Attributes/WireAttributes.cpp:54–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void WireAttributes::set_attribute(const WireNetwork& wire_network,
55 const std::string& name, const MatrixFr& values) {
56 AttrMap::iterator itr = m_attr_map.find(name);
57 if (itr == m_attr_map.end()) {
58 throw_attribute_not_found_error(name);
59 }
60
61 if (itr->second->get_attribute_type() == WireAttribute::VERTEX) {
62 if (values.rows() != wire_network.get_num_vertices()) {
63 std::stringstream err_msg;
64 err_msg << "Vertex attribute has " << values.rows() << " rows" << std::endl;
65 err_msg << "Expect " << wire_network.get_num_vertices() << " rows";
66 throw RuntimeError(err_msg.str());
67 }
68 } else {
69 if (values.rows() != wire_network.get_num_edges()) {
70 std::stringstream err_msg;
71 err_msg << "Edge attribute has " << values.rows() << " rows" << std::endl;
72 err_msg << "Expect " << wire_network.get_num_edges() << " rows";
73 throw RuntimeError(err_msg.str());
74 }
75 }
76
77 itr->second->set_values(values);
78}
79
80bool WireAttributes::is_vertex_attribute(const std::string& name) const {
81 AttrMap::const_iterator itr = m_attr_map.find(name);

Callers 15

save_meshFunction · 0.45
save_meshMethod · 0.45
save_meshMethod · 0.45
update_meshMethod · 0.45
update_attributesMethod · 0.45

Calls 9

RuntimeErrorClass · 0.85
findMethod · 0.80
get_attribute_typeMethod · 0.80
endMethod · 0.45
get_num_verticesMethod · 0.45
strMethod · 0.45
get_num_edgesMethod · 0.45
set_valuesMethod · 0.45

Tested by 11

save_meshMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
inflateMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36