| 61 | } |
| 62 | |
| 63 | void VEGAParser::parse_vertices(std::ifstream& fin) { |
| 64 | const std::string header = IOUtils::next_line(fin); |
| 65 | std::stringstream header_stream(header); |
| 66 | header_stream >> m_num_vertices >> m_dim; |
| 67 | for (size_t i=0; i<m_num_vertices; i++) { |
| 68 | if (fin.eof()) { |
| 69 | throw IOError("Error parsing VEGA vertices, EOF reached!"); |
| 70 | } |
| 71 | const std::string line = IOUtils::next_line(fin); |
| 72 | size_t index; |
| 73 | VectorF v(3); |
| 74 | std::stringstream v_line(line); |
| 75 | v_line >> index >> v[0] >> v[1] >> v[2]; |
| 76 | m_vertices.push_back(v); |
| 77 | if (i == 0 && index == 0 && m_vertices.size() == 1) { |
| 78 | m_index_start_from_zero = true; |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | void VEGAParser::parse_elements(std::ifstream& fin) { |
| 84 | const std::string elem_type = IOUtils::next_line(fin); |