| 54 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 55 | |
| 56 | bool Foam::fileFormats::TRIsurfaceFormatCore::read |
| 57 | ( |
| 58 | const fileName& filename |
| 59 | ) |
| 60 | { |
| 61 | this->clear(); |
| 62 | sorted_ = true; |
| 63 | |
| 64 | IFstream is(filename); |
| 65 | if (!is.good()) |
| 66 | { |
| 67 | FatalErrorInFunction |
| 68 | << "Cannot read file " << filename |
| 69 | << exit(FatalError); |
| 70 | } |
| 71 | |
| 72 | // uses similar structure as STL, just some points |
| 73 | // the rest of the reader resembles the STL binary reader |
| 74 | DynamicList<point> dynPoints; |
| 75 | DynamicList<label> dynZones; |
| 76 | DynamicList<label> dynSizes; |
| 77 | HashTable<label> lookup; |
| 78 | |
| 79 | // place faces without a group in zone0 |
| 80 | label zoneI = 0; |
| 81 | dynSizes.append(zoneI); |
| 82 | lookup.insert("zoneI", zoneI); |
| 83 | |
| 84 | while (is.good()) |
| 85 | { |
| 86 | string line = this->getLineNoComment(is); |
| 87 | |
| 88 | // handle continuations ? |
| 89 | // if (line[line.size()-1] == '\\') |
| 90 | // { |
| 91 | // line.substr(0, line.size()-1); |
| 92 | // line += this->getLineNoComment(is); |
| 93 | // } |
| 94 | |
| 95 | IStringStream lineStream(line); |
| 96 | |
| 97 | point p |
| 98 | ( |
| 99 | readScalar(lineStream), |
| 100 | readScalar(lineStream), |
| 101 | readScalar(lineStream) |
| 102 | ); |
| 103 | |
| 104 | if (!lineStream) break; |
| 105 | |
| 106 | dynPoints.append(p); |
| 107 | dynPoints.append |
| 108 | ( |
| 109 | point |
| 110 | ( |
| 111 | readScalar(lineStream), |
| 112 | readScalar(lineStream), |
| 113 | readScalar(lineStream) |
no test coverage detected