Geometry (positions + connections) writeSorted: sort acc. to patch
| 38 | // Geometry (positions + connections) |
| 39 | // writeSorted: sort acc. to patch |
| 40 | void triSurface::writeDXGeometry |
| 41 | ( |
| 42 | const bool writeSorted, |
| 43 | Ostream& os |
| 44 | ) const |
| 45 | { |
| 46 | labelList faceMap; |
| 47 | surfacePatchList patches(calcPatches(faceMap)); |
| 48 | |
| 49 | // Print patch names as comment |
| 50 | os << "# Patches:" << endl; |
| 51 | forAll(patches, patchi) |
| 52 | { |
| 53 | os << "# " << patchi << " " |
| 54 | << patches[patchi].name() << endl; |
| 55 | } |
| 56 | os << nl << endl; |
| 57 | |
| 58 | // Write vertex coordinates |
| 59 | |
| 60 | os << "# The irregular positions" << endl |
| 61 | << "object 1 class array type float rank 1 shape 3 items " |
| 62 | << nPoints() << " data follows" << endl; |
| 63 | forAll(localPoints(), pointi) |
| 64 | { |
| 65 | const point& pt = localPoints()[pointi]; |
| 66 | os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl; |
| 67 | } |
| 68 | os << endl; |
| 69 | |
| 70 | os << "# The irregular connections (triangles)" << endl |
| 71 | << "object 2 class array type int rank 1 shape 3 items " |
| 72 | << size() << " data follows" << endl; |
| 73 | |
| 74 | if (writeSorted) |
| 75 | { |
| 76 | label faceIndex = 0; |
| 77 | |
| 78 | forAll(patches, patchi) |
| 79 | { |
| 80 | // Print all faces belonging to this patch |
| 81 | |
| 82 | for |
| 83 | ( |
| 84 | label patchFacei = 0; |
| 85 | patchFacei < patches[patchi].size(); |
| 86 | patchFacei++ |
| 87 | ) |
| 88 | { |
| 89 | const label facei = faceMap[faceIndex++]; |
| 90 | const labelledTri& f = localFaces()[facei]; |
| 91 | |
| 92 | os << f[0] << ' ' << f[1] << ' ' << f[2] << endl; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | else |
| 97 | { |