MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / main

Function main

applications/test/router/Test-processorRouter.C:96–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95
96int 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 {

Callers

nothing calls this directly

Calls 10

wordClass · 0.85
procNeighboursFunction · 0.85
meshCentreFunction · 0.85
nameFunction · 0.50
exitFunction · 0.50
forAllFunction · 0.50
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected