Foam::labelListList Foam::GAMGProcAgglomeration::globalCellCells ( const lduMesh& mesh ) { const lduAddressing& addr = mesh.lduAddr(); lduInterfacePtrsList interfaces = mesh.interfaces(); const label myProcID = Pstream::myProcNo(mesh.comm()); globalIndex globalNumbering ( addr.size(), Pstream::msgType(), mesh.comm(), Pstream::parRun() ); labelList globalIndices(addr.size()); forAll(globalIndices, cellI) { globalIndices[cellI] = globalNumbering.toGlobal(myProcID, cellI); }
Foam::labelListList Foam::GAMGProcAgglomeration::globalCellCells ( const lduMesh& mesh ) { const lduAddressing& addr = mesh.lduAddr(); lduInterfacePtrsList interfaces = mesh.interfaces(); const label myProcID = Pstream::myProcNo(mesh.comm()); globalIndex globalNumbering ( addr.size(), Pstream::msgType(), mesh.comm(), Pstream::parRun() ); labelList globalIndices ( identity ( globalNumbering.localSize(myProcID), globalNumbering.localStart(myProcID) ) ); // Get the interface cells PtrList<labelList> nbrGlobalCells(interfaces.size()); { // Initialise transfer of restrict addressing on the interface forAll(interfaces, inti) { if (interfaces.set(inti)) { interfaces[inti].initInternalFieldTransfer ( Pstream::commsTypes::nonBlocking, globalIndices ); } } if (Pstream::parRun()) { Pstream::waitRequests(); } forAll(interfaces, inti) { if (interfaces.set(inti)) { nbrGlobalCells.set ( inti, new labelList ( interfaces[inti].internalFieldTransfer ( Pstream::commsTypes::nonBlocking, globalIndices ) ) ); } } } // Scan the neighbour list to find out how many times the cell // appears as a neighbour of the face. Done this way to avoid guessing // and resizing list labelList nNbrs(addr.size(), 1); const labelUList& nbr = addr.upperAddr(); const labelUList& own = addr.lowerAddr(); { forAll(nbr, facei) { nNbrs[nbr[facei]]++; nNbrs[own[facei]]++; } forAll(interfaces, inti) { if (interfaces.set(inti)) { const labelUList& faceCells = interfaces[inti].faceCells(); forAll(faceCells, i) { nNbrs[faceCells[i]]++; } } } }