// Calculate global faces per pp edge. Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces ( const polyMesh& mesh, const globalIndex& globalFaces, const indirectPrimitivePatch& pp, const labelList& meshEdges ) { //// Determine coupled edges just so we don't have to have storage //// for all non-coupled edges. // //PackedBoolList isCoupledEdge(mesh.nEdges()); // //const polyBoundaryMesh& patches = mesh.boundaryMesh(); // //forAll(patches, patchI) //{ // const polyPatch& pp = patches[patchI]; // // if (pp.coupled()) // { // const labelList& meshEdges = pp.meshEdges(); // // forAll(meshEdges, i) // { // isCoupledEdge.set(meshEdges[i], 1); // } // } //} // From mesh edge to global face labels. Sized only for pp edges. labelListList globalEdgeFaces(mesh.nEdges()); const labelListList& edgeFaces = pp.edgeFaces(); forAll(edgeFaces, edgeI) { label meshEdgeI = meshEdges[edgeI]; //if (isCoupledEdge.get(meshEdgeI) == 1) { const labelList& eFaces = edgeFaces[edgeI]; // Store face and processor as unique tag. labelList& globalEFaces = globalEdgeFaces[meshEdgeI]; globalEFaces.setSize(eFaces.size()); forAll(eFaces, i) { globalEFaces[i] = globalFaces.toGlobal(pp.addressing()[eFaces[i]]); } }
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributePatches ( const mapDistribute& map, const TargetPatch& pp, const globalIndex& gi, List<faceList>& faces, List<pointField>& points, List<labelList>& faceIDs ) const { PstreamBuffers pBufs(Pstream::nonBlocking); for (label domain = 0; domain < Pstream::nProcs(); domain++) { const labelList& sendElems = map.subMap()[domain]; if (domain != Pstream::myProcNo() && sendElems.size()) { labelList globalElems(sendElems.size()); forAll(sendElems, i) { globalElems[i] = gi.toGlobal(sendElems[i]); } faceList subFaces(UIndirectList<face>(pp, sendElems)); primitivePatch subPatch ( SubList<face>(subFaces, subFaces.size()), pp.points() ); if (debug & 2) { Pout<< "distributePatches: to processor " << domain << " sending faces " << subPatch.faceCentres() << endl; } UOPstream toDomain(domain, pBufs); toDomain << subPatch.localFaces() << subPatch.localPoints() << globalElems; }
triSurface triangulate ( const polyBoundaryMesh& bMesh, const labelHashSet& includePatches, const labelListIOList& finalAgglom, labelList& triSurfaceToAgglom, const globalIndex& globalNumbering, const polyBoundaryMesh& coarsePatches ) { const polyMesh& mesh = bMesh.mesh(); // Storage for surfaceMesh. Size estimate. DynamicList<labelledTri> triangles ( mesh.nFaces() - mesh.nInternalFaces() ); label newPatchI = 0; label localTriFaceI = 0; forAllConstIter(labelHashSet, includePatches, iter) { const label patchI = iter.key(); const polyPatch& patch = bMesh[patchI]; const pointField& points = patch.points(); label nTriTotal = 0; forAll(patch, patchFaceI) { const face& f = patch[patchFaceI]; faceList triFaces(f.nTriangles(points)); label nTri = 0; f.triangles(points, nTri, triFaces); forAll(triFaces, triFaceI) { const face& f = triFaces[triFaceI]; triangles.append(labelledTri(f[0], f[1], f[2], newPatchI)); nTriTotal++; triSurfaceToAgglom[localTriFaceI++] = globalNumbering.toGlobal ( Pstream::myProcNo(), finalAgglom[patchI][patchFaceI] + coarsePatches[patchI].start() ); } } newPatchI++; } triSurfaceToAgglom.resize(localTriFaceI-1); triangles.shrink(); // Create globally numbered tri surface triSurface rawSurface(triangles, mesh.points()); // Create locally numbered tri surface triSurface surface ( rawSurface.localFaces(), rawSurface.localPoints() ); // Add patch names to surface surface.patches().setSize(newPatchI); newPatchI = 0; forAllConstIter(labelHashSet, includePatches, iter) { const label patchI = iter.key(); const polyPatch& patch = bMesh[patchI]; surface.patches()[newPatchI].index() = patchI; surface.patches()[newPatchI].name() = patch.name(); surface.patches()[newPatchI].geometricType() = patch.type(); newPatchI++; } return surface; }