| 34 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 35 | |
| 36 | void triSurface::writeTRI(const bool writeSorted, Ostream& os) const |
| 37 | { |
| 38 | const pointField& ps = points(); |
| 39 | |
| 40 | // Write as cloud of triangles |
| 41 | |
| 42 | labelList faceMap; |
| 43 | |
| 44 | surfacePatchList patches(calcPatches(faceMap)); |
| 45 | |
| 46 | if (writeSorted) |
| 47 | { |
| 48 | label faceIndex = 0; |
| 49 | |
| 50 | forAll(patches, patchi) |
| 51 | { |
| 52 | for |
| 53 | ( |
| 54 | label patchFacei = 0; |
| 55 | patchFacei < patches[patchi].size(); |
| 56 | patchFacei++ |
| 57 | ) |
| 58 | { |
| 59 | const label facei = faceMap[faceIndex++]; |
| 60 | |
| 61 | const point& p1 = ps[operator[](facei)[0]]; |
| 62 | const point& p2 = ps[operator[](facei)[1]]; |
| 63 | const point& p3 = ps[operator[](facei)[2]]; |
| 64 | |
| 65 | os << p1.x() << token::SPACE |
| 66 | << p1.y() << token::SPACE |
| 67 | << p1.z() << token::SPACE |
| 68 | |
| 69 | << p2.x() << token::SPACE |
| 70 | << p2.y() << token::SPACE |
| 71 | << p2.z() << token::SPACE |
| 72 | |
| 73 | << p3.x() << token::SPACE |
| 74 | << p3.y() << token::SPACE |
| 75 | << p3.z() << token::SPACE |
| 76 | |
| 77 | << "0x" << hex << operator[](facei).region() << dec |
| 78 | << endl; |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | forAll(*this, facei) |
| 85 | { |
| 86 | const point& p1 = ps[operator[](facei)[0]]; |
| 87 | const point& p2 = ps[operator[](facei)[1]]; |
| 88 | const point& p3 = ps[operator[](facei)[2]]; |
| 89 | |
| 90 | os << p1.x() << token::SPACE |
| 91 | << p1.y() << token::SPACE |
| 92 | << p1.z() << token::SPACE |
| 93 | |