/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 "DistributedDelaunayMesh.H" #include "meshSearch.H" #include "mapDistribute.H" #include "zeroGradientFvPatchFields.H" #include "pointConversion.H" #include "indexedVertexEnum.H" #include "IOmanip.H" #include #include // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // template Foam::autoPtr Foam::DistributedDelaunayMesh::buildMap ( const labelUList& toProc ) { // Determine send map // ~~~~~~~~~~~~~~~~~~ // 1. Count labelList nSend(Pstream::nProcs(), Zero); forAll(toProc, i) { label proci = toProc[i]; nSend[proci]++; } // 2. Size sendMap labelListList sendMap(Pstream::nProcs()); forAll(nSend, proci) { sendMap[proci].resize_nocopy(nSend[proci]); nSend[proci] = 0; } // 3. Fill sendMap forAll(toProc, i) { label proci = toProc[i]; sendMap[proci][nSend[proci]++] = i; } return autoPtr::New(std::move(sendMap)); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::DistributedDelaunayMesh::DistributedDelaunayMesh ( const Time& runTime ) : DelaunayMesh(runTime), allBackgroundMeshBounds_() {} template Foam::DistributedDelaunayMesh::DistributedDelaunayMesh ( const Time& runTime, const word& meshName ) : DelaunayMesh(runTime, meshName), allBackgroundMeshBounds_() {} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template bool Foam::DistributedDelaunayMesh::distributeBoundBoxes ( const boundBox& bb ) { allBackgroundMeshBounds_.reset(new List(Pstream::nProcs())); // Give the bounds of every processor to every other processor allBackgroundMeshBounds_()[Pstream::myProcNo()] = bb; Pstream::allGatherList(allBackgroundMeshBounds_()); return true; } template bool Foam::DistributedDelaunayMesh::isLocal ( const Vertex_handle& v ) const { return isLocal(v->procIndex()); } template bool Foam::DistributedDelaunayMesh::isLocal ( const label localProcIndex ) const { return localProcIndex == Pstream::myProcNo(); } template Foam::labelList Foam::DistributedDelaunayMesh::overlapProcessors ( const point& centre, const scalar radiusSqr ) const { DynamicList