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

Function procNeighbours

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

Get list of my processor neighbours

Source from the content-addressed store, hash-verified

47
48// Get list of my processor neighbours
49labelList procNeighbours(const polyMesh& mesh)
50{
51 word procLabel = '[' + word(name(Pstream::myProcNo())) + "]-";
52
53 label nNeighbours = 0;
54
55 forAll(mesh.boundaryMesh(), patchi)
56 {
57 if (isA<processorPolyPatch>(mesh.boundaryMesh()[patchi]))
58 {
59 nNeighbours++;
60 }
61 }
62
63 labelList neighbours(nNeighbours);
64
65 nNeighbours = 0;
66
67 forAll(mesh.boundaryMesh(), patchi)
68 {
69 if (isA<processorPolyPatch>(mesh.boundaryMesh()[patchi]))
70 {
71 const polyPatch& patch = mesh.boundaryMesh()[patchi];
72
73 const processorPolyPatch& procPatch =
74 refCast<const processorPolyPatch>(patch);
75
76 label procId = procPatch.neighbProcNo() - Pstream::firstSlave() + 1;
77
78 neighbours[nNeighbours++] = procId;
79 }
80 }
81
82 return neighbours;
83}
84
85
86// Calculate some average position for mesh.

Callers 2

mainFunction · 0.85

Calls 4

wordClass · 0.85
nameFunction · 0.50
forAllFunction · 0.50
neighbProcNoMethod · 0.45

Tested by

no test coverage detected