| 94 | |
| 95 | |
| 96 | int main(int argc, char *argv[]) |
| 97 | { |
| 98 | #include "setRootCase.H" |
| 99 | #include "createTime.H" |
| 100 | #include "createMesh.H" |
| 101 | |
| 102 | word procLabel = '[' + word(name(Pstream::myProcNo())) + "]-"; |
| 103 | |
| 104 | if (!Pstream::parRun()) |
| 105 | { |
| 106 | FatalErrorInFunction |
| 107 | << "Please run in parallel" << exit(FatalError); |
| 108 | } |
| 109 | |
| 110 | // 'Gather' processor-processor topology |
| 111 | Gather<labelList> connections |
| 112 | ( |
| 113 | static_cast<const labelList&>(procNeighbours(mesh)) |
| 114 | ); |
| 115 | |
| 116 | // Collect centres of individual meshes (for visualization only) |
| 117 | Gather<point> meshCentres(meshCentre(mesh)); |
| 118 | |
| 119 | if (!Pstream::master()) |
| 120 | { |
| 121 | return 0; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | // |
| 126 | // At this point we have the connections between processors and the |
| 127 | // processor-mesh centres. |
| 128 | // |
| 129 | |
| 130 | Info<< "connections:" << connections << endl; |
| 131 | Info<< "meshCentres:" << meshCentres << endl; |
| 132 | |
| 133 | |
| 134 | // |
| 135 | // Dump connections and meshCentres to OBJ file |
| 136 | // |
| 137 | |
| 138 | fileName fName("decomposition.obj"); |
| 139 | |
| 140 | Info<< "Writing decomposition to " << fName << endl; |
| 141 | |
| 142 | OFstream objFile(fName); |
| 143 | |
| 144 | // Write processors as single vertex in centre of mesh |
| 145 | forAll(meshCentres, proci) |
| 146 | { |
| 147 | const point& pt = meshCentres[proci]; |
| 148 | |
| 149 | objFile << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl; |
| 150 | } |
| 151 | // Write connections as lines between processors (duplicated) |
| 152 | forAll(connections, proci) |
| 153 | { |
nothing calls this directly
no test coverage detected