| 38 | } |
| 39 | |
| 40 | void WireAttributes::add_attribute(const WireNetwork& wire_network, |
| 41 | const std::string& name, bool vertex_wise, bool auto_compute) { |
| 42 | AttrMap::const_iterator itr = m_attr_map.find(name); |
| 43 | if (itr != m_attr_map.end()) { |
| 44 | throw_attribute_exists_error(name); |
| 45 | } |
| 46 | |
| 47 | WireAttribute::Ptr attribute = WireAttribute::create(name, |
| 48 | vertex_wise ? WireAttribute::VERTEX : WireAttribute::EDGE); |
| 49 | if (auto_compute) attribute->compute(wire_network); |
| 50 | |
| 51 | m_attr_map[name] = attribute; |
| 52 | } |
| 53 | |
| 54 | void WireAttributes::set_attribute(const WireNetwork& wire_network, |
| 55 | const std::string& name, const MatrixFr& values) { |