/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2012-2026 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "PatchTools.H" #include "polyMesh.H" #include "globalMeshData.H" #include "mergePoints.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::PatchTools::gatherAndMerge ( const scalar mergeDist, const PrimitivePatch& p, Field::PointType>& mergedPoints, List::FaceType>& mergedFaces, labelList& pointMergeMap ) { typedef typename PrimitivePatch::FaceType FaceType; typedef typename PrimitivePatch::PointType PointType; // Collect points from all processors labelList pointSizes; { List> gatheredPoints(Pstream::nProcs()); gatheredPoints[Pstream::myProcNo()] = p.points(); Pstream::gatherList(gatheredPoints); if (Pstream::master()) { pointSizes = ListListOps::subSizes ( gatheredPoints, accessOp() ); mergedPoints = ListListOps::combine> ( gatheredPoints, accessOp() ); } } // Collect faces from all processors and renumber using sizes of // gathered points { List> gatheredFaces(Pstream::nProcs()); gatheredFaces[Pstream::myProcNo()] = p; Pstream::gatherList(gatheredFaces); if (Pstream::master()) { mergedFaces = static_cast&> ( ListListOps::combineOffset> ( gatheredFaces, pointSizes, accessOp(), offsetOp() ) ); } } if (Pstream::master()) { Field newPoints; labelList oldToNew; bool hasMerged = mergePoints ( mergedPoints, mergeDist, false, // verbosity oldToNew, newPoints ); if (hasMerged) { // Store point mapping pointMergeMap.transfer(oldToNew); // Copy points mergedPoints.transfer(newPoints); // Relabel faces List& faces = mergedFaces; forAll(faces, facei) { inplaceRenumber(pointMergeMap, faces[facei]); } } } } template void Foam::PatchTools::gatherAndMerge ( const polyMesh& mesh, const FaceList& localFaces, const labelList& meshPoints, const Map