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

Method parse

tools/Wires/WireNetwork/WireParser.cpp:16–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14WireParser::WireParser() : m_dim(0) { }
15
16void WireParser::parse(const std::string& filename) {
17 reset();
18 std::ifstream fin(filename.c_str());
19 if (!fin.is_open()) {
20 std::stringstream err_msg;
21 err_msg << "Failed to open " << filename;
22 throw IOError(err_msg.str());
23 }
24
25 const size_t LINE_SIZE = 256;
26 char line[LINE_SIZE];
27 bool success;
28
29 while (!fin.eof()) {
30 fin.getline(line, LINE_SIZE);
31 switch (line[0]) {
32 case 'v':
33 success = parse_vertex_line(line);
34 break;
35 case 'l':
36 success = parse_edge_line(line);
37 break;
38 default:
39 // Ignore other lines by default.
40 success = true;
41 break;
42 }
43 if (!success) {
44 std::stringstream err_msg;
45 err_msg << "Error parsing line: \"" << line << "\"";
46 throw IOError(err_msg.str());
47 }
48 }
49 fin.close();
50}
51
52void WireParser::export_vertices(Float* buffer) const {
53 size_t i=0;

Callers

nothing calls this directly

Calls 2

IOErrorClass · 0.85
strMethod · 0.45

Tested by

no test coverage detected